SA-MP Forums Archive
OnGameModeExit is not being called - 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 is not being called (/showthread.php?tid=359489)



OnGameModeExit is not being called - Universal - 14.07.2012

Hi guys, I have lots of systems which needs to be saved upon server shutdown (house owners, business data, etc.), but how am I supposed to do this, when this callback is not being called as it should be (atlest its name tells that its supposed to be called upon game mode exit)? Or is there any other way to do this?

PS. I remeber doing this before and it worked, and some people also use TextDrawDestroy() in this callback (and they recommend others doing so), but whats the point if this callback is useless?

Thanks in advice.


Re: OnGameModeExit is not being called - clarencecuzz - 14.07.2012

If your server crashes, sometimes it will not call OnGameModeExit, I would recommend you set a timer to save these systems, obviously not for TextDrawDestroy etc.

Not sure what other things might affect OnGameModeExit... other than the timer, I cannot think of any other way to save it apart from OnGameModeExit.


Re: OnGameModeExit is not being called - [KHK]Khalid - 14.07.2012

It's being called when the gamemode ends (e.g when you close the samp-server.exe or use GameModeExit). If it's not being called in your script, then there should be a problem

# Maybe you're using the script as a filterscript not as a gamemode.
# Maybe the server crashes right before this callback is called (Check this crash detect plugin).
# Maybe it's being called but you probably saving stuff wrongly (Have you tried log prints to debug?).

Oh I got a question. How did you know that it's not being called?


Re: OnGameModeExit is not being called - Universal - 14.07.2012

Because I tried printing stuff, and had nothing at all. Had like 6 print's before every function.


Re: OnGameModeExit is not being called - SuperViper - 14.07.2012

Make a restart command to restart the server right after saving. You can achieve a server restart by doing one of the following:

pawn Код:
SendRconCommand("gmx");
pawn Код:
GameModeExit();