GetPlayerNameEx
#1

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
Reply
#2

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

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
Reply
#4

I would asume that GetPlayerNameEx would be something like

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

basically the params are GetPlayerNameEx(playerid,name,len)
Reply
#6

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...
Reply
#7

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.
Reply
#8

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

Custom function in CRP?
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)