-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(natives/vehicle): update body damage vehicles natives (#1066)
* feat(natives/vehicle): update body damage vehicles natives * Update SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE * Update SET_DISABLE_EXPLODE_FROM_BODY_DAMAGE_ON_COLLISION * Update SetDisableExplodeFromBodyDamageOnCollision.md Capitalize `bool` parameter. * Update SetDisableHeliExplodeFromBodyDamage.md Capitalize `bool` parameter. * Update SetDisableExplodeFromBodyDamageOnCollision.md --------- Co-authored-by: ammonia-cfx <[email protected]>
- Loading branch information
Showing
4 changed files
with
123 additions
and
32 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
ns: VEHICLE | ||
aliases: ["0x26E13D440E7F6064"] | ||
--- | ||
## SET_DISABLE_EXPLODE_FROM_BODY_DAMAGE_ON_COLLISION | ||
|
||
```c | ||
// 0x26E13D440E7F6064 | ||
void SET_DISABLE_EXPLODE_FROM_BODY_DAMAGE_ON_COLLISION(Vehicle vehicle, cs_type(float) BOOL disableExplode); | ||
``` | ||
Prevents a vehicle from exploding upon sustaining body damage from physical collisions. This can be used to increase the durability of vehicles in high-impact scenarios, such as races or combat situations, by preventing them from being destroyed due to collision-induced body damage. | ||
For helicopters, you might want to check [`SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE`](#_0xEDBC8405B3895CC9) instead. | ||
``` | ||
NativeDB Introduced: v1290 | ||
``` | ||
## Parameters | ||
* **vehicle**: The vehicle to apply this setting to. | ||
* **disableExplode**: `true` to disable explosion from body damage on collision; `false` to allow explosions as normal. | ||
## Examples | ||
```lua | ||
-- Retrieve the player ped | ||
local playerPed = PlayerPedId() | ||
-- Retrieve the vehicle the player is currently in | ||
local vehicle = GetVehiclePedIsIn(playerPed, false) | ||
-- Disable explosion from body damage on collision for the vehicle | ||
SetDisableExplodeFromBodyDamageOnCollision(vehicle, true) | ||
``` | ||
|
||
```javascript | ||
// Retrieve the player ped | ||
const playerPed = PlayerPedId(); | ||
|
||
// Retrieve the vehicle the player is currently in | ||
const vehicle = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// Disable explosion from body damage on collision for the vehicle | ||
SetDisableExplodeFromBodyDamageOnCollision(vehicle, true); | ||
``` | ||
|
||
```csharp | ||
using static CitizenFX.Core.Native.API; | ||
|
||
// Retrieve the player ped | ||
Ped playerPed = PlayerPedId(); | ||
|
||
// Retrieve the vehicle the player is currently in | ||
Vehicle vehicle = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// Disable explosion from body damage on collision for the vehicle | ||
SetDisableExplodeFromBodyDamageOnCollision(vehicle, true); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
ns: VEHICLE | ||
aliases: ["0xEDBC8405B3895CC9"] | ||
--- | ||
## SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE | ||
|
||
```c | ||
// 0xEDBC8405B3895CC9 | ||
void SET_DISABLE_HELI_EXPLODE_FROM_BODY_DAMAGE(Vehicle helicopter, cs_type(Any) BOOL disableExplode); | ||
``` | ||
Prevents a helicopter from exploding due to relatively minor body damage. This native can be particularly useful in gameplay scenarios or missions where helicopters are subject to damage that would not realistically cause an explosion, ensuring they remain operational unless subjected to more significant damage. | ||
``` | ||
NativeDB Introduced: v1103 | ||
``` | ||
## Parameters | ||
* **helicopter**: The helicopter to apply this setting to. | ||
* **disableExplode**: `true` to disable explosion from body damage on collision; `false` to allow explosions as normal. | ||
## Examples | ||
```lua | ||
-- Retrieve the player ped. | ||
local playerPed = PlayerPedId() | ||
-- Retrieve the helicopter the player is currently in. | ||
local helicopter = GetVehiclePedIsIn(playerPed, false) | ||
-- If the player is not in a helicopter, or the vehicle is not a helicopter, return. | ||
if (helicopter == 0) or (not IsThisModelAHeli(GetEntityModel(helicopter))) then return end | ||
-- Disable explosion from body damage for the helicopter. | ||
SetDisableHeliExplodeFromBodyDamage(helicopter, true) | ||
``` | ||
|
||
```javascript | ||
// Retrieve the player ped. | ||
const playerPed = PlayerPedId(); | ||
|
||
// Retrieve the helicopter the player is currently in. | ||
const helicopter = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// If the player is not in a helicopter, or the vehicle is not a helicopter, return. | ||
if (helicopter === 0 || !IsThisModelAHeli(GetEntityModel(helicopter))) return; | ||
|
||
// Disable explosion from body damage for the helicopter. | ||
SetDisableHeliExplodeFromBodyDamage(helicopter, true); | ||
``` | ||
|
||
```csharp | ||
using static CitizenFX.Core.Native.API; | ||
|
||
// Retrieve the player ped. | ||
Ped playerPed = PlayerPedId(); | ||
|
||
// Retrieve the helicopter the player is currently in. | ||
Vehicle helicopter = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// If the player is not in a helicopter, or the vehicle is not a helicopter, return. | ||
if (helicopter == 0 || !IsThisModelAHeli(GetEntityModel(helicopter))) return; | ||
|
||
// Disable explosion from body damage for the helicopter. | ||
SetDisableHeliExplodeFromBodyDamage(helicopter, true); | ||
``` |