AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_players (https://forums.alliedmods.net/showthread.php?t=312243)

InteX01 11-22-2018 17:56

get_players
 
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

JocAnis 11-22-2018 21:42

Re: get_players
 
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
}


E1_531G 11-23-2018 05:35

Re: get_players
 
PHP Code:

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




All times are GMT -4. The time now is 07:33.

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