# TASK::_CALCULATE_WAYPOINT_DISTANCE_FROM_START

- **Hash:** `0x3ACC128510142B9D`
- **Namespace:** TASK
- **Runtime name (Lua/JS):** `CalculateWaypointDistanceFromStart`
- **Side:** client (game native)
- **Name status:** community guess (may change)
- **Documentation:** described
- **Since game build:** 1207
- **URL:** https://natives.borderlinerp.com/natives/TASK/_CALCULATE_WAYPOINT_DISTANCE_FROM_START

## Signature

```c
float _CALCULATE_WAYPOINT_DISTANCE_FROM_START(const char* waypointRecording, float x, float y, float z);
```

## Parameters

- `waypointRecording` (`const char*`)
- `x` (`float`)
- `y` (`float`)
- `z` (`float`)

## Returns

`float`

## Description

*Source: alloc8or RDR3 NativeDB*

Signed arclength (meters) from the start of a loaded waypoint recording to the point on the path nearest to (x,y,z).
Negative before the first node; clamped to total length past the last node. Recording must be requested/loaded.

*Source: VORPCORE RDR3natives*

Returns the signed distance along the waypoint recording from its start (first node) to the point on the recording that corresponds to coords
 need `REQUEST_WAYPOINT_RECORDING`

## Usage

### Lua

```lua
local retval = CalculateWaypointDistanceFromStart(waypointRecording, x, y, z)

-- always available, by hash
local retval = Citizen.InvokeNative(0x3ACC128510142B9D, waypointRecording, x, y, z, Citizen.ResultAsFloat())
```

### JavaScript

```js
const retval = CalculateWaypointDistanceFromStart(waypointRecording, x, y, z);

// by hash
const retval = Citizen.invokeNative('0x3ACC128510142B9D', waypointRecording, x + 0.0000001, y + 0.0000001, z + 0.0000001, Citizen.returnResultAnyway(), Citizen.resultAsFloat());
```

### C#

```csharp
float retval = Function.Call<float>((Hash)0x3ACC128510142B9D, waypointRecording, x, y, z);
```

- 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.
- The name is a community guess and may change. If the named call is missing in your client build, use `InvokeNative` with the hash — it always works.

*Sources: alloc8or RDR3 NativeDB, VORPCORE RDR3natives.*
