28.04.2013, 05:41
I'm seeing a lot of idiotic responses from people and now the thread is 2 pages in. This is the only valid response:
You do NOT need to save data every few seconds. Every 5-10 minutes is more than enough; and no, it isn't an inefficiency issue here. Think about it like this: You're a player on the server. You've been playing for 4 hours straight and all of a sudden the server crashes; your stats aren't going to be saved. So... those 4 hours of work you just did are now gone.
How ticked are your players going to be if that happens?
Therefore, you need to make a repeating timer that saves each player's stats every 5-10 minutes. Hell, you could go with every 7.5 minutes if you really wanted to.
A little piece of code like this is going to work fine for you:
^ All you have to do is download YSI and add #include <YSI\y_timers> with all of your other includes, and add the code I just gave you to your script. Change "YourSaveFunction" to the function you use to save player accounts. It will save data every 7.5 minutes.
Quote:
To find X you need to ask yourself the question: how often are stats updated? You'd want to go with no less than 10 minutes. Yes, minutes. Very important changes (like change in admin level, password, etc) should be written out immediately.
|
How ticked are your players going to be if that happens?
Therefore, you need to make a repeating timer that saves each player's stats every 5-10 minutes. Hell, you could go with every 7.5 minutes if you really wanted to.
A little piece of code like this is going to work fine for you:
pawn Code:
task autosaveAccounts[60000*7.5]()
{
foreach(new i : Player) YourSaveFunction(i);
return 1;
}