SA-MP Forums Archive
Get the ID of the nearest vehicle! - 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: Get the ID of the nearest vehicle! (/showthread.php?tid=411613)



Get the ID of the nearest vehicle! - CrossOv3r - 29.01.2013

The title says all, exist any form to Get the ID of the nearest vehicle? A Stock? Function? Thanks.



Re: Get the ID of the nearest vehicle! - Jochemd - 29.01.2013

http://forum.sa-mp.com/showpost.php?...13&postcount=3


Re: Get the ID of the nearest vehicle! - Babul - 29.01.2013

however you like to call the algorithm, you have to use a linear search through all vehicles, checking and comparing the closest one, excluding the vehicleid you're sitting in indeed.
i would first script it as stock, then ocassionally transform it into a public callback, in case you want to call it from another filterscirpt, but then you could also use a stock in an .include file...
edit: wtf it took me 3 minutes to type this?


Respuesta: Get the ID of the nearest vehicle! - CrossOv3r - 29.01.2013

Thanks! Can close it