Quote:
Originally Posted by Firippu
There are multiple ways of doing this.. One way, you could loop through all possible player IDs and count the ones under given conditions.
This example here stores player counts in variables for both teams.
PHP Code:
new iTEcount,iCTcount for(new id=1; id<=32; id++) { if(is_user_connected(id)) { switch(cs_get_user_team(id)) { case CS_TEAM_T: { iTEcount++ } case CS_TEAM_CT: { iCTcount++ } } } }
// iTEcount = number of players in terrorist team // iCTcount = number of players in counter terrorist team
// example if(iTEcount>=5) { // this will run if there are 5 or more players in terrorist team }
|
Can i use it in client_putinserver ?
PHP Code:
public client_putinserver ( id )
{
new iTEcount, iCTcount;
for( new id = 1; id <= 32; id++ )
{
if ( is_user_connected( id ) )
{
switch ( cs_get_user_team( id ) )
{
case CS_TEAM_T: iTEcount++
case CS_TEAM_CT: iCTcount++
}
}
}
}
if ( iTEcount >= 2 && iCTcount >= 2 )
{
if ( !g_bIsFreezeTime && !is_user_bot( id ) && !is_user_hltv( id ) )
// next stage
}
}