From 20f503d54ba16fcac3507ee2b2f57017675ab870 Mon Sep 17 00:00:00 2001 From: Space V <40030799+ahcenezdh@users.noreply.github.com> Date: Fri, 22 Dec 2023 01:53:28 +0100 Subject: [PATCH] feat(natives/vehicle): update vehicle natives - Part 2/4 (#951) * feat(natives/vehicle): update vehicle natives * Update GetIsBoatCapsized.md Usually, there's no spaces between `## Examples` and the code blocks. --------- Co-authored-by: ammonia-cfx <38232208+4mmonium@users.noreply.github.com> --- VEHICLE/GetIsBoatCapsized.md | 121 ++++++++++++++++++++++++++++++++ VEHICLE/N_0x0a3f820a9a9a9ac5.md | 19 ----- VEHICLE/N_0xba91d045575699ad.md | 15 ---- VEHICLE/SetHeliCombatOffset.md | 22 ++++++ 4 files changed, 143 insertions(+), 34 deletions(-) create mode 100644 VEHICLE/GetIsBoatCapsized.md delete mode 100644 VEHICLE/N_0x0a3f820a9a9a9ac5.md delete mode 100644 VEHICLE/N_0xba91d045575699ad.md create mode 100644 VEHICLE/SetHeliCombatOffset.md diff --git a/VEHICLE/GetIsBoatCapsized.md b/VEHICLE/GetIsBoatCapsized.md new file mode 100644 index 000000000..aecfe5400 --- /dev/null +++ b/VEHICLE/GetIsBoatCapsized.md @@ -0,0 +1,121 @@ +--- +ns: VEHICLE +aliases: ["0xBA91D045575699AD"] +--- +## GET_IS_BOAT_CAPSIZED + +```c +// 0xBA91D045575699AD +BOOL GET_IS_BOAT_CAPSIZED(Vehicle vehicle); +``` + +Checks whether the specified boat vehicle is capsized, meaning it has overturned or is upside down in the water. + +## Parameters +* **vehicle**: The vehicle to check. This should be a boat-type vehicle. + +## Return value +Returns `true` if the specified boat is capsized, `false` otherwise. + +## Examples +```lua +-- This example checks if the player is in a boat and if the boat is capsized. + +-- Retrieve the LocalPlayer. +local playerPed = PlayerPedId() + +-- Retrieve the vehicle the player is in +local vehicle = GetVehiclePedIsIn(playerPed, false) + +-- Retrieve the model of the vehicle +local vehicleModel = GetEntityModel(vehicle) + +-- Check if the vehicle exists in the game world. +if not DoesEntityExist(vehicle) then + -- If the vehicle does not exist, end the execution of the code here. + return +end + +-- Check if the vehicle is a boat. +if not IsThisModelABoat(vehicleModel) then + -- If the vehicle is not a boat, end the execution of the code here. + return +end + +-- Check if the boat is capsized. +if GetIsBoatCapsized(vehicle) then + print("The boat is capsized!") +else + print("The boat is not capsized!") +end +``` + +```js +// This example checks if the player is in a boat and if the boat is capsized. + +// Retrieve the LocalPlayer. +const playerPed = PlayerPedId(); + +// Retrieve the vehicle the player is in +const vehicle = GetVehiclePedIsIn(playerPed, false); + +// Retrieve the model of the vehicle +const vehicleModel = GetEntityModel(vehicle); + +// Check if the vehicle exists in the game world. +if (!DoesEntityExist(vehicle)) { + // If the vehicle does not exist, end the execution of the code here. + return; +} + +// Check if the vehicle is a boat. +if (!IsThisModelABoat(vehicleModel)) { + // If the vehicle is not a boat, end the execution of the code here. + return; +} + +// Check if the boat is capsized +if (GetIsBoatCapsized(vehicle)) { + console.log("The boat is capsized!"); +} else { + console.log("The boat is not capsized!"); +} +``` + +```cs +// This example checks if the player is in a boat and if the boat is capsized. +using static CitizenFX.Core.Native.API; + +// Retrieve the LocalPlayer. +Ped playerPed = PlayerPedId(); + +// Retrieve the vehicle the player is in +Vehicle vehicle = GetVehiclePedIsIn(playerPed, false); + +// Retrieve the model of the vehicle +uint vehicleModel = (uint)GetEntityModel(vehicle); + +// Check if the vehicle exists in the game world. +if (!DoesEntityExist(vehicle)) +{ + // If the vehicle does not exist, end the execution of the code here. + return; +} + +// Check if the vehicle is a boat. +if (!IsThisModelABoat(vehicleModel)) +{ + // If the vehicle is not a boat, end the execution of the code here. + return; +} + +// Check if the boat is capsized +if (GetIsBoatCapsized(vehicle)) +{ + Debug.WriteLine("The boat is capsized!"); +} +else +{ + Debug.WriteLine("The boat is not capsized!"); +} +``` diff --git a/VEHICLE/N_0x0a3f820a9a9a9ac5.md b/VEHICLE/N_0x0a3f820a9a9a9ac5.md deleted file mode 100644 index 50e884726..000000000 --- a/VEHICLE/N_0x0a3f820a9a9a9ac5.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -ns: VEHICLE ---- -## _0x0A3F820A9A9A9AC5 - -```c -// 0x0A3F820A9A9A9AC5 -void _0x0A3F820A9A9A9AC5(Vehicle vehicle, float x, float y, float z); -``` - -``` -NativeDB Introduced: v1180 -``` - -## Parameters -* **vehicle**: -* **x**: -* **y**: -* **z**: diff --git a/VEHICLE/N_0xba91d045575699ad.md b/VEHICLE/N_0xba91d045575699ad.md deleted file mode 100644 index fb2a38150..000000000 --- a/VEHICLE/N_0xba91d045575699ad.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -ns: VEHICLE ---- -## _0xBA91D045575699AD - -```c -// 0xBA91D045575699AD -BOOL _0xBA91D045575699AD(Vehicle vehicle); -``` - - -## Parameters -* **vehicle**: - -## Return value diff --git a/VEHICLE/SetHeliCombatOffset.md b/VEHICLE/SetHeliCombatOffset.md new file mode 100644 index 000000000..cab595117 --- /dev/null +++ b/VEHICLE/SetHeliCombatOffset.md @@ -0,0 +1,22 @@ +--- +ns: VEHICLE +aliases: ["0x0A3F820A9A9A9AC5"] +--- +## SET_HELI_COMBAT_OFFSET + +```c +// 0x0A3F820A9A9A9AC5 +void SET_HELI_COMBAT_OFFSET(Vehicle vehicle, float x, float y, float z); +``` + +Set a specific offset for helis chasing target in combat + +``` +NativeDB Introduced: v1180 +``` + +## Parameters +* **vehicle**: Helicopter for which the combat offset is being set. +* **x**: Offset along the X-axis (left/right) relative to the helicopter's current position and orientation +* **y**: Offset along the Y-axis (forward/backward) relative to the helicopter's current position and orientation +* **z**: Offset along the Z-axis (up/down) relative to the helicopter's current position and orientation.