SA-MP Forums Archive
When I shouldn't use SetTimer(Ex) that has less than 1000 ms? - 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: When I shouldn't use SetTimer(Ex) that has less than 1000 ms? (/showthread.php?tid=530909)



When I shouldn't use SetTimer(Ex) that has less than 1000 ms? - Rodney Francalim - 09.08.2014

I want to create a speedometer, but I would like to see the speed increasing and decreasing everytime, not for each second.

@EDIT: Sorry for my english, if it's bad.


Re: When I shouldn't use SetTimer(Ex) that has less than 1000 ms? - [XST]O_x - 09.08.2014

What is the question?
Just use a value lesser than 1000.
pawn Код:
SetTimerEx("UpdatePlayerSpeed", 100, true, "i", playerid);



Re: When I shouldn't use SetTimer(Ex) that has less than 1000 ms? - Rodney Francalim - 09.08.2014

I heard that the minimum must be 1000, cause it lags the server.


Re: When I shouldn't use SetTimer(Ex) that has less than 1000 ms? - Mauzen - 09.08.2014

You should use OnPlayerUpdate for that then. Whenever youre going below 100 or 200ms intervals you could just use OnPlayerUpdate so theres no overhead for running the timer.
Calculating and updating the speed isnt a big task, so it would be fine.


Re: When I shouldn't use SetTimer(Ex) that has less than 1000 ms? - [XST]O_x - 09.08.2014

Quote:
Originally Posted by Rodney Francalim
Посмотреть сообщение
I heard that the minimum must be 1000, cause it lags the server.
I don't think there is a minimum. You can set it to 1, updating 1000 times a second.
Of course the more updates the bigger the "lags", but minor tasks like speed calculation won't slow your server down by a noticable amount. So 200-300ms should be fine I think, unless you have 1000 players in your server all driving in a vehicle simultaneously.


Re: When I shouldn't use SetTimer(Ex) that has less than 1000 ms? - SlimDkhili - 09.08.2014

it's not minimum = 1000
Depend on Host and How much CPU and RAM you have , Well making it 100 will excute the same function 10time more than as it was , so it may use more resurce

Sorry , bad english


Re: When I shouldn't use SetTimer(Ex) that has less than 1000 ms? - Rodney Francalim - 09.08.2014

Thank you!