From Dini To DjSon
#1

I wanted to switch from dini and djson and i did. But here is the problem. All previous users that i had will they get deleted ? I mean do i have to delete them ? BCZ

dini:

Pasword=dasddasads
Level=adasd
...

djson:

{"Password":"dsaadsasdasd","Level":0}


Users wipe ? Or what should i do ?

If this fails, i am switching to manual method.

fwrite..etc.
Reply
#2

You could make a script that uses fread/fwrite to convert all your files for you. I'm just not sure how you would open all player files without them being online. You could make it to where it converts their file when they login. Do something like...

pawn Код:
public OnPlayerConnect(playerid)
{
   new
     name[24],
     string[128];

   GetPlayerName(playerid,name,24);
   format(string,128,"Filepath/%s",name);
   if(dini_Exists(string))
   {
     //Convert it to djson right here.
     dini_Remove(string);
   }
   return 1;
}
Reply
#3

That code inspired me and i done it similar:

Код:
public OnPlayerConnect(playerid)
{
	new
     name[24],
     string[128];

   GetPlayerName(playerid,name,24);
   format(string,128,"users/%s.ini",name); // checks for name but .ini extension, i have setted others to .json
   if(dini_Exists(string))
   {
     // loaded the user file with dini
     // saved the user file again but with djson to name.json
     // removed the old .ini
   }
   return 1;
}
offtopic: how do you make your code like pawn style. "new" is blue..etc.
Reply
#4

Quote:
Originally Posted by MafiaGuy™
offtopic: how do you make your code like pawn style. "new" is blue..etc.
Use PAWN Tags

Reply
#5

Quote:
Originally Posted by MafiaGuy™
Посмотреть сообщение
offtopic: how do you make your code like pawn style. "new" is blue..etc.
PS: You can always quote a message and see how he made it .

Have fun coding,
Draco
Reply
#6

Quote:
Originally Posted by DracoBlue
Посмотреть сообщение
PS: You can always quote a message and see how he made it .

Have fun coding,
Draco
Lmao Draco, 2 and a half month old thread XD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)