|
| 1 | +--- |
| 2 | +ns: VEHICLE |
| 3 | +aliases: ["0xF78F94D60248C737"] |
| 4 | +--- |
| 5 | +## ARE_PLANE_CONTROL_PANELS_INTACT |
| 6 | + |
| 7 | +```c |
| 8 | +// 0xF78F94D60248C737 0x3B51B348 |
| 9 | +BOOL ARE_PLANE_CONTROL_PANELS_INTACT(Vehicle vehicle, BOOL checkForZeroHealth); |
| 10 | +``` |
| 11 | +
|
| 12 | +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. |
| 13 | +
|
| 14 | +## Parameters |
| 15 | +* **vehicle**: The vehicle to check. This should be a plane. |
| 16 | +* **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. |
| 17 | +
|
| 18 | +## Return value |
| 19 | +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`). |
| 20 | +
|
| 21 | +## Examples |
| 22 | +```lua |
| 23 | +-- Retrieve the player ped |
| 24 | +local playerPed = PlayerPedId() |
| 25 | +
|
| 26 | +-- Retrieve the plane the player is currently in. |
| 27 | +local plane = GetVehiclePedIsIn(playerPed, false) |
| 28 | +
|
| 29 | +-- If the player is not in a plane, return |
| 30 | +if (plane == 0) or (not IsThisModelAPlane(GetEntityModel(plane))) then return end |
| 31 | +
|
| 32 | +-- Check if the plane's control panels are intact |
| 33 | +local controlPanelsIntact = ArePlaneControlPanelsIntact(plane, true) |
| 34 | +
|
| 35 | +if (controlPanelsIntact) then |
| 36 | + print("The plane's control panels are intact") |
| 37 | +else |
| 38 | + print("The plane's control panels are damaged or the plane is destroyed") |
| 39 | +end |
| 40 | +``` |
| 41 | + |
| 42 | +```javascript |
| 43 | +// Retrieve the player ped |
| 44 | +const playerPed = PlayerPedId(); |
| 45 | + |
| 46 | +// Retrieve the plane the player is currently in. |
| 47 | +const plane = GetVehiclePedIsIn(playerPed, false); |
| 48 | + |
| 49 | +// If the player is not in a plane, return |
| 50 | +if (plane === 0 || !IsThisModelAPlane(GetEntityModel(plane))) return; |
| 51 | + |
| 52 | +// Check if the plane's control panels are intact |
| 53 | +const controlPanelsIntact = ArePlaneControlPanelsIntact(plane, true); |
| 54 | + |
| 55 | +if (controlPanelsIntact) { |
| 56 | + console.log("The plane's control panels are intact"); |
| 57 | +} else { |
| 58 | + console.log("The plane's control panels are damaged or the plane is destroyed"); |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +```csharp |
| 63 | +using static CitizenFX.Core.Native.API; |
| 64 | + |
| 65 | +// Retrieve the player ped |
| 66 | +Ped playerPed = PlayerPedId(); |
| 67 | + |
| 68 | +// Retrieve the plane the player is currently flying |
| 69 | +Vehicle plane = GetVehiclePedIsIn(playerPed, false); |
| 70 | + |
| 71 | +// If the player is not flying a plane, return |
| 72 | +if (plane == 0 || !IsThisModelAPlane(GetEntityModel(plane))) return; |
| 73 | + |
| 74 | +// Check if the plane's control panels are intact |
| 75 | +bool controlPanelsIntact = ArePlaneControlPanelsIntact(plane, true); |
| 76 | + |
| 77 | +if (controlPanelsIntact) { |
| 78 | + Debug.WriteLine("The plane's control panels are intact"); |
| 79 | +} else { |
| 80 | + Debug.WriteLine("The plane's control panels are damaged or the plane is destroyed"); |
| 81 | +} |
| 82 | +``` |
0 commit comments