How many players are online
#1

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

-_- you can see by pressing TAB
Reply
#3

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

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

Reply
#5

Using foreach is simpler.

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

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
Reply
#7

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?
Reply
#8

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.
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)