#include <amxmodx>
#include <amxmisc>
#include <zombieplague>

#define PLUGIN "[ZP] Countdown"
#define VERSION "1.0"
#define AUTHOR "Mr.Apple"

new countdown
new time_s

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
}

public plugin_precache()
{
    precache_sound( "fvox/Announcer10.wav" )
    precache_sound( "fvox/Announcer9.wav" )
    precache_sound( "fvox/Announcer8.wav" )
    precache_sound( "fvox/Announcer7.wav" )
    precache_sound( "fvox/Announcer6.wav" )
    precache_sound( "fvox/Announcer5.wav" )
    precache_sound( "fvox/Announcer4.wav" )
    precache_sound( "fvox/Announcer3.wav" )
    precache_sound( "fvox/Announcer2.wav" )
    precache_sound( "fvox/Announcer1.wav" )
}

public event_round_start()
{
    set_task(4.0, "zombie_countdown")
    time_s = 10
    countdown = 9
}

public zombie_countdown()
{    
    new speak[ 10 ][] = { "fvox/Announcer1.wav", "fvox/Announcer2.wav", "fvox/Announcer3.wav", "fvox/Announcer4.wav", "fvox/Announcer5.wav", "fvox/Announcer6.wav", "fvox/Announcer7.wav", "fvox/Announcer8.wav", "fvox/Announcer9.wav", "fvox/Announcer10.wav" }

    emit_sound( 0, CHAN_VOICE, speak[ countdown ], 1.0, ATTN_NORM, 0, PITCH_NORM )
    countdown--
        
    set_hudmessage(179, 0, 0, -1.0, 0.28, 2, 0.02, 1.0, 0.01, 0.1, 10); 
    show_hudmessage(0, "%i", time_s); 
    --time_s;
        
    if(time_s >= 1)
    {
        set_task(1.0, "zombie_countdown")
    }
}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/
