12.07.2011, 04:06
How would you get the Firstname from a Firstname_Lastname format? So get every text in the name before the first "_". Then if there is no "_" then you just get the whole name. is it possible?
How would you get the Firstname from a Firstname_Lastname format? So get every text in the name before the first "_". Then if there is no "_" then you just get the whole name. is it possible?
|
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];
}
pawn Код:
|