MySQL saving Data - 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 Data (
/showthread.php?tid=446167)
MySQL saving Data -
yanir3 - 24.06.2013
I added this on OnGameModeExit:
PHP Code:
mysql_function_query(gHandle, "SELECT * FROM houses", false, "SaveAllHouses", "");
mysql_function_query(gHandle, "SELECT * FROM businesses", false, "SaveAllBizz", "");
mysql_function_query(gHandle, "SELECT * FROM factions", false, "SaveAllFactions", "");
It just doesn't work if I close the server or restart (GMX).
If I use it on my /forcesave command, it works like charm. What could be the cause?
Re: MySQL saving Data -
Onfroi - 24.06.2013
pawn Code:
public OnRconCommand(cmd[])
{
if(!strcmp(cmd,"gmx",true))
{
mysql_function_query(gHandle, "SELECT * FROM houses", false, "SaveAllHouses", "");
mysql_function_query(gHandle, "SELECT * FROM businesses", false, "SaveAllBizz", "");
mysql_function_query(gHandle, "SELECT * FROM factions", false, "SaveAllFactions", "");
return 1;
}
return 0;
}
Re: MySQL saving Data -
yanir3 - 24.06.2013
Quote:
Originally Posted by Onfroi
pawn Code:
public OnRconCommand(cmd[]) { if(!strcmp(cmd,"gmx",true)) { mysql_function_query(gHandle, "SELECT * FROM houses", false, "SaveAllHouses", ""); mysql_function_query(gHandle, "SELECT * FROM businesses", false, "SaveAllBizz", ""); mysql_function_query(gHandle, "SELECT * FROM factions", false, "SaveAllFactions", ""); return 1; } return 0; }
|
Hey.
Will this work with 'exit' command too?
Re: MySQL saving Data -
Onfroi - 24.06.2013
Quote:
Originally Posted by yanir3
Hey.
Will this work with 'exit' command too?
|
No, it detects if an admin typed only gmx, use this one to detect both:
pawn Code:
public OnRconCommand(cmd[])
{
if(!strcmp(cmd,"gmx",true) || !strcmp(cmd,"exit",true))
{
mysql_function_query(gHandle, "SELECT * FROM houses", false, "SaveAllHouses", "");
mysql_function_query(gHandle, "SELECT * FROM businesses", false, "SaveAllBizz", "");
mysql_function_query(gHandle, "SELECT * FROM factions", false, "SaveAllFactions", "");
return 1;
}
return 0;
}
Re: MySQL saving Data -
yanir3 - 24.06.2013
Quote:
Originally Posted by Onfroi
No, it detects if an admin typed only gmx, use this one to detect both:
pawn Code:
public OnRconCommand(cmd[]) { if(!strcmp(cmd,"gmx",true) || !strcmp(cmd,"exit",true)) { mysql_function_query(gHandle, "SELECT * FROM houses", false, "SaveAllHouses", ""); mysql_function_query(gHandle, "SELECT * FROM businesses", false, "SaveAllBizz", ""); mysql_function_query(gHandle, "SELECT * FROM factions", false, "SaveAllFactions", ""); return 1; } return 0; }
|
Yeah that's why I did. It doesn't work..
Re: MySQL saving Data -
yanir3 - 24.06.2013
Well I have noticed it on my mysql_log:
Quote:
[22:08:35] Passing query UPDATE `users` SET level = 1, admin = 1338, faction = 2, leader = 1, rank = 1, phone = 0, exp = 2, paycheck = 374, paycheckt = 12, cash = 40990, bank = -20, savings = 0, hours = 2, banned = 0, tutorial = 0, drivinglicense = 0, weaponlicense = 0, skin = 3, job = 0, melee = 0 WHERE id = 9 | d
[22:08:35] CMySQLHandler:isconnect() - Connection was closed.
|
It saves my user but it closes the connection too early for the other stuff, what can I do?