Timer question
#1

Hey

Is a bad method to use SetTimerEx for respawning a vehicle? I'm making a job system, but I don't want to respawn the objective vehicle instantly whenever the player reach the destination. Of course whenever every player enters in that checkpoint the server will start a new timer too..

So my questioin is should I find another method or this easy method will be fine? Becouse I can use the main VehicleTimer for checking for respawn time.
Reply
#2

It's not bad at all, but make sure you don't start two or more timers for the same vehicle (it wouldn't make sense).
Reply
#3

That's right. But if the players start about 10-15-20 timer after another won't cause lags?
Theese timers will respawn and add back the vehicles to the iterator where the server can select the objective vehicle.
Reply
#4

Quote:
Originally Posted by m4karow
Посмотреть сообщение
That's right. But if the players start about 10-15-20 timer after another won't cause lags?
Theese timers will respawn and add back the vehicles to the iterator where the server can select the objective vehicle.
to avoid it use KillTimer.

Example:

Код:
new Kill_Timer[MAX_PLAYERS];



KillTimer(Kill_Timer[playerid]);
Kill_Timer[playerid] = SetTimerEx("func-name",1000,false,"i",playerid);
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Don't use the same timer for multiple things. You can spawn thousands of timers with no issues at all. I have no idea where the idea that timers are somehow bad came from, but it is wrong.
Thanks for your reply. I have readed a post that said using a lot of timers will slow the server thats why I tried to use minimum amount of timers where I can use another method
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
Don't use the same timer for multiple things. You can spawn thousands of timers with no issues at all. I have no idea where the idea that timers are somehow bad came from, but it is wrong.
People usually say using a lot of timers is bad idea, is it?
Reply
#7

Well tnx. I've just looking for brief exp.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)