RedM Natives

GET_NTH_CLOSEST_VEHICLE_NODE_ID_WITH_HEADING

Returns the nth closest vehicle node with a heading to a coord

Hash0x4114EAA8A7F7766D
Runtime nameGetNthClosestVehicleNodeIdWithHeading
NamespacePATH
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0x6448050E9C2A7207

Signature

int GET_NTH_CLOSEST_VEHICLE_NODE_ID_WITH_HEADING(float x, float y, float z, int nthClosest, float* returnHeading, int* returnNumLanes, int nodeFlags, float zMeasureMult, float zTolerance);

Parameters

NameTypeDescription
xfloat—
yfloat—
zfloat—
nthClosestint—
returnHeadingfloat*—
returnNumLanesint*—
nodeFlagsint—
zMeasureMultfloat—
zTolerancefloat—

Returns int

Description

Returns the nth closest vehicle node with a heading to a coord

Usage

Lua
local retval, returnHeading, returnNumLanes = GetNthClosestVehicleNodeIdWithHeading(x, y, z, nthClosest, nodeFlags, zMeasureMult, zTolerance)

-- always works, by hash
local retval, returnHeading, returnNumLanes = Citizen.InvokeNative(0x4114EAA8A7F7766D, x, y, z, nthClosest, Citizen.PointerValueFloat(), Citizen.PointerValueInt(), nodeFlags, zMeasureMult, zTolerance, Citizen.ResultAsInteger())
JavaScript and C#
JavaScript
const [retval, returnHeading, returnNumLanes] = GetNthClosestVehicleNodeIdWithHeading(x, y, z, nthClosest, nodeFlags, zMeasureMult, zTolerance);

// by hash
const [retval, returnHeading, returnNumLanes] = Citizen.invokeNative('0x4114EAA8A7F7766D', x + 0.0000001, y + 0.0000001, z + 0.0000001, nthClosest, Citizen.pointerValueFloat(), Citizen.pointerValueInt(), nodeFlags, zMeasureMult + 0.0000001, zTolerance + 0.0000001, Citizen.returnResultAnyway(), Citizen.resultAsInteger());
C#
var returnHeading = new OutputArgument();
var returnNumLanes = new OutputArgument();
int retval = Function.Call<int>((Hash)0x4114EAA8A7F7766D, x, y, z, nthClosest, returnHeading, returnNumLanes, nodeFlags, zMeasureMult, zTolerance);
// returnHeading.GetResult<float>()
// returnNumLanes.GetResult<int>()
  • Float parameters: Lua integers (10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to non-zero floats for the same reason.
  • Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.