Question about saving stats
#1

This is just a small and stupid question, I wanted to know if i save stats under "OnPlayerUpdate" using my savestats stock, will it cause any lag or something?
Reply
#2

At most, OnPlayerUpdate is getting called many many times a second i highly recommend saving stats in 2 cases:
1- The moment they change.
2- Using a 3 minute timer.
Reply
#3

So if i put SetTimer("SaveStats", 600000, true); under OnGamemodeinit and put my savestats stock under public callback, it will save stats without lagging?
Reply
#4

Depends on the size of your stocks. I would recommend to save stats as soon as the player lost the connection (example goes: /q - ESC+exit game - alt+f4 - timeout - crash)
Reply
#5

Quote:
Originally Posted by Uvais
Посмотреть сообщение
So if i put SetTimer("SaveStats", 600000, true); under OnGamemodeinit and put my savestats stock under public callback, it will save stats without lagging?
Yeah try that and see how it goes and lets hope that you don't use dini.
EDIT:@Gangsta if his server crashes due to a hacker/bug then player stats wont save.
Reply
#6

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Yeah try that and see how it goes and lets hope that you don't use dini.
EDIT:@Gangsta if his server crashes due to a hacker/bug then player stats wont save.
creating a timer to save every connected player every 3 minutes? not even with MySQL - btw Yes MySQL is fast er in this way but intern file writing is a lot faster than extern MySQL Server and client usage.
Reply
#7

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
creating a timer to save every connected player every 3 minutes? not even with MySQL - btw Yes MySQL is fast er in this way but intern file writing is a lot faster than extern MySQL Server and client usage.
I didn't suggest mysql, i'm clearly saying if you depend on saving player stats the moment he disconnects or crashes there's always a possibility of the server itself crashing and then player stats wont save also desynced players won't get their stats saved, probably.
Reply
#8

desynced player stats will be safe (never got problems since 2011).

Okay Yes if the Server crashes the players stats wont save, but this also counts for the last 2:59 minutes. the only way to solve this is to got a stable Server and (just for the case) to save the most important stuff as soon as changed.
Reply
#9

Quote:
Originally Posted by GangstaSunny.
Посмотреть сообщение
desynced player stats will be safe (never got problems since 2011).

Okay Yes if the Server crashes the players stats wont save, but this also counts for the last 2:59 minutes. the only way to solve this is to got a stable Server and (just for the case) to save the most important stuff as soon as changed.
True but not much can happen every 3 minutes, although if you depend on disconnect and someone is playing for... say 5-7 hours and loses his progress, i'd never join again, true it's more safe to save the moment they change that's why i suggested that above at my first post.
Reply
#10

I've added the timer, It's working perfect. Thanks for the help. Oh and I use Y_INI
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)