SA-MP Forums Archive
GetPlayerNameEx - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetPlayerNameEx (/showthread.php?tid=297005)



GetPlayerNameEx - Silentzx - 13.11.2011

Hey,

I am currently editing a script for a friend and i saw that "GetPlayerNameEx" can be used, however i am not sure how to add this function as the script didnt have the stock of anything like it.

Thanks


Re: GetPlayerNameEx - BlackWolf120 - 13.11.2011

uhh? never heard of it?
Maybe a new 0.3d feature?


Re: GetPlayerNameEx - park4bmx - 13.11.2011

Are u sure is not a custome native/stock or anything like that use the find tool to see if there is GetPlayerNameEx anywhere else


Re: GetPlayerNameEx - [HiC]TheKiller - 13.11.2011

I would asume that GetPlayerNameEx would be something like

pawn Код:
stock GetPlayerNameEx(playerid)
{
    new pname_[24];
    GetPlayerName(playerid, pname_, 24);
    return pname_;
}



Re: GetPlayerNameEx - Silentzx - 13.11.2011

basically the params are GetPlayerNameEx(playerid,name,len)


Re: GetPlayerNameEx - Miguel - 13.11.2011

Probably:
pawn Код:
#define GetPlayerNameEx(%0,%1,%2) GetPlayerName(%0, %1, %2); for(new i = 0; i != %2; i ++) if(%1[i] == '_') %1[i] = ' '
Although I wouldn't know if that works...


Re: GetPlayerNameEx - RussellK - 13.11.2011

Quote:
Originally Posted by Miguel
Посмотреть сообщение
Probably:
pawn Код:
#define GetPlayerNameEx(%0,%1,%2) GetPlayerName(%0, %1, %2); for(new i = 0; i != %2; i ++) if(%1[i] == '_') %1[i] = ' '
Although I wouldn't know if that works...
The addendum of "Ex" in the function name implies that it has additional features to existing behavior, a function that replaces underscores with spaces would indeed be very useful for role playing servers, but it should be named "GetPlayerNormalizedName" or something similar.


Re: GetPlayerNameEx - Silentzx - 13.11.2011

its just a quicker way then GetPlayerName etc..... and sorry i had it wrong correct format is GetPlayerNameEx(playerid)


Re: GetPlayerNameEx - Chrillzen - 13.11.2011

Custom function in CRP?


Re: GetPlayerNameEx - Miguel - 15.11.2011

Quote:
Originally Posted by Silentzx
Посмотреть сообщение
its just a quicker way then GetPlayerName etc..... and sorry i had it wrong correct format is GetPlayerNameEx(playerid)
Is there any array storing the player name?

If so:
pawn Код:
enum enum_name
{
    money,
    another_thing,
    etc,
    name[MAX_PLAYER_NAME]
};

new pInfo[MAX_PLAYERS][enum_name]; // It could be an array that stores player's data or...

new PlayerName[MAX_PLAYERS][24]; // It could be this.

#define GetPlayerNameEx(%0) pInfo[%0][name] // This for the first example.
#define GetPlayerNameEx(%0) PlayerName[%0] // This for the second.
This would be faster than any function. All you have to do is store the name of the player in those arrays when they connect and of course, clear them after they disconnect.