%s name and %s surname? - 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: %s name and %s surname? (
/showthread.php?tid=330228)
%s name and %s surname? -
Gooday - 31.03.2012
Could be "makeable"
Name: %s
Surname: %s
I mean if is possible to know a include for the second park (basically after the "_" is considerated surname)
Re: %s name and %s surname? -
SpiritEvil - 31.03.2012
Here you go, I hope it helps
pawn Код:
new FullName[MAX_PLAYER_NAME], FirstName[MAX_PLAYER_NAME], LastName[MAX_PLAYER_NAME];
GetPlayerName(playerid, FullName, sizeof(FullName));
strmid(FirstName, FullName, 0, strfind(FullName, "_"));
strmid(LastName, FullName, strfind(FullName, "_")+1, strlen(FullName));
//printf("Full Name: %s\nFirst Name: %s\nLast Name: %s", FullName, FirstName, LastName);
Re: %s name and %s surname? -
Gooday - 31.03.2012
How could i make like:
/show id
Send a message to the ID with
NAME:
SURNAME:
Re: %s name and %s surname? -
SpiritEvil - 31.03.2012
Sure here you go using ZCMD and sscanf:
pawn Код:
CMD:showid(playerid, params[])
{
new id;
if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /showid [Player ID/Part of Name]");
new str[128], FullName[MAX_PLAYER_NAME], FirstName[MAX_PLAYER_NAME], LastName[MAX_PLAYER_NAME];
GetPlayerName(id, FullName, sizeof(FullName));
strmid(FirstName, FullName, 0, strfind(FullName, "_"));
strmid(LastName, FullName, strfind(FullName, "_")+1, strlen(FullName));
format(str, sizeof(str), "FIRST NAME: %s", FirstName);
SendClientMessage(playerid, -1, str);
format(str, sizeof(str), "Last NAME: %s", LastName);
SendClientMessage(playerid, -1, str);
return 1;
}