- Documentation
- Shared functions
- getNearestVehicleNode
Function
getNearestVehicleNode
Returns the nearest car road point to a given place. On the client it only works inside async.
Syntax
float, float, float, int, bool, bool getNearestVehicleNode(float x, float y, float z [, bool boat = false, float maxDistance = 500])Arguments
xfloat- X.
yfloat- Y.
zfloat- Z.
boatbool, optional = false- The nearest water point.
maxDistancefloat, optional = 500- Maximum distance in metres (up to 3000).
Returns
x, y, z, node number, whether it is a highway, whether it is emergency-only; false if there is no road in range.
Example
local x, y, z = getNearestVehicleNode(1000, -1000, 30)
if x then createVehicle(411, x, y, z + 1) end