Timers questions
#1

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?
Reply
#2

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.
Reply
#3

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.
Reply
#4

StuffBoy: Doing so would require more timers, it's much less efficient, there's quite a few threads on this already.
Reply
#5

I must agree with you this time. *facepalm* Like having 200 players on a server and a timer for each player would increase very much the ram usage instead of having a loop for all players.

- Edit: We always learning
Reply
#6

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).
Reply
#7

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.
Reply
#8

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
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.
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.

I would save the statistics on some key moments, when a player spawns or puts money on his bank or takes it. All is just a suggestion I'm not nessercarly saying you should refrain from using another method.
Reply
#9

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.
Reply
#10

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
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.
I'm not saying they're going to be re-executed, I meant to say it will put less strain on a server. I doubt you dissagree that saving all players every 10 minutes while using Dini or alike is good practice? (I wouldn't be suprised if the majority still uses it).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)