Skip to main content

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 found
  • closestDist: The distance to that vehicle
  • closestCoords: The coords of the vehicle

Usage

local closestVeh, closestDist, closestCoords = exports['FS-Lib']:GetClosestVehicle(10.0)