Timers decrease lag? -
Admigo - 05.05.2012
Heey all,
I am making a cnr server so using much timers.
Is there a Timer Streamer or something for decreasing the lags?
Thanks Admigo
Re: Timers decrease lag? -
JaTochNietDan - 05.05.2012
I doubt you need that many timers, I bet you could cut down on most of them as you are probably making far too many of them when you may not even need them.
One example of a common mistake I see around here: Are you using timers to limit how often a certain command can be used? If so, you are doing it a very inefficient way.
Can you show us an example of the timers you use that you think may need to be optimized?
AW: Timers decrease lag? -
vyper - 05.05.2012
Try not to use much timers

I am sure there are better ways for some of your timers
EDIT: goddamn... -.-'
Re: Timers decrease lag? -
FalconX - 05.05.2012
Quote:
Originally Posted by admigo
Heey all,
I am making a cnr server so using much timers.
Is there a Timer Streamer or something for decreasing the lags?
Thanks Admigo
|
It is not always necessary to use timers there are a lot more functions of times in the PAWN you can use them. Also, I've observe that the timer makes the server lag to some extent. You can have a look in the pawn lang and decide if you want to use timer itself as there are tickcounts etc..
-FalconX
Re: Timers decrease lag? -
Admigo - 05.05.2012
I think i am only use 6 timers but sometimes my server lags that if i am typing something the message show about 5 seconds later and sometime my game clock is stuck then about some seconds it starting again so lag by timers i think.
Re: Timers decrease lag? -
Face9000 - 05.05.2012
Try to categorize timers,don't use it too much or it will cause lag.Regroup the timers.Example:
If you have to check players hp/armour and money,dont do 3 timers,just use one for all the 3 checks.
Re: Timers decrease lag? -
Admigo - 05.05.2012
What About Y_Timers? Whats does that include?
Re: Timers decrease lag? -
SuperViper - 05.05.2012
That only changes the way you make timers, doesn't improve speed. If your timers are really fast, you shouldn't have a lot of code in them. Especially in OnPlayerUpdate, you need to keep the code in there to a minimal amount because it's called over 10 times a second.
Re: Timers decrease lag? -
Admigo - 05.05.2012
I have a one second timer with lots of variables like:
Код:
if(HasRobbedRecently[playerid]>=1)
{
HasRobbedRecently[playerid]--;
}
Is this a problem?
Re: Timers decrease lag? -
JaTochNietDan - 05.05.2012
Quote:
Originally Posted by admigo
I have a one second timer with lots of variables like:
Код:
if(HasRobbedRecently[playerid]>=1)
{
HasRobbedRecently[playerid]--;
}
Is this a problem?
|
Do you use that to limit how often someone can rob? If so, why do you need a timer for that? Instead use
tickcount, for example:
pawn Код:
new HasRobbedRecently[MAX_PLAYERS];
if((tickcount() - 60000) < HasRobbedRecently[playerid]) return SendClientMessage(playerid, COLOR_RED, "Error, you cannot rob now");// Player has not waited 60 seconds
else
{
// Player has waited 60 seconds...do the robbery
HasRobbedRecently[playerid] = tickcount();
}
Doing it that way will avoid using timers and make things a lot cleaner