Saving Method - 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: Saving Method (
/showthread.php?tid=627469)
Saving Method -
ISmokezU - 28.01.2017
Hey everyone i'm having an issue where if i restart the server,the connected players statistics or lost (if they quit it saves),but if the server crashes/restarts it all starts back from 0.however i save some scripts saving the stats OnGameModeExit i tried it,
Код:
foreach(new i: Player) { SavepStats(i); }
Same problem...
Should i do this method instead?
Код:
for (new i = 0, j = GetPlayerPoolSize(); i <= j; i++) {
if (IsPlayerConnected(i)) {
OnPlayerDisconnect(i, 1);
}
}
from Konstantinos
If none of the above best fits the situation what's the best method?
Re: Saving Method -
Vince - 28.01.2017
OnGameModeExit is ONLY called for a clean exit. That means RCON exit, changemode or gmx. If the server crashes or if the process is killed (also by pressing the close-button on a Windows server) then OnGameModeExit will NOT be called.
Re: Saving Method -
Eoussama - 28.01.2017
Make a repetitive timer that loops through all players and saves their stats
Re: Saving Method -
ISmokezU - 28.01.2017
@vince so why all the stats resets whenever i restart the server?
@Eoussama,i'm doing that. but if the server restarts,all stats or lost for the connected players.
Re: Saving Method -
Eoussama - 28.01.2017
[QUOTE=ISmokezU;3836264
@Eoussama,i'm doing that. but if the server restarts,all stats or lost for the connected players.[/QUOTE]
Try to make it as short as possible, maybe each 15mins, so even if the server crashes, there won't be so much data to lose
Re: Saving Method -
ISmokezU - 29.01.2017
An Update: if i /rcon gmx,all the stats gets save,but if i close the console (samp-server.exe) it all gets lost,same goes for the restart button in hosts. Is that problem from me/from samp?
Re: Saving Method -
Rdx - 29.01.2017
Quote:
Originally Posted by ISmokezU
An Update: if i /rcon gmx,all the stats gets save,but if i close the console (samp-server.exe) it all gets lost,same goes for the restart button in hosts. Is that problem from me/from samp?
|
Its normal. Fix server crashes, there is no other solution.
You can also save their stats for example every 1 minute but that sucks.
Re: Saving Method -
ISmokezU - 29.01.2017
Quote:
Originally Posted by Rdx
Its normal. Fix server crashes, there is no other solution.
You can also save their stats for example every 1 minute but that sucks.
|
Thanks,learnt something new today i'll use /rcon gmx from now on