Timer question
#1

Hey guys. Is better to make less timers and more code on the timers or different timers with less code? Thanks in advance
Reply
#2

I'm using a global timer of 1 second, that loops through all players and checks for different things.
Etc. if they are in a taxi with a taximeter ticking, i increase the "taximetertick" with
pawn Код:
TaximeterTick[i]++;
And then it checks for other stuff too, as prison time, and decreases the prisontime by 1.
pawn Код:
PrisonTime[i]--;
Not sure if this is the best way though.
Reply
#3

More timers with less code. You can kill off unnecessarily running ones, you don't have to build complex if clauses to check which ones should execute. Also the code is much clearer, and you can store your timers closer to logic they are related to. Check out y_timers for really clean code with best coding practices kept (player timers and tasks are super cool).
Reply
#4

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
I'm using a global timer of 1 second, that loops through all players and checks for different things.
Etc. if they are in a taxi with a taximeter ticking, i increase the "taximetertick" with
pawn Код:
TaximeterTick[i]++;
And then it checks for other stuff too, as prison time, and decreases the prisontime by 1.
pawn Код:
PrisonTime[i]--;
Not sure if this is the best way though.
I'm using it like this, but it has some delay, dunno why
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)