MySQL saving Data
#1

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?
Reply
#2

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;
}
Reply
#3

Quote:
Originally Posted by Onfroi
View Post
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?
Reply
#4

Quote:
Originally Posted by yanir3
View Post
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;
}
Reply
#5

Quote:
Originally Posted by Onfroi
View Post
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..
Reply
#6

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)