# PATH::GET_NTH_CLOSEST_VEHICLE_NODE_ID_WITH_HEADING

- **Hash:** `0x4114EAA8A7F7766D`
- **Namespace:** PATH
- **Runtime name (Lua/JS):** `GetNthClosestVehicleNodeIdWithHeading`
- **Side:** client (game native)
- **Name status:** official
- **Documentation:** described
- **Since game build:** 1207
- **URL:** https://natives.borderlinerp.com/natives/PATH/GET_NTH_CLOSEST_VEHICLE_NODE_ID_WITH_HEADING

## Signature

```c
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

- `x` (`float`)
- `y` (`float`)
- `z` (`float`)
- `nthClosest` (`int`)
- `returnHeading` (`float*`)
- `returnNumLanes` (`int*`)
- `nodeFlags` (`int`)
- `zMeasureMult` (`float`)
- `zTolerance` (`float`)

## Returns

`int`

## Description

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

## Usage

### Lua

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

-- always available, by hash
local retval, returnHeading, returnNumLanes = Citizen.InvokeNative(0x4114EAA8A7F7766D, x, y, z, nthClosest, Citizen.PointerValueFloat(), Citizen.PointerValueInt(), nodeFlags, zMeasureMult, zTolerance, Citizen.ResultAsInteger())
```

### JavaScript

```js
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#

```csharp
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.*
