GMX screw with saving.
#1

After my problem from yesterday which could be found here, I decided to add the gmx function and move on, but for my gmx function I took out the Kick() part and the weapons would not save again but they would if I kicked the person. I even tried editing it a bit so that if the gmx() function is called, no stats would be saved on disconnect.

(To long^?)
Weapons still won't save on gmx even if I have it modified to not save on disconnect/gmx at the same time.
pawn Код:
//under disconnect
if(Restarting == 0)
    {
        if(Logged[playerid] == 1)
        {
            SavePlayerData(playerid);
        }
    }

stock gmx()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            Restarting = true;
            SavePlayerData(i);
//            Kick(i);
        }
    }

    SendRconCommand("gmx");
}
Reply
#2

It's usually best to execute a special function to save weapons etc, then execute gmx 3 seconds later.
Reply
#3

Still doesn't work.
Reply
#4

Try making the players data save when they disconnect, and before you execute the gmx command, call OnPlayerDisconnect and force the player to disconnect, that's how I always did it.
Reply
#5

PHP код:
new LoggedIn[MAX_PLAYERS];

when the player spawns u should
LoggedIn
[playerid] = 1
Код:
And in the stock saving u should
if(LoggedIn[playerid] == 1)
{

and u should continue on with stuff
pawn Код:
CMD:gmx(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] != 6)return SendClientMessage(playerid, COLOR_GREEN,"Only Owner may do this");
    foreach(Player, i)
    {
        SavePlayerData(i);
    LoggedIn[i] = 0;
        SendClientMessage(playerid, -1, "SERVER: The server is being restarted.");
    }
    SendRconCommand("gmx");
    return 1;
}

so when gamemode restarting before it restarts it;
Saves the player data
sets his log in to 0, and remember u stats only save if loggin = 1 but its 0 so it doesnt save, then i send i little message before gmx 2 say its restarting then the gamemode restarts does it work? YES! i dont post what dont work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)