SA-MP Forums Archive
How many players are online - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How many players are online (/showthread.php?tid=587847)



How many players are online - HyperVoice - 03.09.2015

Is there any code for tht? Sorry, im a beginner lol


Re: How many players are online - SoFahim - 03.09.2015

-_- you can see by pressing TAB


Re: How many players are online - HyperVoice - 03.09.2015

I know that lol. I meant i need a code for my script. Sorry for the misunderstanding Thank you for your help btw


Re: How many players are online - Sjn - 03.09.2015

PHP код:
GetConnectedPlayers()
{
    new
        
ConnectedPlayers;
    
    for (new 
0MAX_PLAYERSi++)
    {
        if (!
IsPlayerConnected(i) || == INVALID_PLAYER_ID) continue;
        
ConnectedPlayers++;
    }
    
    return 
ConnectedPlayers;




Re: How many players are online - Syzygy1 - 03.09.2015

Using foreach is simpler.

pawn Код:
GetConnectedPlayers()
{
    new count;
   
    foreach(new i : Player)
    {
        count++;
    }
   
    return count;
}



Re: How many players are online - PSYCHOBABYKILLA - 03.09.2015

Quote:
Originally Posted by Syzygy1
Посмотреть сообщение
Using foreach is simpler.

pawn Код:
GetConnectedPlayers()
{
    new count;
   
    foreach(new i : Player)
    {
        count++;
    }
   
    return count;
}
the guy asking the question needs help do you think he knows what foreach is

try correcting the guy asking the questions fool

ps i dont got the code for him i tried but if it takes more than 2 minutes im not wasting my time no1 helps me


Re: How many players are online - Evocator - 03.09.2015

Quote:
Originally Posted by Sjn
Посмотреть сообщение
PHP код:
GetConnectedPlayers()
{
    new
        
ConnectedPlayers;
    
    for (new 
0MAX_PLAYERSi++)
    {
        if (!
IsPlayerConnected(i) || == INVALID_PLAYER_ID) continue;
        
ConnectedPlayers++;
    }
    
    return 
ConnectedPlayers;

How could i be INVALID_PLAYER_ID when the max value that i will be is MAX_PLAYERS?


Re: How many players are online - Syzygy1 - 03.09.2015

Quote:
Originally Posted by PSYCHOBABYKILLA
Посмотреть сообщение
the guy asking the question needs help do you think he knows what foreach is

try correcting the guy asking the questions fool

ps i dont got the code for him i tried but if it takes more than 2 minutes im not wasting my time no1 helps me
Oh, sorry. I left him the arduous job of Googling "foreach samp", and didn't spoon-feed him all of the code.


Re: How many players are online - PSYCHOBABYKILLA - 03.09.2015

Quote:
Originally Posted by Syzygy1
Посмотреть сообщение
Oh, sorry. I left him the arduous job of Googling "foreach samp", and didn't spoon-feed him all of the code.
yea well when your trying to make a samp script you will be googling over a 100 differnt things cuz no retards can help

PS the majority of samp scripters didnt help me and that didnt help me read all them fucking ****** posts

sometimes u can ****** the shit u want and still wont get the answer thats how i know your a trash scripter