Three points, which one is closest? - 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: Three points, which one is closest? (
/showthread.php?tid=294482)
Three points, which one is closest? -
Jack_Leslie - 01.11.2011
Hi guys.
I'm wondering how I would go about having 3 points, and asking which one is the closest from where the player is. So just for an example,
Point 1: 1.00X, 2.00Y, 2.05Z
Point 2: 222.00X, 32.111Y, 333.33Z
Point 3: 1223.00X, 123.11Y, 321.11111Z
How would I ask which one the player is closest too?
Re: Three points, which one is closest? -
Vince - 01.11.2011
Loop through them all with the function
GetPlayerDistanceFromPoint and then just looks which one's the closest. Really simple, if you ask me.
Re: Three points, which one is closest? -
Jack_Leslie - 01.11.2011
Quote:
Originally Posted by Vince
Loop through them all with the function GetPlayerDistanceFromPoint and then just looks which one's the closest. Really simple, if you ask me.
|
Okay thanks, I just didn't really know which method of doing it would be best.