SA-MP Forums Archive
In range for 5 sec - 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: In range for 5 sec (/showthread.php?tid=440436)



In range for 5 sec - MrCong - 29.05.2013

Hello Internet,

I was trying to make some sort of a function, but i wasnt able to. I hope you guys can help me
What it must do:

Each 750 ms the function checks the distance from a player to a point.
The player has to try and stay in range of that point for 5 sec.
When he succeeds he gets a message for example.
but whenever the player leaves the range, the timer resets to 5 sec.

Thx for help,

MrCong


Re: In range for 5 sec - Sanady - 29.05.2013

You need to use Timer with function OnPlayerRangeOn i thing is function.I forgot but you need to use them to make your function.But if you need more help check http://wiki.sa-mp.com


Re: In range for 5 sec - Pottus - 29.05.2013

This is a job for Incognito's streamer and dynamic areas there is absolutely no need for using range checking here is what you do.

Create a area.
Player enters area set a timer
Player leaves area kill timer

It's really simple no need for checking if the player is still in the area, no need for a repeating timer, no need for range checking.

I built this include specifically for making features like this.

https://sampforum.blast.hk/showthread.php?tid=423622


Re: In range for 5 sec - Scenario - 29.05.2013

+1 Pottus

Areas are great! I use them for my dynamic gas station and dynamic toll system for my RP script.


Re: In range for 5 sec - Pottus - 29.05.2013

I agree RC whats the point of using range checking it's completely counter intuitive when dynamic areas handle all of the overhead effectively, efficiently and of course dynamically. However I should really update the sub-streamer to use a custom iterator even though I reckon the improvement would be marginal.


Re: In range for 5 sec - Scenario - 29.05.2013

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
I agree RC whats the point of using range checking it's completely counter intuitive when dynamic areas handle all of the overhead effectively, efficiently and of course dynamically. However I should really update the sub-streamer to use a custom iterator even though I reckon the improvement would be marginal.
Nearly everything in my script is dynamic. Why not make the areas, too?

If it wouldn't take long to update the sub-streamer, you might as well.


Re: In range for 5 sec - Pottus - 29.05.2013

Ya I'll probably do it up in the next week or so, it's probably best to have it function as fast as possible especially considering how useful it has been for me


Re: In range for 5 sec - Vince - 29.05.2013

Why don't you use a simple checkpoint? Also Pottus, I really don't want to tear down your script but the Streamer plugin has had this functionality for a very long time.