[Include] PlayerName
#1

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
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);
New way
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);
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
Код:
Version 1.0:
    - Initial release
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
Reply


Messages In This Thread
PlayerName - by Kwarde - 04.07.2011, 19:51
Re: PlayerName - by XpDeviL - 04.07.2011, 19:54
AW: PlayerName - by Forbidden - 04.07.2011, 20:10
Re: AW: PlayerName - by iPLEOMAX - 04.07.2011, 20:23
Re: PlayerName - by Kwarde - 04.07.2011, 20:29
Re: PlayerName - by FireCat - 04.07.2011, 20:42
Re: PlayerName - by Kwarde - 04.07.2011, 20:45
Re: PlayerName - by legodude - 05.07.2011, 09:34
Re: PlayerName - by Kwarde - 05.07.2011, 12:23
Re: PlayerName - by juraska - 05.07.2011, 13:46
Re: PlayerName - by SmileyForCheat - 05.07.2011, 13:49
Re: PlayerName - by Stepashka - 05.07.2011, 13:57
Re: PlayerName - by Hiddos - 05.07.2011, 14:01
Re: PlayerName - by Stepashka - 05.07.2011, 14:06
Re: PlayerName - by Hiddos - 05.07.2011, 16:01
Re: PlayerName - by System64 - 05.07.2011, 17:03
Re: PlayerName - by SPAWN_METAL - 05.07.2011, 17:45

Forum Jump:


Users browsing this thread: 2 Guest(s)