Skip to content

Commit

Permalink
feat(natives/vehicle): Update SetConvertibleRoof (#930)
Browse files Browse the repository at this point in the history
* feat(natives/vehicle): Update SetConvertibleRoof

* Update SetConvertibleRoof.md (4mmonium)

Re-name roofState to toggle since the name roofState could indicate that this changes the 'state' of the roof rather than toggling it on/off.

---------

Co-authored-by: ammonia-cfx <[email protected]>
  • Loading branch information
spacevx and 4mmonium authored Nov 8, 2023
1 parent e3a8168 commit 502e93d
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions VEHICLE/SetConvertibleRoof.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,42 @@ ns: VEHICLE

```c
// 0xF39C4F538B5124C2 0xC87B6A51
void SET_CONVERTIBLE_ROOF(Vehicle vehicle, BOOL p1);
void SET_CONVERTIBLE_ROOF(Vehicle vehicle, BOOL toggle);
```
This allows for the vehicle's roof to be put on when set to true, and removed when set to false, provided that the vehicle has a version with a roof and a version without a roof.
#### Vehicles with both roofed and roofless versions (others may exist; this list is compiled from decompiled scripts).
* chino
* voltic
* buccaneer
* buccaneer2
* chino2
* faction
* faction2
* mamba
## Parameters
* **vehicle**:
* **p1**:
* **vehicle**: The vehicle to which the roof state will be applied.
* **toggle**: Boolean value where `true` adds the roof and `false` removes it, applicable only if the vehicle has a version with and without a roof.
## Examples
```lua
-- In this case we are removing the roof from the vehicle.
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
SetConvertibleRoof(vehicle, false)
```

```js
// In this case we are removing the roof from the vehicle.
const vehicle = GetVehiclePedIsIn(PlayerPedId(), false);
SetConvertibleRoof(vehicle, false);
```

```cs
// In this case we are removing the roof from the vehicle.
using static CitizenFX.Core.Native.API;
Vehicle vehicle = GetVehiclePedIsIn(PlayerPedId(), false);
SetConvertibleRoof(vehicle, false);
```

0 comments on commit 502e93d

Please sign in to comment.