SA-MP Forums Archive
.ini -> MySQL - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: .ini -> MySQL (/showthread.php?tid=176471)



.ini -> MySQL - Ribber - 13.09.2010

I'm working for a MySQL save system, which saves player's stats.
But I have at the moment over 20k saved .ini's in my player folder.
Now the question: HOW can I convert all .ini's to mysql rows?
Of course I know that I can add rows "per hand" , but with >20k saved files it take years.


Re: .ini -> MySQL - ft941 - 13.09.2010

you can do that when someone connects to the server, the information contained in the file are transferred into the database...


Re: .ini -> MySQL - wups - 13.09.2010

this is a quick example:
pawn Код:
public OnPlayerConnect(playerid)
{
  new name[MAX_PLAYER_NAME],file[128];
  GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  format(file,sizeof(file),"saves/users/%s.ini",name);
  if(fexists(file))
  {
        new query[128];
        format(query,128,"SELECT * FROM USERS WHERE `name` = %s");
        mysql_query(query);
        if(mysql_numrows == 0) CopyData(playerid);
   }
}
I was planing on doing that to. So give me information on your luck later
I think you can do the CopyData function your self.


AW: .ini -> MySQL - Ribber - 14.09.2010

What is better, if I do that all variables will be saved in one database (users), or when I save the things in different databases. Because I have much things to load, like titles, achievements, vip rewards etc. etc.