04.07.2011, 19:51
(
Последний раз редактировалось Kwarde; 08.07.2011 в 06:43.
)
Hi.
I just made an include (mostly for myself), but I'm gonna share it .
What is it
Very simple. It has an new 'SetPlayerName'. Example:
Old SetPlayerName:
I have the name 'kwarde'. I want 'Kwarde'. So I use SetPlayerName. It doesn't work!! (Because of the capitals, the name is the same, the server returns :P).
My new SetPlayerName:
I have the name 'kwarde'. I want 'Kwarde'. So I use SetPlayerName. It works!!!
And it has an 'PlayerName(playerid)' to get someone's name. You can either use that, or 'playerName[playerid]'. Your choise.
So it's just simple, but quite usefull, because it's easier to use. Example scripts:
Normal way
New way
It's not special, EXCEPT that this scripts uses a global variable:
new playerName[MAX_SLOTS][MAX_PLAYER_NAME];
The most people makes all the time a new 'pName', but this script doesn't .
Download
Version 1.0: Pastebin
Changelog
Instructions
1) Copy the script from pastebin into PAWNO
2) (Optional) Change 'MAX_PLAYERS' to the max slots of your server (if it wasn't done already!)
3) Save the file in your pawno/include folder
4) Add #include <{name}> to your gamemode/filterscript. NOTE: Change {name} for the name of the .inc file. TIP: Use PlayerName
That's it. Kinda simple, but also quite usefull (My opinion !!)
- Kevin
p.s.
I know I wouldn't release scripts anymore, seems like I changed my mind :P
I just made an include (mostly for myself), but I'm gonna share it .
What is it
Very simple. It has an new 'SetPlayerName'. Example:
Old SetPlayerName:
I have the name 'kwarde'. I want 'Kwarde'. So I use SetPlayerName. It doesn't work!! (Because of the capitals, the name is the same, the server returns :P).
My new SetPlayerName:
I have the name 'kwarde'. I want 'Kwarde'. So I use SetPlayerName. It works!!!
And it has an 'PlayerName(playerid)' to get someone's name. You can either use that, or 'playerName[playerid]'. Your choise.
So it's just simple, but quite usefull, because it's easier to use. Example scripts:
Normal way
pawn Код:
new pName[MAX_PLAYER_NAME], str[128]; //Overused cells
GetPlayerName(playerid, pName, sizeof(pName));
format(str, 128, "Hi %s!", pName);
SendClientMessage(playerid, 0xFFFFFFAA, str);
pawn Код:
new str[128]; //Overused cells :P
format(str, 128, "Hi %s!", playerName[playerid]); //Or instead of 'playerName[playerid]' PlayerName(playerid)
SendClientMessage(playerid, 0xFFFFFFAA, str);
new playerName[MAX_SLOTS][MAX_PLAYER_NAME];
The most people makes all the time a new 'pName', but this script doesn't .
Download
Version 1.0: Pastebin
Changelog
Код:
Version 1.0: - Initial release
1) Copy the script from pastebin into PAWNO
2) (Optional) Change 'MAX_PLAYERS' to the max slots of your server (if it wasn't done already!)
3) Save the file in your pawno/include folder
4) Add #include <{name}> to your gamemode/filterscript. NOTE: Change {name} for the name of the .inc file. TIP: Use PlayerName
That's it. Kinda simple, but also quite usefull (My opinion !!)
- Kevin
p.s.
I know I wouldn't release scripts anymore, seems like I changed my mind :P