The Lab
PATH native

GET_CLOSEST_VEHICLE_NODE

returns BOOL7 paramsbuild 1207

Finds the vehicle path node closest to the given coordinates, writes it to outPosition and returns true on success.

Handy for placing a spawned vehicle on a road.

Signature

C
BOOL GET_CLOSEST_VEHICLE_NODE(float x, float y, float z, Vector3* outPosition, int nodeType, float p5, float p6); // 0x240A18690AE96513 b1207

Parameters

#NameType
1xfloat
2yfloat
3zfloat
4outPositionVector3* (out pointer)
5nodeTypeint
6p5float
7p6float

Facts

Facts about GET_CLOSEST_VEHICLE_NODE
Name
GET_CLOSEST_VEHICLE_NODE
Hash
0x240A18690AE96513
Namespace
Returns
BOOL
Game build
1207

Examples

Calls by hash work in every RedM runtime. Replace the placeholder arguments with your own values.

Lua
local result, outPosition = Citizen.InvokeNative(0x240A18690AE96513, -- GET_CLOSEST_VEHICLE_NODE
  0.0, -- float x
  0.0, -- float y
  0.0, -- float z
  Citizen.PointerValueVector(), -- Vector3* outPosition
  0, -- int nodeType
  0.0, -- float p5
  0.0, -- float p6
  Citizen.ReturnResultAnyway()
)
if result then
  -- ...
end
JavaScript
// Whole JS numbers are sent as integers: pass floats like 1.5 (or n + 0.0000001), never 1.
const [result, outPosition] = Citizen.invokeNative("0x240A18690AE96513", // GET_CLOSEST_VEHICLE_NODE
  0.0, // float x
  0.0, // float y
  0.0, // float z
  Citizen.pointerValueVector(), // Vector3* outPosition
  0, // int nodeType
  0.0, // float p5
  0.0, // float p6
  Citizen.returnResultAnyway()
);
if (result) {
  // ...
}
C#
var outPositionArg = new OutputArgument();
bool result = Function.Call<bool>((Hash)0x240A18690AE96513, // GET_CLOSEST_VEHICLE_NODE
  0.0f, // float x
  0.0f, // float y
  0.0f, // float z
  outPositionArg, // Vector3* outPosition
  0, // int nodeType
  0.0f, // float p5
  0.0f // float p6
);
Vector3 outPosition = outPositionArg.GetResult<Vector3>();
All PATH natives

Facts compiled from community research (alloc8or/rdr3-nativedb-data, femga/rdr3_discoveries); descriptions and examples by The Lab.