GMX crash
#1

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

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.
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)