Server

Find the closest vehicle to the given entity within a radial distance

lib.closestVehicle

lib.closestVehicle(source, entity, radialSpace)

Parameters

  • source number: The client source id
  • entity number: The entity to compare from
  • radialSpace number: The radial distance within to search for the closest vehicle

Returns

  • entity number: the closest vehicle's entity

Examples

local playerPed<const> = GetPlayerPed(source)
local closestVehicle<const> = lib.closestVehicle(source, playerPed, 10.0)
 
print(closestVehicle) -- 0123456?...