Skip to content

Commit

Permalink
feat(natives/vehicle): update no named natives (#1067)
Browse files Browse the repository at this point in the history
* feat(natives/vehicle): update no named natives

* Update ARE_PLANE_CONTROL_PANELS_INTACT
* Update SET_DISABLE_BMX_EXTRA_TRICK_FORCES

* Update ArePlaneControlPanelsIntact.md

Nitpick: Remove extra new line in js codeblock

---------

Co-authored-by: ammonia-cfx <[email protected]>
  • Loading branch information
spacevx and 4mmonium authored Mar 18, 2024
1 parent db936d1 commit e2a25db
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 30 deletions.
82 changes: 82 additions & 0 deletions VEHICLE/ArePlaneControlPanelsIntact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
ns: VEHICLE
aliases: ["0xF78F94D60248C737"]
---
## ARE_PLANE_CONTROL_PANELS_INTACT

```c
// 0xF78F94D60248C737 0x3B51B348
BOOL ARE_PLANE_CONTROL_PANELS_INTACT(Vehicle vehicle, BOOL checkForZeroHealth);
```
Queries whether the control panels of a plane are intact. This native is used to determine the operational status of a plane's cockpit controls, which can affect the plane's flyability.
## Parameters
* **vehicle**: The vehicle to check. This should be a plane.
* **checkForZeroHealth**: If set to `true`, the native also checks if the plane's health is zero, indicating it is completely destroyed. If `false`, only the state of the control panels is considered.
## Return value
Returns `true` if the plane's control panels are intact, and, depending on the `checkForZeroHealth` parameter, the plane is not completely destroyed. Returns `false` if the control panels are damaged or the plane is destroyed (when `checkForZeroHealth` is `true`).
## Examples
```lua
-- Retrieve the player ped
local playerPed = PlayerPedId()
-- Retrieve the plane the player is currently in.
local plane = GetVehiclePedIsIn(playerPed, false)
-- If the player is not in a plane, return
if (plane == 0) or (not IsThisModelAPlane(GetEntityModel(plane))) then return end
-- Check if the plane's control panels are intact
local controlPanelsIntact = ArePlaneControlPanelsIntact(plane, true)
if (controlPanelsIntact) then
print("The plane's control panels are intact")
else
print("The plane's control panels are damaged or the plane is destroyed")
end
```

```javascript
// Retrieve the player ped
const playerPed = PlayerPedId();

// Retrieve the plane the player is currently in.
const plane = GetVehiclePedIsIn(playerPed, false);

// If the player is not in a plane, return
if (plane === 0 || !IsThisModelAPlane(GetEntityModel(plane))) return;

// Check if the plane's control panels are intact
const controlPanelsIntact = ArePlaneControlPanelsIntact(plane, true);

if (controlPanelsIntact) {
console.log("The plane's control panels are intact");
} else {
console.log("The plane's control panels are damaged or the plane is destroyed");
}
```

```csharp
using static CitizenFX.Core.Native.API;

// Retrieve the player ped
Ped playerPed = PlayerPedId();

// Retrieve the plane the player is currently flying
Vehicle plane = GetVehiclePedIsIn(playerPed, false);

// If the player is not flying a plane, return
if (plane == 0 || !IsThisModelAPlane(GetEntityModel(plane))) return;

// Check if the plane's control panels are intact
bool controlPanelsIntact = ArePlaneControlPanelsIntact(plane, true);

if (controlPanelsIntact) {
Debug.WriteLine("The plane's control panels are intact");
} else {
Debug.WriteLine("The plane's control panels are damaged or the plane is destroyed");
}
```
14 changes: 0 additions & 14 deletions VEHICLE/N_0x26d99d5a82fd18e8.md

This file was deleted.

16 changes: 0 additions & 16 deletions VEHICLE/N_0xf78f94d60248c737.md

This file was deleted.

64 changes: 64 additions & 0 deletions VEHICLE/SetDisableBmxExtraTrickForces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
ns: VEHICLE
aliases: ["0x26D99D5A82FD18E8"]
---
## SET_DISABLE_BMX_EXTRA_TRICK_FORCES

```c
// 0x26D99D5A82FD18E8
void SET_DISABLE_BMX_EXTRA_TRICK_FORCES(cs_type(Any) BOOL disableExtraTrickForces);
```
Disables the additional physics forces applied to BMX bikes that enable them to perform tricks.
```
NativeDB Introduced: v463
```
## Parameters
* **disableExtraTrickForces**: Set to `true` to disable the extra forces applied for tricks on BMX bicycles, making the bike behave more like a regular bicycle without trick capabilities. Set to `false` to allow BMX bikes to perform tricks normally.
## Examples
```lua
-- Retrieve the player ped
local playerPed = PlayerPedId()
-- Retrieve the BMX bike the player is currently riding
local bmx = GetVehiclePedIsIn(playerPed, false)
-- If the player is not riding a BMX bike, return
if not IsThisModelABicycle(GetEntityModel(bmx)) then return end
-- Disable the extra forces applied to BMX bikes for tricks
SetDisableBmxExtraTrickForces(bmx, true)
```

```javascript
// Retrieve the player ped
const playerPed = PlayerPedId();

// Retrieve the BMX bike the player is currently riding
const bmx = GetVehiclePedIsIn(playerPed, false);

// If the player is not riding a BMX bike, return
if (!IsThisModelABicycle(GetEntityModel(bmx))) return;

// Disable the extra forces applied to BMX bikes for tricks
SetDisableBmxExtraTrickForces(bmx, true);
```

```csharp
using static CitizenFX.Core.Native.API;

// Retrieve the player ped
Ped playerPed = PlayerPedId();

// Retrieve the BMX bike the player is currently riding
Vehicle bmx = GetVehiclePedIsIn(playerPed, false);

// If the player is not riding a BMX bike, return
if (!IsThisModelABicycle(GetEntityModel(bmx))) return;

// Disable the extra forces applied to BMX bikes for tricks
SetDisableBmxExtraTrickForces(bmx, true);
```

0 comments on commit e2a25db

Please sign in to comment.