Whats the best way.. - 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: Whats the best way.. (
/showthread.php?tid=303678)
Whats the best way.. -
iTorran - 14.12.2011
What is the best way to accuratly count laps without checkpoints?
At the moment i am using IsPlayerInRangeOfPoint on a 500 milisecond/1 second timer (undecided).
But even on the 500 milisecond timer it sometimes misses certain "points" so ..
.. it dosent think that the person has properly completed a lap and therefore dosent up the lap counter.
What im doing atm:
5 or 6 points around a track, 500 milisecond repeating timer checks if a car is in that area and ups a variable by 1, after variable hits so many and player is in certain range of point, it counts a lap.
radius 30
Tests:
I did 10 laps and at the end it only counted 8
AW: Whats the best way.. -
BigETI - 14.12.2011
You can create a function in your timer callback like a vector calculation on each position check if the line crosses one of these ranges.
Re: Whats the best way.. -
Rob_Maate - 14.12.2011
Solution 1: Use OnPlayerUpdate
Solution 2: Increase the radius of detection
Solution 3: Lower the interval between the timers.
It's all a balance. If you can minimize the use of quickly recurring timers it's always a bonus, but sometimes you can't.
Re: Whats the best way.. -
Kar - 14.12.2011
or make invisible pickups (like droll)