OnGameModeExit is not being called
#1

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

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

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?
Reply
#4

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

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();
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)