PHP Code:
#include <amxmodx>
#include <engine>
#define DELAY_A 150
#define DELAY_W 0.5
#define HUD_STAY DELAY_W + 0.1
enum _:CVARS {
RED,
GREEN,
BLUE,
LOCATION
};
enum _:TEAMS {
TE,
CT
};
new g_pCvars[ CVARS ];
public plugin_init( )
{
register_plugin( "Players Remaining", "1.0", "xPaw" );
g_pCvars[ RED ] = register_cvar( "amx_pr_red", "0" );
g_pCvars[ GREEN ] = register_cvar( "amx_pr_green", "127" );
g_pCvars[ BLUE ] = register_cvar( "amx_pr_blue", "255" );
register_event( "HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0" );
register_logevent( "Logevent_Round_End", 2, "1=Round_End" )
}
public Event_HLTV_New_Round( )
{
new iEntity = create_entity( "info_target" );
if( is_valid_ent( iEntity ) )
{
entity_set_string( iEntity, EV_SZ_classname, "PlayersRemainThinker" );
entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + DELAY_A );
register_think( "PlayersRemainThinker", "FwdThink" );
}
else
{
set_task( 1.5 , "ShowMessage", _, _, _, "b", 1243798 );
}
}
public FwdThink( iEntity )
{
set_task( 1.5, "ShowMessage", _, _, _, "b", 2542462 );
entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + DELAY_W );
}
public Logevent_Round_End( )
{
remove_task( 1243798 );
remove_task( 2542462 );
}
public ShowMessage( )
{
new iPlayers[ 32 ], iNum[ TEAMS ];
get_players( iPlayers, iNum[ TE ], "ae", "TERRORIST" );
get_players( iPlayers, iNum[ CT ], "ae", "CT" );
if( iNum[ TE ] > 0 || iNum[ CT ] > 0 )
{
new iCvars[ CVARS ];
iCvars[ RED ] = get_pcvar_num( g_pCvars[ RED ] );
iCvars[ GREEN ] = get_pcvar_num( g_pCvars[ GREEN ] );
iCvars[ BLUE ] = get_pcvar_num( g_pCvars[ BLUE ] );
set_hudmessage( iCvars[ RED ], iCvars[ GREEN ], iCvars[ BLUE ], 0.79, 0.51, 0, HUD_STAY, HUD_STAY, 0.0, 0.0, 4 );
show_hudmessage( 0, "Zombie Connectés : %i^nSurvivants Restants : %i", iNum[ TE ], iNum[ CT ] );
}
}