SA-MP Forums Archive
OnGameModeExit(); - 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: OnGameModeExit(); (/showthread.php?tid=349839)



OnGameModeExit(); - NeroX98 - 10.06.2012

Hi !

I have a problem with saving stats when closing samp-server.exe window.

When i make a gmx the stats (level,kills,exp) are saving
Here is the code:
Код:
    if(strcmp(cmd, "/gmx", true) == 0) {
        if(IsPlayerConnected(playerid)) {
            if (PlayerInfo[playerid][pAdmin] >= 1338) {
                GameModeExit();
            }
            else {
                SendClientMessage(playerid, COLOR_GRAD1, "   Niste ovlasteni da koristite tu komandu !");
            }
        }
        return 1;
    }
So under OnGameModeExit(); i have putted GameModeExit();
Код:
public OnGameModeExit()
{
    GameModeExit();
    return 1;
}
I have created OnGameModeExit() just for this. Before this that function doesn't existed, maybe that is the problem ?


Re: OnGameModeExit(); - ReVo_ - 10.06.2012

sorry, what are your problem?


Re: OnGameModeExit(); - NeroX98 - 10.06.2012

the stats are not saving when i close the samp-server.exe app (black window)... They only saves when i make /gmx or when player disconnects, but they aren't save when i close the samp-server.exe while there are players on the server...


Re: OnGameModeExit(); - ReVo_ - 10.06.2012

Can you give me the code for saving stats?

OnGameModeExit not called when window closed if i Remember correctly


Re: OnGameModeExit(); - iggy1 - 10.06.2012

You should save players stats inside a timer function in case the server crashed or you need to close the server. In which case OnGameModeExit isn't guaranteed to be called (or is guaranteed not to be called. I'm not %100 sure).


Re : OnGameModeExit(); - ricardo178 - 10.06.2012

It's normal... Make GMX command..


Re: OnGameModeExit(); - NeroX98 - 10.06.2012

ok i will make a timer (i will try )