SA-MP Forums Archive
PVars in OnGameModeExit - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: PVars in OnGameModeExit (/showthread.php?tid=193602)



PVars in OnGameModeExit - Level147 - 26.11.2010

I think it's very bad, that player variables are already deleted in OnGameModeExit.

If you want to use the PVars e.g. for saving data to your database, you'll fail.
Moreover whether you give an gmx the PVars aren't available in OnPlayerDisconnect, too.
In my view it should be very easy to delete the PVars after calling OnGameModeExit and OnPlayerDisconnect, isn't it?

I would be pleased to see this little change in 0.3c.

Level147


Re: PVars in OnGameModeExit - Zh3r0 - 26.11.2010

OnGameModeExit gets called right before closure! So you still can save the PVars. ...

And PVars should be saved in OnPlayerDisconnect not OnGameModeExit


Re: PVars in OnGameModeExit - Level147 - 26.11.2010

Yes, I always save the data in OnPlayerDisconnect, but with a gmx there aren't the PVars available, too.
I don't want to save all this values to public variables...


Re: PVars in OnGameModeExit - cessil - 27.11.2010

use a gmx command that first saves player data and then resets the gamemode.


Re: PVars in OnGameModeExit - GaGlets(R) - 27.11.2010

But there is still no way to fix if server crashes...


Re: PVars in OnGameModeExit - Cypog - 27.11.2010

Yes, do automatic saves called by a Timer.


Re: PVars in OnGameModeExit - GaGlets(R) - 27.11.2010

Quote:
Originally Posted by Cypog
View Post
Yes, do automatic saves called by a Timer.
You probably dont know what happens with that timer if there is a little mistake in script.. Or something goes down - for example mysql/plugin.. it will not write file for you, it will clean up them or set all values to 0.. so its not so safe..


Re: PVars in OnGameModeExit - The_Moddler - 27.11.2010

Quote:
Originally Posted by GaGlets®
View Post
You probably dont know what happens with that timer if there is a little mistake in script.. Or something goes down - for example mysql/plugin.. it will not write file for you, it will clean up them or set all values to 0.. so its not so safe..
You just make a timer of 30 seconds, that saves all players stats..


Re: PVars in OnGameModeExit - GaGlets(R) - 27.11.2010

Quote:
Originally Posted by The_Moddler
View Post
You just make a timer of 30 seconds, that saves all players stats..
30 seconds timer...

Player joins server, logins ~ 3 secs.. someone gives him alot of money.. ~ 20 secs in the past.. last 10 secs..
player disonnects hahahaaa players virtual money now is gone... roflmao?


Re: PVars in OnGameModeExit - The_Moddler - 27.11.2010

That will not happend, becouse server will crash before the timer.. also you should make backups.