Get the 'Firstname' from Firstname_lastname format
#2

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
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?
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];
}
Not sure who created it, but it sure as hell wasn't me. Oh, and i'll include the last name version of it aswell.
Reply


Messages In This Thread
Get the 'Firstname' from Firstname_lastname format - by Jack_Leslie - 12.07.2011, 04:06
Re: Get the 'Firstname' from Firstname_lastname format - by Skylar Paul - 12.07.2011, 04:16
Re: Get the 'Firstname' from Firstname_lastname format - by Jack_Leslie - 12.07.2011, 05:56

Forum Jump:


Users browsing this thread: 1 Guest(s)