Name help..
#1

Hey,
I'm using this to split player RP name to Firstname and Lastname:
pawn Код:
new TextName[MAX_PLAYERS][24];

GetPlayerName(playerid,pName[playerid],24);
sscanf(pName[playerid],"p_ss",TextName[playerid]);
tName[playerid] = Create3DTextLabel(TextName[playerid],COLOR_WHITE,0.0,0.0,0.0,50,-1,1);
But how should I use TextName[playerid] to show the first name only?
Let's say I connect with name Wayne_Wan I tried TextName[playerid][0] - it shows Wayne, but TextName[playerid][1] shows ayne.. how should I use it to show Wan?

Reply
#2

pawn Код:
public OnPlayerConnect(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
new var = strfind(Name, "_", true);
new NewName[MAX_PLAYER_NAME];
strmid(NewName, Name, 0, var, sizeof(NewName));
return true;
}
Something like this?
Reply
#3

Quote:
Originally Posted by SiJ
Hey,
I'm using this to split player RP name to Firstname and Lastname:
pawn Код:
new TextName[MAX_PLAYERS][24];

GetPlayerName(playerid,pName[playerid],24);
sscanf(pName[playerid],"p_ss",TextName[playerid]);
tName[playerid] = Create3DTextLabel(TextName[playerid],COLOR_WHITE,0.0,0.0,0.0,50,-1,1);
pawn Код:
new
        TextName[2][MAX_PLAYER_NAME],
        pName[MAX_PLAYER_NAME];// = "FirstName_LastName";
       
    GetPlayerName(playerid, pName, sizeof pName);
//            Firstname   Lastname
    sscanf(pName, "p_ss", TextName[0], TextName[1]);
//           LastName
    Create3DTextLabel(TextName[1],COLOR_WHITE,0.0,0.0,0.0,50,0);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)