SA-MP Forums Archive
MySQL saving issue - 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: MySQL saving issue (/showthread.php?tid=404713)



MySQL saving issue - Dan.. - 04.01.2013

Hello!

I'm using BlueG's MySQL plugin and I want to save all of my game data in OnGameModeExit. The problem is that the gamemode exits before all data is saved. Any ideas on how I can fix this?


Re: MySQL saving issue - InfiniTy. - 04.01.2013

I might be wrong but i don't think you can save data on OnGameModeExit.. if you have a command that restarts the server you can do a timer and save the data and after that timer finished restart it ..You can also do a 5-10 minute saving stats timer..


Re: MySQL saving issue - Roel - 04.01.2013

If you use GMX or EXIT OnGameModeExit always get called, when your server crashes it perhaps doesn't.
So you should take a look at your code, perhaps something is wrong there, also take a look in your mysql_log.txt if there get any query called on ongamemodeexit, to enable mysql_log.txt put mysql_debug(1); in your ongamemodeinit.


Re: MySQL saving issue - Dan.. - 04.01.2013

I found a much, much better way to do this. Thank you for your input anyway.
Quote:
Originally Posted by Adytza.
Посмотреть сообщение
I might be wrong but i don't think you can save data on OnGameModeExit.. if you have a command that restarts the server you can do a timer and save the data and after that timer finished restart it ..You can also do a 5-10 minute saving stats timer..
That's not going to work. That's how I used to do, but sometimes the MySQL server was slow and it didn't finish saving everything.
Quote:
Originally Posted by Roel
Посмотреть сообщение
If you use GMX or EXIT OnGameModeExit always get called, when your server crashes it perhaps doesn't.
So you should take a look at your code, perhaps something is wrong there, also take a look in your mysql_log.txt if there get any query called on ongamemodeexit, to enable mysql_log.txt put mysql_debug(1); in your ongamemodeinit.
My code is fine, is just a limitation of the MySQL plugin.


Re: MySQL saving issue - Roel - 04.01.2013

Ow well, is your database hosted at the same spot as your server is hosted? If this is not, then it can be true that it is to slow, well yea then you should us a timer or something.


Re: MySQL saving issue - Dan.. - 04.01.2013

Quote:
Originally Posted by Roel
Посмотреть сообщение
Ow well, is your database hosted at the same spot as your server is hosted? If this is not, then it can be true that it is to slow, well yea then you should us a timer or something.
The MySQL server and game server are hosted in the same LAN, but not on the same server.