PHP Code:
#include <amxmodx>
#define USE_GETPLAYERS // uncommented - get_players, commented - loop for
public plugin_init() register_clcmd("say /status", "clcmd_status");
public clcmd_status(id) {
client_print(id, 3, "Alive TT: %i, Alive CT: %i, All TT: %i, All CT: %i", GetPlayers(1, 1), GetPlayers(1, 2), GetPlayers(0, 1), GetPlayers(0, 2));
}
#if defined USE_GETPLAYERS
stock GetPlayers(alive, team) {
new players[32], num;
get_players(players, num, alive ? "aceh" : "ceh", team == 1 ? "TERRORIST" : "CT");
return num;
}
#else
stock GetPlayers(alive, team) {
static maxpl; maxpl = get_maxplayers();
for(new i = 1; i <= maxpl; i++) {
if(!is_user_connected(i) || get_user_team(i) != team) continue;
if(alive && !is_user_alive(i)) continue;
i++;
}
return i;
}
#endif