Rollback - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Rollback (
/showthread.php?tid=268231)
Rollback -
Roko_foko - 11.07.2011
Okay, I was wodering what's the best way to make rollback less effective?
Using a timer that each minute saves stats is the only answer that has came to my mind. Is there any better solution or advice?
Thanks in advance.
Re: Rollback -
WoodPecker - 11.07.2011
I think OnPlayerSave will be good, it will save your stats when you /q from the game.
EDIT: if you need help with OnPlayerSave reply here.
Re: Rollback -
The.Sandman - 11.07.2011
pawn Код:
//Top..
forward SaveStats();
//OnGamemodeInit..
SetTimer("SaveStats",1440000,true);//24 mins?..
//Anywhere in script..
public SaveStats()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
//saves stats code..
}
return 1;
}
Re: Rollback -
WoodPecker - 11.07.2011
Sandman dont you think that SaveStats will lag his server a bit?
Re: Rollback -
Roko_foko - 11.07.2011
I save stats when user dissconects and it's fine, but when server crashes or when you quit the smal black window (which appears you run "samp-server" ) Playerstats and server stats are lost.
Re: Rollback -
The.Sandman - 11.07.2011
Quote:
Originally Posted by WoodPecker
Sandman dont you think that SaveStats will lag his server a bit?
|
Lol why are you people so scared of timers..
EDIT:
"I think OnPlayerSave will be good"
wtf is OnPlayerSave..
Who helped him now?
Re: Rollback -
Roko_foko - 11.07.2011
Quote:
Originally Posted by The.Sandman
pawn Код:
//Top.. forward SaveStats();
//OnGamemodeInit.. SetTimer("SaveStats",1440000,true);//24 mins?..
//Anywhere in script.. public SaveStats() { for(new i=0;i<MAX_PLAYERS;i++) { //saves stats code.. } return 1; }
|
Yes I have done that but I am asking if there is a better solution, It will cause lag :S (i have put timer on one min )
Re: Rollback -
The.Sandman - 11.07.2011
Quote:
Originally Posted by Roko_foko
Yes I have done that but I am asking if there is a better solution
|
Maybe a SetTimerEx other then that no..
Re: Rollback -
Roko_foko - 11.07.2011
Quote:
Originally Posted by The.Sandman
Maybe a SetTimerEx other then that no..
|
Okay. Thanks. SetTimer is better than SetTimerEx, that's for sure.
Re: Rollback -
Cameltoe - 11.07.2011
Quote:
Originally Posted by Roko_foko
Okay. Thanks. SetTimer is better than SetTimerEx, that's for sure.
|
No, SetTimerEx would spawn an timer for an specific player, saving only that specific player's file.
Calling SetTimer would need the server to loop through each player, do several check's then save each player's file.