SA-MP Forums Archive
Geting Player's Name - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Geting Player's Name (/showthread.php?tid=183189)



Geting Player's Name - Alex_Valde - 14.10.2010

How can I make command that will get players name .

If player has a name: Tony_Montana.

How can I get only Tony from his name..?

EDIT: Solved!
Lock!



Re: Geting Player's Name - jameskmonger - 14.10.2010

pawn Код:
stock GetPlayerFirstName(playerid)
{
    new namestring[2][MAX_PLAYER_NAME];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    split(name, namestring, '_');
    return namestring[0];
}
stock GetPlayerLastName(playerid)
{
    new namestring[2][MAX_PLAYER_NAME];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    split(name, namestring, '_');
    return namestring[1];
}
You're welcome!