# PHYSICS::ADD_ROPE

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

## Signature

```c
int ADD_ROPE(float x, float y, float z, float rotX, float rotY, float rotZ, float length, int ropeType, float maxLength, float minLength, float p10, BOOL p11, BOOL p12, BOOL rigid, float p14, BOOL breakWhenShot, Any* unkPtr, BOOL p17);
```

## Parameters

- `x` (`float`)
- `y` (`float`)
- `z` (`float`)
- `rotX` (`float`)
- `rotY` (`float`)
- `rotZ` (`float`)
- `length` (`float`)
- `ropeType` (`int`)
- `maxLength` (`float`)
- `minLength` (`float`)
- `p10` (`float`)
- `p11` (`BOOL`)
- `p12` (`BOOL`)
- `rigid` (`BOOL`)
- `p14` (`float`)
- `breakWhenShot` (`BOOL`)
- `unkPtr` (`Any*`)
- `p17` (`BOOL`)

## Returns

`int`

## Description

There are 19 types of rope, from type = 0 to type = 18
Rope definitions are stored in ropedata.xml
Rope types 0, 15 and 18 have proper physics for hanging objects (taut, do not sag, small to medium diameter, good aspect for a rope)

## Usage

### Lua

```lua
local retval, unkPtr = AddRope(x, y, z, rotX, rotY, rotZ, length, ropeType, maxLength, minLength, p10, p11, p12, rigid, p14, breakWhenShot, p17)

-- always available, by hash
local retval, unkPtr = Citizen.InvokeNative(0xE832D760399EB220, x, y, z, rotX, rotY, rotZ, length, ropeType, maxLength, minLength, p10, p11, p12, rigid, p14, breakWhenShot, Citizen.PointerValueInt(), p17, Citizen.ResultAsInteger())
```

### JavaScript

```js
const [retval, unkPtr] = AddRope(x, y, z, rotX, rotY, rotZ, length, ropeType, maxLength, minLength, p10, p11, p12, rigid, p14, breakWhenShot, p17);

// by hash
const [retval, unkPtr] = Citizen.invokeNative('0xE832D760399EB220', x + 0.0000001, y + 0.0000001, z + 0.0000001, rotX + 0.0000001, rotY + 0.0000001, rotZ + 0.0000001, length + 0.0000001, ropeType, maxLength + 0.0000001, minLength + 0.0000001, p10 + 0.0000001, p11, p12, rigid, p14 + 0.0000001, breakWhenShot, Citizen.pointerValueInt(), p17, Citizen.returnResultAnyway(), Citizen.resultAsInteger());
```

### C#

```csharp
var unkPtr = new OutputArgument();
int retval = Function.Call<int>((Hash)0xE832D760399EB220, x, y, z, rotX, rotY, rotZ, length, ropeType, maxLength, minLength, p10, p11, p12, rigid, p14, breakWhenShot, unkPtr, p17);
// unkPtr.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.
- `Any*` arguments are often structs. Build them with a DataView buffer and pass it with `:Buffer()` — see the examples and notes below.

*Sources: alloc8or RDR3 NativeDB.*
