Code:
#include <amxmodx>
#include <engine>
new const Version[] = "0.1";
const iCountTime = 1500;
new g_iCountdownEntity;
new g_iCounter;
public plugin_init()
{
register_plugin( "Fast Countdown" , Version , "bugsy" );
g_iCountdownEntity = create_entity( "info_target" );
entity_set_string( g_iCountdownEntity , EV_SZ_classname , "countdown_entity" );
register_think( "countdown_entity" , "fw_CountdownEntThink" );
register_clcmd( "say /countdown" , "ShowCountdown" );
}
public ShowCountdown()
{
g_iCounter = iCountTime;
entity_set_float( g_iCountdownEntity , EV_FL_nextthink , get_gametime() + 0.01 );
}
public fw_CountdownEntThink( iEntity )
{
if ( iEntity == g_iCountdownEntity )
{
set_hudmessage( 255 , 255 , 255 , -1.0 , -1.0 , 0 , 0.1 , 0.1 );
show_hudmessage( 0 , "[ Countdown ends in: %d ]" , --g_iCounter );
if ( g_iCounter )
entity_set_float( g_iCountdownEntity , EV_FL_nextthink , get_gametime() + 0.01 );
else
server_cmd( "sv_restartround 1" );
}
}