SA-MP Forums Archive
Timers help - 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: Timers help (/showthread.php?tid=627579)



Timers help - RayBiH - 29.01.2017

So I got this problem with delivers, delivers basically have a van, and when a player enters it, it start filling up with materials and drugs. So, every second a have a timer execute and it sets the timer up by 1 (and so on till 60 seconds). What I want to do is this:
The deliver delivers 1000 materials and 100g of drugs.
I want to show the amount of materials and drugs in the van (they are not really there, just for the look, they can't leave the deliver place until it's full of materials and drugs [60 seconds], so yeah.).

Let me demonstrate:

example:
10/1000 materials

10/100 drugs

and a second after:

20/1000 materials

20/100 drugs.

Basically for it to hit 1000 materials and 100 drugs right when the time hits 60 seconds.
Thanks.


Re: Timers help - Vince - 29.01.2017

You need to do 1000 / 10 = 100 iterations in 60 seconds; one iteration every 60 / 100 = 0.6 seconds = 600 milliseconds. Math. In the timer do a range-check or something and abort if the player leaves the area.