Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <engine>
- #include <fakemeta>
- #include <zombieplague>
- static const szCountDownFolder[] = "zombie_plague/countdown/"
- new const szSoundMusic[] = "zombie_start3.mp3"
- new const szSoundCountdown[][] =
- {
- "1.wav",
- "2.wav",
- "3.wav",
- "4.wav",
- "5.wav",
- "6.wav",
- "7.wav",
- "8.wav",
- "9.wav",
- "10.wav"
- }
- IsMp3(const szSound[])
- return equali(szSound[strlen(szSound) - 4], ".mp3")
- public plugin_precache()
- {
- new szSound[60]
- for (new iIndex = 0; iIndex < charsmax(szSoundCountdown); iIndex++)
- {
- formatex(szSound, charsmax(szSound), "%s%s", szCountDownFolder, szSoundCountdown[iIndex])
- if (IsMp3(szSound))
- precache_generic(szSound)
- else
- precache_sound(szSound)
- }
- formatex(szSound, charsmax(szSound), "%s%s", szCountDownFolder, szSoundMusic)
- if (IsMp3(szSound))
- precache_generic(szSound)
- else
- precache_sound(szSound)
- }
- public plugin_init()
- {
- register_plugin("[ZP] Countdown", "1.0", "Jack")
- register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
- }
- public event_round_start()
- {
- set_task(1.0, "StartMusic")
- set_task(11.0, "StartCountDown")
- }
- public StartMusic()
- {
- new szSound[128]
- formatex(szSound, charsmax(szSound), "%s%s", szCountDownFolder, szSoundMusic)
- PlaySound(0, szSoundMusic, "mp3 play")
- }
- public StartCountDown()
- {
- set_task(1.0, "CountDownSound")
- }
- public CountDownSound()
- {
- new g_iCountDown = 10, szSound[128]
- while (g_iCountDown > 0)
- {
- client_print(0, print_center, "%d", g_iCountDown)
- formatex(szSound, charsmax(szSound), "%s%s", szCountDownFolder, szSoundCountdown[g_iCountDown - 1])
- PlaySound(0, szSound, "spk")
- g_iCountDown--
- }
- if (!g_iCountDown)
- {
- client_cmd(0, "mp3 stop")
- }
- }
- PlaySound(id, const szSound[], szPlayer[])
- {
- client_cmd(id, "%s ^"%s^"", szPlayer, szSound)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement