Problem with timers -
mineralo - 28.02.2012
well, I have problems with timers, I got a lot timers and all doing in same time and very quikly and that make lagg for players and server, how I can use timers in other way for more easy and useful
pawn Код:
OnGameModeInit()
{
SweeperTimer = SetTimer("Sweeper",60000,1);
BenzinUpdatetimer = SetTimer("BenzinUpdate", 999, 1);
checkgastimer = SetTimer("CheckGas", 42000, 1);
streamtimer = SetTimer("StreamPickups",1500,true);
ammutimer = SetTimer("CheckAmmu",1100,1);
ziptimer = SetTimer("CheckZip",1110,1);
scoretimer = SetTimer("ScoreTime",200000,1);
banktimer2 = SetTimer("BankTime",100,1);
banktimer3 = SetTimer("BankTime2",1500,1);
banktimer = SetTimer("CheckBank",1100,1);
godtimer = SetTimer("InfiniteLife",900,1);
abusertimer = SetTimer("CheckAbuser",20000,1);
citytimer = SetTimer("CheckCity",1300,1);
jobtimer = SetTimer("JobCheck",1400,1);
floodtimer = SetTimer("UpdateCmdFreq",2500,1);
newmem = SetTimer("Member",200000,1);
cheater = SetTimer("SendMSG2",900000,1);
metimer = SetTimer("Shout",1000,1);
afklol = SetTimer("vAFK",55000,1);
afklol2 = SetTimer("AFKtime",60000,1);
cop = SetTimer("CheckCop",800,1);
owner = SetTimer("CheckOwner",2000,1);
return 1;
}
how you see, I have a lot tiemrs
any body have some ideas?
Re: Problem with timers -
aco_SRBIJA - 28.02.2012
half of them has the timing less than 1 second with repeating.
Re: Problem with timers -
DarkScripter - 28.02.2012
pawn Код:
public OnGameModeInit()
{
#define MinTimer (1500)
SweeperTimer = SetTimer("Sweeper",60000,1);
BenzinUpdatetimer = SetTimer("BenzinUpdate", MinTimer, 1); // LOLF
checkgastimer = SetTimer("CheckGas", 42000, 1);
streamtimer = SetTimer("StreamPickups",MinTimer,true);
ammutimer = SetTimer("CheckAmmu",MinTimer,1);
ziptimer = SetTimer("CheckZip",MinTimer,1);
scoretimer = SetTimer("ScoreTime",200000,1);
banktimer2 = SetTimer("BankTime",MinTimer,1);
banktimer3 = SetTimer("BankTime2",MinTimer,1);
banktimer = SetTimer("CheckBank",MinTimer,1);
godtimer = SetTimer("InfiniteLife",MinTimer,1);
abusertimer = SetTimer("CheckAbuser",20000,1);
citytimer = SetTimer("CheckCity",MinTimer,1);
jobtimer = SetTimer("JobCheck",MinTimer,1);
floodtimer = SetTimer("UpdateCmdFreq",MinTimer + 500,1);
newmem = SetTimer("Member",200000,1);
cheater = SetTimer("SendMSG2",900000,1);
metimer = SetTimer("Shout",MinTimer,1);
afklol = SetTimer("vAFK",55000,1);
afklol2 = SetTimer("AFKtime",60000,1);
cop = SetTimer("CheckCop",MinTimer,1);
owner = SetTimer("CheckOwner",2000,1);
return 1;
}
In best configuration, don't remove.
Re: Problem with timers -
iPLEOMAX - 28.02.2012
If I were you, I would use a single timer (500 ms interval) for all the functions.
Under a single callback, You can create static variables and increment it by 500 on every tick.
Name the variables to each of the functions. When a variable reaches your desired time, execute the functions.. and reset the variable.
I hope you understand, if you didn't, I'll PM you tomorrow.
Re: Problem with timers -
mineralo - 29.02.2012
well, I thought about replace interval with something like how DarkScripter said.
So, if somebody have other ideas for use timers more easy and useful then tell plz