SA-MP Forums Archive
GMX crash - 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: GMX crash (/showthread.php?tid=416532)



GMX crash - Boolean - 17.02.2013

My server crashes on the exact moment when it's executing SendRconCommand("gmx");





pawn Код:
CMD:gmx(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
    new string[128];
    format(string, sizeof(string), "Server action: %s has issued a server restart, it will occur in 60 seconds.", RPN(playerid));
    SendClientMessageToAll(0xff000000, string);
    SetTimer("gmxtimer", 60000, false);
    return 1;
}
pawn Код:
forward gmxtimer();
public gmxtimer()
{
    foreach(Player, i)
    {
        SaveChar(i);
        ClearChar(i);
        GMX[i] = 1;
    }
    SendRconCommand("gmx");
}

pawn Код:
public OnGameModeExit()
{
    foreach(Player, i)
    {
        SaveChar(i);
        ClearChar(i);
    }
    SaveFactions();
    SaveFamilies();
    SavePoints();
    SaveBiz();
    SaveHouses();
    SaveDoors();
    SaveGates();
    SaveMapIcons();
    SaveArrestPoint();
    SaveDrugs();
    SaveProducts();
    SaveMOTDS();
    SaveWeed();
    SaveCars();
    //SaveCrates();
    SaveDrops();
    return 1;
}



Re: GMX crash - Kyle - 17.02.2013

The reason why it crashes is because it executes the save queries when mysql is shutdown...

You need to have a custom gmx command, once that command is executed make them save then make a timer and set it to gmx 8 seconds later. That gives the server 8 seconds to save all the queries.


Re: GMX crash - Boolean - 17.02.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
Do you "Save" functions use MySQL?
No, I'm not using MySQL.


Re: GMX crash - Mean - 17.02.2013

Try using the crashdetect plugin to address the issue.

https://sampforum.blast.hk/showthread.php?tid=262796


I suppose that the problem is in OnGameModeExit. Try putting a print() line at the very end of OnGameModeExit, see if that line gets printed in the log. If it doesn't, there's an issue in OnGameModeExit.