SA-MP Forums Archive
Writing Y_INI Player stats into MySQL table - 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: Writing Y_INI Player stats into MySQL table (/showthread.php?tid=511673)



Writing Y_INI Player stats into MySQL table - cr33d - 06.05.2014

Hi,
I want to please you to explain me how to write stats into tables. I have tried multiply ways but everything was not so sucesfull. For example i have PlayerInfo[playerid][pExpiriencePoint] how can i make it write into table?
I will be very pleased if you can show me some example.
Thanks


Re: Writing Y_INI Player stats into MySQL table - Blademaster680 - 06.05.2014

You would need to use "INSERT INTO TABLE"
What you could do is make the server load the player stats from the y_ini file and save to the mysql on logout. That would get the players stats from y_ini to mysql.


Re: Writing Y_INI Player stats into MySQL table - Calgon - 06.05.2014

To my understanding, Y_INI conforms to the basic INI format, so you can convert the files to your database. A good way to do this could be using this, once your accounts are in the database, you only need to change the way your script loads and saves user information.

Simply changing the code in your script will not support your old user information if you are doing this on a live server, therefore it is important that you convert your user files to be stored in your database.

Take a look at how ORM is used in BlueG's MySQL plugin here, it is a really simple way to save and load player information.


Re: Writing Y_INI Player stats into MySQL table - cr33d - 07.05.2014

Yea thanks, but, i only want to write user stats into database (table). I dont want to convert whole script onto MySQL, i want to make script which will for ex. OnPlayerSpawn or on some CMd (/backup) to write player stats into Database, not for reading from it. I want make it bee automatically because there is more than 2000+ plus users account and 300 users online


Re: Writing Y_INI Player stats into MySQL table - Roel - 07.05.2014

Why are you going to make backups into a database? why not just save and read it from a database, since a database is much faster then Y_INI, and alot easier.


Re: Writing Y_INI Player stats into MySQL table - cr33d - 08.05.2014

Well because i am not only one owner and the other want y_ini ahh long story....
So anybody now how to make that "backup", actually only write stats into database?


Re: Writing Y_INI Player stats into MySQL table - Calgon - 08.05.2014

https://sampforum.blast.hk/showthread.php?tid=461766
http://www.sqlcourse.com/index.html

You just need to have an understanding of how databases work, then you can begin structuring your database. It's very simple when you apply that knowledge.

You haven't been very specific with your question - what are you actually planning on storing if you want more help?


Re: Writing Y_INI Player stats into MySQL table - cr33d - 08.05.2014

My only problem is that i speak English very bad. To be precise i want to write samo basic things in the databes. Those are, player name, Player Level And Experience.(Playerinfo[Playerid][pLevel] and Playerinfo[Playerid][pExp]

Thanks


Re: Writing Y_INI Player stats into MySQL table - cr33d - 09.05.2014

BUMP! Anybody knows it is urgent for me pleaseee help