Is this code
(team_count i run on DeathMsg, client disconnect, round start)
PHP Code:
public cmd_box(id) {
if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT) {
if(g_TeamAlive[CS_TEAM_T] <= get_pcvar_num(gp_BoxMax) && g_TeamAlive[CS_TEAM_T] > 1 && !g_BoxStarted) {
static i
for(i = 1; i <= g_max_clients; i++)
if(is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_T)
set_user_health(i, 100)
boxon = true
set_cvar_num("mp_tkpunish", 0)
set_cvar_num("mp_friendlyfire", 1)
g_BoxStarted = true
set_hudmessage(0, 255, 0, 0.08, 0.24, 2, 2.0, 6.0, 0.05, 0.2, 2)
new name[33]; get_user_name(id, name, charsmax(name))
ShowSyncHudMsg(0, g_HudSync, "Priziuretojas %s Ijunge BOKSO rezima!", name)
}
else {
set_hudmessage(255, 0, 0, 0.08, 0.24, 2, 2.0, 6.0, 0.05, 0.2, 2)
ShowSyncHudMsg(id, g_HudSync, "Ijungti BOKSO rezimo dabar negalima!")
}
}
return PLUGIN_HANDLED
}
public team_count() {
g_TeamAlive[CS_TEAM_UNASSIGNED] = 0
g_TeamAlive[CS_TEAM_T] = 0
g_TeamAlive[CS_TEAM_CT] = 0
g_TeamAlive[CS_TEAM_SPECTATOR] = 0
for(new i = 1; i <= g_max_clients; i++)
if(is_user_connected(i))
if(is_user_alive(i))
g_TeamAlive[cs_get_user_team(i)]++
}
can be replaced with this one?
PHP Code:
public cmd_box(id) {
new iPlayers[ 32 ];
get_players( iPlayers, g_TeamAlive[ CS_TEAM_T ], "aeh", "TERRORIST" );
if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT) {
if(g_TeamAlive[CS_TEAM_T] <= get_pcvar_num(gp_BoxMax) && g_TeamAlive[CS_TEAM_T] > 1 && !g_BoxStarted) {
static i
for(i = 1; i <= g_max_clients; i++)
if(is_user_alive(i) && cs_get_user_team(i) == CS_TEAM_T)
set_user_health(i, 100)
boxon = true
set_cvar_num("mp_tkpunish", 0)
set_cvar_num("mp_friendlyfire", 1)
g_BoxStarted = true
set_hudmessage(0, 255, 0, 0.08, 0.24, 2, 2.0, 6.0, 0.05, 0.2, 2)
new name[33]; get_user_name(id, name, charsmax(name))
ShowSyncHudMsg(0, g_HudSync, "Priziuretojas %s Ijunge BOKSO rezima!", name)
}
else {
set_hudmessage(255, 0, 0, 0.08, 0.24, 2, 2.0, 6.0, 0.05, 0.2, 2)
ShowSyncHudMsg(id, g_HudSync, "Ijungti BOKSO rezimo dabar negalima!")
}
}
return PLUGIN_HANDLED
}