-
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 no named natives (#1067)
* 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
Showing
4 changed files
with
146 additions
and
30 deletions.
There are no files selected for viewing
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,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"); | ||
} | ||
``` |
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,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); | ||
``` |