What is it this lines means ?
#1

What is it this lines means ?

Код:
Public OnPlayerConnect
{


playersconnected++;
//playersconnect+= 1;
new string [128];
format (string, sizeof(string), "There are currently &d/&i people in the server"
return 1;

}
What this lines means ?


And whats the different of &d/&i?

And what is string ? And why 128 ?
Reply
#2

It means lots of errors. In pseudocode you could say that when player connects, then increment value of playersconnected and waste a good set of 128 cells.
Reply
#3

It's not finished, but it adds 1 player to playersconnected variable (that tells how many players are online) and it's supposed to format a string with the number of total players. Anyway that's unfinished and has some errors.

The correct way would be:

pawn Код:
Public OnPlayerConnect
{
     playersconnected++;
     new string [128];
     format (string, sizeof(string), "There are currently %d people in the server", playersconnected);
     SendClientMessageToAll(COLOR, string);
     return 1;
}
_______


Answering to your edition, %d and %i represents an integer value (just a number). String is a way to store text into a varialbe, and it's 128 positions long because it's the maximum length accepted by SA:MP.
Reply
#4

wow , too many question and i can anwser all of them
ok , so playersconnected++; mean that always when a player join the server, the playersconnected variable will increase and it will be used to get how many people are on the servers
string is 128 because who maked it wanted to be 128, string mean the number of characters from that text, so if in the text are more characters than the string value this will not show all the text.
%d , %i are used to get variablesm so if is d you can use it to get numbers or other numbers or staff like that , when %i is usualy used to get id of something.
Also , you will get a lot of errors if you paste that into your script cause isn't complete.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)