GetClosestVehicle
Finds the closest vehicle within a specified distance from the player's current location.
Parameters
maxDistance
: The maximum distance within which to search for pedestrians (number).
Returns
closestVeh
: The vehicle it foundclosestDist
: The distance to that vehicleclosestCoords
: The coords of the vehicle
Usage
- Lua
- Javascript
local closestVeh, closestDist, closestCoords = exports['FS-Lib']:GetClosestVehicle(10.0)
const [closestPed, closestDist, closestCoords] = exports['FS-Lib'].GetClosestVehicle(10.0)