isPointOnRoad

IS_POINT_ON_ROAD0x125BF4ABFC536B09

The GTA V native IS_POINT_ON_ROAD of the PATHFIND namespace, as LS:MP client scripts call it: the global function isPointOnRoad, in JavaScript and in Lua.

SignatureJavaScript
isPointOnRoad(x: number, y: number, z: number, vehicle: Vehicle): boolean
SignatureLua
isPointOnRoad(x: number, y: number, z: number, vehicle: Vehicle): boolean

Usage

JavaScript
const result = isPointOnRoad(x, y, z, vehicle);
Lua
local result = isPointOnRoad(x, y, z, vehicle)

Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.

JavaScript · with vectors
const result = isPointOnRoad(pos, vehicle);
Lua · with vectors
local result = isPointOnRoad(pos, vehicle)

Parameters

ParameterTypeJavaScriptLua
xfloatnumbernumber
yfloatnumbernumber
zfloatnumbernumber
vehicleVehiclenumberinteger

Returns

BOOL JavaScript boolean, Lua boolean

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Gets a value indicating whether the specified position is on a road.
The vehicle parameter is not implemented (ignored).

Reference

Namespace
Pathfinding PATHFIND
In the game
BOOL IS_POINT_ON_ROAD(float x, float y, float z, Vehicle vehicle)
Hash
0x125BF4ABFC536B09

Open in the interactive natives reference