Raised This Month: $51 Target: $400
 12% 

Best way count players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pentakill
Member
Join Date: Oct 2014
Old 07-29-2019 , 23:03   Best way count players
Reply With Quote #1

Is this the best way to count players?
PHP Code:
new ctsnumtsnumteam

    
for (new i=1i<=MAX_JOGADORESi++)
    {
        if (!
is_user_connected(i) || !is_user_alive(i)) continue
        
team get_user_team(i)
        if (
team == 1tsnum++
        else if (
team == 2ctsnum++
    } 
pentakill is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-29-2019 , 23:07   Re: Best way count players
Reply With Quote #2

May be easiest to use get_players with the team flag. To do it manually I'd do this:
PHP Code:
new iTeamCountsCsTeams ];

for (new 
i=1i<=MAX_JOGADORESi++) 

    if ( 
is_user_alive) ) 
    {
        
iTeamCountscs_get_user_team) ]++;
    }
}  

//iTeamCounts[ CS_TEAM_T ] = T count
//iTeamCounts[ CS_TEAM_CT ] = CT count 
__________________

Last edited by Bugsy; 07-29-2019 at 23:09.
Bugsy is offline
Reply



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 15:20.


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