Would be preferable to use get_players.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#define PLUGIN "Alive Player"
#define VERSION "1.0"
#define AUTHOR "vato loco [GE-S]"
#define TASK_GETPLAYER 37852
#define TASK_LOOP_TIME 2.0
new g_SyncTeamCount
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
state OutOfRound
g_SyncTeamCount = CreateHudSyncObj()
register_logevent("LogEvent_Round_Start", 2, "1=Round_Start")
register_logevent("Logevent_Round_End", 2, "1=Round_End")
RegisterHam(Ham_Spawn, "player", "client_disconnect", true)
RegisterHam(Ham_Killed, "player", "client_disconnect", true)
}
public client_disconnect() <OutOfRound> {}
public client_disconnect() <InRound>
{
GetPlayers()
}
public LogEvent_Round_Start()
{
state InRound
remove_task( TASK_GETPLAYER )
set_task(TASK_LOOP_TIME, "GetPlayers", TASK_GETPLAYER, .flags="b")
}
public Logevent_Round_End()
{
state OutOfRound
remove_task( TASK_GETPLAYER )
}
public GetPlayers()
{
new iPlayers[32], iNum, iTnum, iCTnum
get_players(iPlayers, iNum, "a")
for(--iNum; iNum>=0; iNum--)
{
switch( cs_get_user_team( iPlayers[iNum] ) )
{
case CS_TEAM_T:++iTnum
case CS_TEAM_CT:++iCTnum
}
}
set_hudmessage(255, 50, 0, -1.0, 0.04, _, _, TASK_LOOP_TIME+0.01, _, _, 1)
ShowSyncHudMsg(0, g_SyncTeamCount, "[Alive T: %d] - [Alive CT: %d]", iTnum, iCTnum)
}
__________________