Posts: 3,351
Threads: 780
Joined: Jan 2010
Hello guys,i've this timers
pawn Код:
SetTimer("AutoSave",600000,true);
SetTimer("MoneyCheck", 5000, true);
zonetimer = SetTimer("ZoneUpdate", 2000, true);
timer1 = SetTimer("AntiCheat",5000,true);
OnGameModeInit
The timer AutoSave is to save all online players stats every 10 minutes.
The MoneyCheck timer,check all online players money every 5 seconds.
The ZoneUpdate is for the gangwar system,and check if turf is taken or not every 2 seconds.
The AntiCheat is for the anticheat system,and checks all players every 5 seconds.
I'm asking...this timers will increase lag?
Posts: 6,129
Threads: 36
Joined: Jan 2009
Not really, unless you have extremely resource intensive code within the timed functions.
If you perform a bunch of loops and file saving every few seconds - then the lag would be noticable, but I'd say that seems like an okay balance.
Posts: 74
Threads: 11
Joined: Sep 2011
Reputation:
0
Suggestion when you create timers for players don't initialize it on the callback OnGameModeInit. Create a variable[MAX_PLAYERS] for eg to equal your time and initialize it when the player connects, spawns, etc. Also try optimize it the much you can, like don't forget to Kill Timers when possible and initialize they again. If you do that you will have less lag.
Posts: 6,129
Threads: 36
Joined: Jan 2009
StuffBoy: Doing so would require more timers, it's much less efficient, there's quite a few threads on this already.
Posts: 1,317
Threads: 23
Joined: Feb 2010
Reputation:
0
Just a few suggestions, why not move the money timer inside the anti cheat timer? And why would you save player variables every 10 minutes, once on disconnect is enough? For the zone update why a timer? If you have a turf system make a command to capture a turf set a variable and update the color or however you show it? (I don't know how your turf system works -- so this might now work).
Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by playbox12
Just a few suggestions, why not move the money timer inside the anti cheat timer? And why would you save player variables every 10 minutes, once on disconnect is enough? For the zone update why a timer? If you have a turf system make a command to capture a turf set a variable and update the color or however you show it? (I don't know how your turf system works -- so this might now work).
|
Servers crash every so often - no matter how good your script is, you can never time it, so extra clarity is better than none at all.
Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by playbox12
I'd have to agree if your sql queries are threaded it won't be a problem, but if I'm honest I have played on some big servers for some time indeed the server did crash from time to time but I never really lost any notable statistics. If you have alot of players you might want to cut on timers like that it really depends on your script if you use Dini or any of it's kind it's really a no go.
|
Threaded queries aren't re-executed if the server crashes during.
Every good server updates every account every few minutes anyway - look at GamerX even, they save stats every five minutes or so.