SA-MP Forums Archive
Timer question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer question (/showthread.php?tid=661636)



Timer question - m4karow - 09.12.2018

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.


Re: Timer question - RIDE2DAY - 09.12.2018

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


Re: Timer question - m4karow - 10.12.2018

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.


Re: Timer question - Alteh - 10.12.2018

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);



Re: Timer question - m4karow - 10.12.2018

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


Re: Timer question - Hunud - 10.12.2018

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?


Re: Timer question - Hunud - 10.12.2018

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