Skip to content

Commit

Permalink
feat(natives/vehicle): update vehicle natives
Browse files Browse the repository at this point in the history
  • Loading branch information
spacevx committed Dec 21, 2023
1 parent 5d614f1 commit dd0fba1
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 38 deletions.
18 changes: 0 additions & 18 deletions VEHICLE/N_0x0bbb9a7a8ffe931b.md

This file was deleted.

20 changes: 0 additions & 20 deletions VEHICLE/N_0x1b212b26dd3c04df.md

This file was deleted.

80 changes: 80 additions & 0 deletions VEHICLE/SetOpenRearDoorsOnExplosion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
ns: VEHICLE
aliases: ["0x1B212B26DD3C04DF"]
---
## SET_OPEN_REAR_DOORS_ON_EXPLOSION

```c
// 0x1B212B26DD3C04DF
void SET_OPEN_REAR_DOORS_ON_EXPLOSION(Vehicle vehicle, BOOL toggle);
```
Enables or disables the opening of a vehicle's rear doors in the event of a sticky bomb explosion. This native is effective for armored vehicles, such as the Stockade (Brinks vehicle), allowing the rear doors to be opened through controlled explosions, which might otherwise remain locked due to the vehicle nature.
## Parameters
* **vehicle**: The vehicle to apply this setting to.
* **toggle**: A boolean value where `true` allows the rear doors to open upon explosion, and `false` prevents them from opening.
## Return value
This native does not return any value.
## Examples
```lua
-- This example disables the rear doors of the vehicle from opening upon explosion
-- Retrieve the vehicle the player is currently in
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
-- Check if the vehicle exists
if not DoesEntityExist(vehicle) then return end
-- Retrieve the model of the vehicle
local modelVehicle = GetEntityModel(vehicle)
-- Check if the vehicle is a Stockade
if (modelVehicle == GetHashKey("stockade")) then
-- Disable the rear doors from opening upon explosion
SetOpenRearDoorsOnExplosion(vehicle, true)
end
```

```js
// This example disables the rear doors of the vehicle from opening upon explosion

// Retrieve the vehicle the player is currently in
const vehicle = GetVehiclePedIsIn(PlayerPedId(), false);

// Check if the vehicle exists
if (!DoesEntityExist(vehicle)) return;

// Retrieve the model of the vehicle
const modelVehicle = GetEntityModel(vehicle);

// Check if the vehicle is a Stockade
if (modelVehicle === GetHashKey("stockade")) {
// Disable the rear doors from opening upon explosion
SetOpenRearDoorsOnExplosion(vehicle, true);
}
```

```cs
using static CitizenFX.Core.Native.API;
// This example disables the rear doors of the vehicle from opening upon explosion
// Retrieve the vehicle the player is currently in
Vehicle vehicle = GetVehiclePedIsIn(PlayerPedId(), false);

// Check if the vehicle exists
if (!DoesEntityExist(vehicle)) return;

// Retrieve the model of the vehicle
uint modelVehicle = (uint)GetEntityModel(vehicle);

// Check if the vehicle is a Stockade
if (modelVehicle == (uint)GetHashKey("stockade")) {
// Disable the rear doors from opening upon explosion
SetOpenRearDoorsOnExplosion(vehicle, true);
}
```
44 changes: 44 additions & 0 deletions VEHICLE/SetPlaneSectionDamageScale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
ns: VEHICLE
aliases: ["0x0BBB9A7A8FFE931B"]
---
## SET_PLANE_SECTION_DAMAGE_SCALE

```c
// 0x0BBB9A7A8FFE931B
void SET_PLANE_SECTION_DAMAGE_SCALE(Vehicle vehicle, int damageSection, cs_type(Any) float damageScale);
```
Adjusts the scale of damage applied to a specified section of a plane.
In the decompiled scripts the `damageScale` is always set to `0f` (maybe to disable damages on the specified section)
```c
enum PLANE_DAMAGE_SECTION {
WING_L = 0,
WING_R = 1,
TAIL = 2,
ENGINE_L = 3,
ENGINE_R = 4,
ELEVATOR_L = 5,
ELEVATOR_R = 6,
AILERON_L = 7,
AILERON_R = 8,
RUDDER = 9,
RUDDER_2 = 10,
AIRBRAKE_L = 11,
AIRBRAKE_R = 12
}
```

```
NativeDB Introduced: v1290
```

## Parameters
* **vehicle**: Plane to which the damage scale adjustment will be applied.
* **damageSection**: Specific section of the plane, as defined in the `PLANE_DAMAGE_SECTION` enum, where the damage scale will be adjusted.
* **damageScale**: A float value representing the scale of damage to be applied to the specified section.

## Return value

This native does not return any value.

0 comments on commit dd0fba1

Please sign in to comment.