Saving Method
#1

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

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

Make a repetitive timer that loops through all players and saves their stats
Reply
#4

@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.
Reply
#5

[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
Reply
#6

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)