GET_CLOSEST_VEHICLE_NODE
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
BOOL GET_CLOSEST_VEHICLE_NODE(float x, float y, float z, Vector3* outPosition, int nodeType, float p5, float p6); // 0x240A18690AE96513 b1207Parameters
| # | Name | Type |
|---|---|---|
| 1 | x | float |
| 2 | y | float |
| 3 | z | float |
| 4 | outPosition | Vector3* (out pointer) |
| 5 | nodeType | int |
| 6 | p5 | float |
| 7 | p6 | float |
Facts
| 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.
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// 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) {
// ...
}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>();Related PATH natives
- GET_CLOSEST_VEHICLE_NODE_WITH_HEADING
- GET_NTH_CLOSEST_VEHICLE_NODE
- GET_NTH_CLOSEST_VEHICLE_NODE_FAVOUR_DIRECTION
- GET_NTH_CLOSEST_VEHICLE_NODE_ID
- GET_NTH_CLOSEST_VEHICLE_NODE_ID_WITH_HEADING
- GET_NTH_CLOSEST_VEHICLE_NODE_WITH_HEADING
- GET_CLOSEST_ROAD
- GET_RANDOM_VEHICLE_NODE
- GET_VEHICLE_NODE_IS_SWITCHED_OFF
- GET_VEHICLE_NODE_POSITION
- _GET_SPAWN_DATA_FOR_ROAD_NODE
- IS_VEHICLE_NODE_ID_VALID
Facts compiled from community research (alloc8or/rdr3-nativedb-data, femga/rdr3_discoveries); descriptions and examples by The Lab.