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=505358)
OnGameModeExit -
AphexCCFC - 08.04.2014
pawn Код:
public OnGameModeExit()
{
foreach(Player, i)
{
SaveAccount(i);
}
mysql_close(g_Handle);
return 1;
}
It saves accounts OnPlayerDisconnect and other functions but when I close the gamemode whilst ingame to see if it will save, it doesn't.
Re: OnGameModeExit -
Jstylezzz - 08.04.2014
How do you 'close' the gamemode? By typing exit as a Rcon command or in the console, or by simply clicking the red [X] of the console?
If I remember correctly, OnGameModeExit is only called when typing exit in the console or as Rcon command.
Re: OnGameModeExit -
Ari - 08.04.2014
As above.
What method do you enforce to "exit"
Re: OnGameModeExit -
Gilmar - 08.04.2014
Did you put the code to save the stats on OnPlayerDisconnect? If you put the code only in OnGameModeExit it doesn't not make really sense, you can't save the accounts info only when you close the GameMode.
Re: OnGameModeExit -
Lloyde - 09.04.2014
Bump
Re: OnGameModeExit -
RajatPawar - 09.04.2014
Quote:
Originally Posted by Lloyde
Bump
|
Err, wtf, isn't the OP supposed to bump
Re: OnGameModeExit -
AphexCCFC - 09.04.2014
Sorry been very busy. I close the game mode by clicking the red X.
The character saving is also under OnPlayerDisconnect. I need it so any way the player gets disconnected their account will save? Whether it's using the rcon command to exit the console or force closing it.
Re: OnGameModeExit -
azzerking - 09.04.2014
You can't save people's account on OnGameModeExit, If you were to make a new cmd called /restart or something and then saved account before restarting, that would work. But by pressing the x on the console windows. Will not call the OnGameModeExit function.
Re: OnGameModeExit -
Jstylezzz - 09.04.2014
Quote:
Originally Posted by AphexCCFC
Sorry been very busy. I close the game mode by clicking the red X.
The character saving is also under OnPlayerDisconnect. I need it so any way the player gets disconnected their account will save? Whether it's using the rcon command to exit the console or force closing it.
|
When clicking the red X OnPlayerDisconnect is
NOT callled. If you issue the Rcon 'exit' command instead, it should call OnGameModeExit as far as I know.
I don't know why you'd place saving code for players there to be honest, OnPlayerDisconnect should do the job just fine (as long as you don't use the red X).
Re: OnGameModeExit -
AphexCCFC - 09.04.2014
This used to work for pressing the X button too on my other server, there's gotta be a way somehow.