Break the array "name" and "last name"
#1

Welcome . The first time I address you with a request. I mean, namely to download the player's name and break the array "name" and "last name". The idea login using MySQL on RP server. Can you help? Sorry for my english .
Reply
#2

So basically, a player named "John_Doe" joins and you want to save his first name as John and last as Doe? Is that what you are requesting?
Reply
#3

Yes, exactly what I mean. I want it to achieve ... I do not know ... I just want to divide into two parts .
Reply
#4

Not tested, but I THINK it will work just fine...

pawn Код:
new
    szName[MAX_PLAYER_NAME],
    szFirstName[MAX_PLAYER_NAME],
    szLastName[MAX_PLAYER_NAME],
    iUnderscorePos;
   
GetPlayerName(playerid, szName, sizeof(szName));
iUnderscorePos = strfind(szName, "_", true);

strmid(szFirstName, szName, 0, iUnderscorePos);
strmid(szLastName, szName, iUnderScorePos+1, MAX_PLAYER_NAME);
Reply
#5

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Not tested, but I THINK it will work just fine...

pawn Код:
new
    szName[MAX_PLAYER_NAME],
    szFirstName[MAX_PLAYER_NAME],
    szLastName[MAX_PLAYER_NAME],
    iUnderscorePos;
   
GetPlayerName(playerid, szName, sizeof(szName));
iUnderscorePos = strfind(szName, "_", true);

strmid(szFirstName, szName, 0, iUnderscorePos);
strmid(szLastName, szName, iUnderScorePos+1, MAX_PLAYER_NAME);
Okay, thank you for idea.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)