Stripping a GetPlayerName to only the last 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)
+--- Thread: Stripping a GetPlayerName to only the last name? (
/showthread.php?tid=290626)
Stripping a GetPlayerName to only the last name? -
robintjeh - 16.10.2011
Hi guys.
I have a question.
In my script, the players' name must be stripped down to only his last name.
Example: Robin_Smith>Smith
That's how it should happen. But I have no idea how.
Anyone got an idea or code? Thanks in advance.
EDIT: Nvm already found it.
pawn Код:
stock GetPlayerFirstName(playerid)
{
new
namestring[2][MAX_PLAYER_NAME],
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],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
split(name, namestring, '_');
return namestring[1];
}