View Single Post
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-03-2011 , 12:14   Re: how get count of players
Reply With Quote #7

get_players can return false results with dead players and flags "e", so considering you gonna execute this at round end, it would be better to prevent those false results.

PHP Code:
public round_end()
{
    new 
iTerroristsNumiCtsNum
    CountTeams
(iTerroristsNumiCtsNum)
}


CountTeams(&TERRORISTS, &CTS)
{
    
TERORISTS 0
    CTS 
0
    
new iPlayers[32], iNum
    get_players
(iPlayersiNum"h")
    if( !
iNum )
    {
        return
    }
    for(--
iNumiNum<=0iNum--)
    {
        switch( 
cs_get_user_team(iPlayers[iNum]) )
        {
            case 
CS_TEAM_T:++TERRORISTS
            
case CS_TEAM_CT:++CTS
        
}
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-04-2011 at 00:26.
ConnorMcLeod is offline