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

get_players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InteX01
Senior Member
Join Date: Jan 2017
Old 11-22-2018 , 17:56   get_players
Reply With Quote #1

how to get number of players that have variable value lets say.
have_value[id] = 1

so how do i count online players with that = 1 value of have_value[id] variable
InteX01 is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-22-2018 , 21:42   Re: get_players
Reply With Quote #2

Code:
server_print( "online: %d", count_bro() )

COUNT_BRO()
{
	new players[ 32 ], pnum, id
	get_players( players, pnum )
	
	for( new i = 0; i < pnum; i++ )
	{
		id = players[ i ] 
		if( have_value[ id ] )
			value++
	}
	return value
}
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 11-23-2018 , 05:35   Re: get_players
Reply With Quote #3

PHP Code:
count_players()
{
    new 
players32 ], pnumvalue
    get_players
playerspnum )
    
    for( new 
ipnumi++ )
    { 
        if( 
have_valueplayers[i] ] )
            
value++
    }
    return 
value;

__________________
My English is A0
E1_531G 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 14:59.


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