Break the array "name" and "last name" - 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: Break the array "name" and "last name" (
/showthread.php?tid=452010)
Break the array "name" and "last name" -
Icy0 - 19.07.2013
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

.
Re: Break the array "name" and "last name" -
RajatPawar - 19.07.2013
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?
Re: Break the array "name" and "last name" -
Icy0 - 19.07.2013
Yes, exactly what I mean. I want it to achieve ... I do not know ... I just want to divide into two parts

.
Re: Break the array "name" and "last name" -
Scenario - 19.07.2013
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);
Re: Break the array "name" and "last name" -
Icy0 - 19.07.2013
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.