Raised This Month: $ Target: $400
 0% 

how get count of players


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode