Read full name in DJSon. -
Zevcore - 20.09.2015
Good morning, hello, I took a selection of first and last name when registering and write to a file in DJSon.
Now I did read in OnPlayerConnect.
pawn Код:
new string[128], imie[500], nazwisko[500];
imie = dj(PlayerPath(playerid), "Dane/Imię");
nazwisko = dj(PlayerPath(playerid), "Dane/Nazwisko");
format the
pawn Код:
format(string,sizeof(string), "%s_%s", imie, nazwisko);
and I set the player a nickname
pawn Код:
SetPlayerName(playerid, string);
but it gets nickname "_" instead of "Name_Surname"
Re: Read full name in DJSon. -
BroZeus - 20.09.2015
You mean "Name_" or "_Surname" ?
And try printing their values after they are being loaded like this :
PHP код:
printf( "Imie: %s Nazwisko: %s", imie, nazwisko);
And see what it prints
Re: Read full name in DJSon. -
Zevcore - 20.09.2015
Print:
but it is in file
Код:
{
"Dane":{
"Haslo":"poop",
"Imię":"Peter",
"Nazwisko":"Smith"
}
}
Hasło - Password
Imię - Name
Nazwisko - Surname
It must look like this:
"Name_Surname"
Re: Read full name in DJSon. -
BroZeus - 20.09.2015
Try this :
PHP код:
new string[128], imie[23], nazwisko[23];//no need to make them 500 way to big
strcat(imie, dj(PlayerPath(playerid), "Dane/Imię"));
strcat(nazwisko, dj(PlayerPath(playerid), "Dane/Nazwisko"));
if this doesn't work then try this and tell what happens :
PHP код:
new string[128], imie[23], nazwisko[23];//no need to make them 500 way to big
format(imie, sizeof(imie), "%s", dj(PlayerPath(playerid), "Dane/Imię"));
format(nazwisko, sizeof(nazwisko), "%s", dj(PlayerPath(playerid), "Dane/Nazwisko"));
Re: Read full name in DJSon. -
Zevcore - 20.09.2015
Nothing, nick look "_" ._.
Re: Read full name in DJSon. -
Zevcore - 21.09.2015
@ref
On PL Forum said : this lane is bad
Код:
format(string,sizeof(string), "%s_%s", imie, nazwisko);
but i don't know why
Re: Read full name in DJSon. -
Zevcore - 22.09.2015
@ref
Re: Read full name in DJSon. -
BroZeus - 22.09.2015
Well if you tried printing after loading then it means that there is problem in loading not in format, check the PlayerPath function to see whether it returns correct path or not.