31.07.2011, 18:32
Why in the heck do you use for loop?
Here you go;
Compare these two to yours, and see what's the differences.
This function returns the player his name faster and easier.
EDIT: If you are a beginner, that is still good but compare the differences so your knowledge would be higher.
Here you go;
Compare these two to yours, and see what's the differences.
pawn Код:
public OnPlayerConenct(playerid) {
format(stringa, sizeof stringa, "%s (ID:%d) has joined the server", GetPlayerNameEx(playerid), playerid);
SendClientMessageToAll(-1, stringa);
GameTextForPlayer(playerid, "~b~Benvenuto su~n~~g~I~w~L~r~V ~y~SA-MP Server~n~~b~Versione~n~~r~v0.1~n~~b~Ultimo aggiornamento~n~~r~31/07/2011", 7000, 3); //GAMETEXTFORPLAYER
return 1;
}
pawn Код:
public OnPlayerDisconenct(playerid) {
switch(reason) {
case 0: format(stringa, sizeof stringa, "%s has left the server (Crash)", GetPlayerNameEx(playerid));
case 1: format(stringa, sizeof stringa, "%s has left the server", GetPlayerNameEx(playerid));
case 2: format(stringa, sizeof stringa, "%s has left the server (Kicked/Banned)", GetPlayerNameEx(playerid));
}
SendClientMessageToAll(-1, stringa);
return 1;
}
pawn Код:
stock GetPlayerNameEx(playerid) {
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
return PlayerName;
}