SA-MP Forums Archive
Save player account | OnPlayerUpDate or Timer ? - 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: Save player account | OnPlayerUpDate or Timer ? (/showthread.php?tid=333484)



Save player account | OnPlayerUpDate or Timer ? - jcvag44800 - 11.04.2012

Hi guys !

I am looking for a way to record the accounts of players in a server crash for example.
I thought of a "Timer" which make a backup every X seconds or use OnPlayerUpDate.
What is the best solution?

Cordially.


Re: Save player account | OnPlayerUpDate or Timer ? - ViniBorn - 11.04.2012

Timer

OnPlayerUpdate is called around 30 times per second, per player.

Imagine this with 50 players online, and saving ...


Re: Save player account | OnPlayerUpDate or Timer ? - jcvag44800 - 11.04.2012

Thanks.

How many seconds?


Re: Save player account | OnPlayerUpDate or Timer ? - ViniBorn - 11.04.2012

I used 30 minutes in my server, with the average of 200 players online.

At least in my case, server crash was very rare ...


Re: Save player account | OnPlayerUpDate or Timer ? - ReneG - 11.04.2012

Usually a one to two second timer is just fine.


Re: Save player account | OnPlayerUpDate or Timer ? - Skribblez - 11.04.2012

I've experienced crashes on my server and there are only two ways wherein I save a player's data, I placed them under OnPlayerDisconnect and OnGameModeExit, it actually works fine so there's no need for me to save them on timers which requires usage of RAM causing lag on your server from what I know of, especially if they're called every second or two.

Note: I'm not sure of this, but it works just right in my case.


Re: Save player account | OnPlayerUpDate or Timer ? - jcvag44800 - 11.04.2012

Thanks all ! I use 2 seconds!


Re: Save player account | OnPlayerUpDate or Timer ? - [LoF]Zak - 11.04.2012

If I were you i'd just make it save under OnPlayerDisconnect, and OnGameModeExit too.


Re: Save player account | OnPlayerUpDate or Timer ? - ReneG - 11.04.2012

If the server is gmx'd in the console while player's are one, their data will be lost. You have to call
pawn Код:
SendRconCommand("gmx");
via the script for OnGameModeExit option to work.