Set Timer for Saving??
#1

hi,
just wondering.
I use dini to save the player data to a file.
It always saves when leaving (OnPlayerDisconnect).
But now id like to know if i should set a timer for saving.
Cause in case the server crashes the players progress wouldnt be saved right?
That could be very hard for some players playing for a long time without any break (disconnects).
But otherwise it could cause lag on my server, right?
So should i set a timer for every player to save e.g. every 20 mins?

Id be happy about some answers.

regards...
Reply
#2

I do this, i have a 10 minute timer to save data, i also run a check on a 60 second timer that runs after the data save timer to make sure the players data corresponds to what was saved, and if not, it saves it over the incorrect data

It doesnt cause lag, i even run a timer to save server information to file, to be called by a website or a data request (to keep the actual server process free from extra processing)
Reply
#3

ok thx for ur answer funky.
I think im gonna set up a kind of saving timer.
But id be happy if some more scripters could tell me their oppinions.

Btw: How/what system do u use for saving the server status and sending it to ur website?
Id like to do that to but i dont know how. Would be nice if u could give me a link or some hints.
Reply
#4

Well, using DINI, i save the information (like max players) and save it to a file. I then use PHP to parse the INI file and echo to the website. It is currently not in action at the moment due to a refurbishment of my website, you can check out my "Player Check" script which runs on the same system

http://www.trucking-world.net/conten...t.php?name=Ash
[That "checks" my account]
Go to; http://www.trucking-world.net/content/scripts/check/ to see the form.
Reply
#5

ok thx again
Reply
#6

This may help, if you are intending on doing the same
http://uk2.php.net/manual/en/functio...e-ini-file.php
Reply
#7

yep this helps thx funky!
Reply
#8

It would slow down the server for that few seconds it saves. Better use some faster method for saving like Y_Ini. But yes, I got a timer that runs every 5 minutes and saves all stats, on Y_Ini, and it doesn't make any Lag-Spikes.
Reply
#9

Quote:
Originally Posted by Mean
Посмотреть сообщение
It would slow down the server for that few seconds it saves. Better use some faster method for saving like Y_Ini. But yes, I got a timer that runs every 5 minutes and saves all stats, on Y_Ini, and it doesn't make any Lag-Spikes.
Never had any problems or lag with dini either

(I need to switch to y_ini though, im starting to actually despise dini)
Reply
#10

Why 2 timers?
Theres no point in too, timers aren't suppose be repeated for just one small function, idk if you get me although, put the save player data thing inside another repeating timer you have currently got, running heaps of timers can get often laggy, i did something like this before:

pawn Код:
SetTimer("GlobalTimer", 1, true);

public GlobalTimer()
{
       new StatsTimer = 120000; //2 minutes
       StatsTimer--;
       if(StatsTimer == 0)
       {
              StatsTimer = 120000; // 2minutes again.
       }
}
Just make an variable with an amount of miliseconds then decrease it by one. Im really not sure if it'll lag. Didnt happen to me...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)