PDA

View Full Version : In range for 5 sec


MrCong
29/05/2013, 07:37 PM
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

Sanady
29/05/2013, 07:38 PM
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

Pottus
29/05/2013, 09:05 PM
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.

http://forum.sa-mp.com/showthread.php?t=423622

Scenario
29/05/2013, 09:07 PM
+1 Pottus

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

Pottus
29/05/2013, 09:10 PM
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.

Scenario
29/05/2013, 09:14 PM
Pottus;2547110']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? :p

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

Pottus
29/05/2013, 09:24 PM
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 :)

Vince
29/05/2013, 09:56 PM
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.