Read full name in DJSon.
#1

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"
Reply
#2

You mean "Name_" or "_Surname" ?
And try printing their values after they are being loaded like this :
PHP код:
printf"Imie: %s Nazwisko: %s"imienazwisko); 
And see what it prints
Reply
#3

Print:
Код:
Imie: Nazwisko:
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"
Reply
#4

Try this :
PHP код:
new string[128], imie[23], nazwisko[23];//no need to make them 500 way to big
strcat(imiedj(PlayerPath(playerid), "Dane/Imię"));
strcat(nazwiskodj(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(imiesizeof(imie), "%s",  dj(PlayerPath(playerid), "Dane/Imię"));
format(nazwiskosizeof(nazwisko), "%s",  dj(PlayerPath(playerid), "Dane/Nazwisko")); 
Reply
#5

Nothing, nick look "_" ._.
Reply
#6

@ref

On PL Forum said : this lane is bad
Код:
format(string,sizeof(string), "%s_%s", imie, nazwisko);
but i don't know why
Reply
#7

@ref
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)