Skip to content

Commit

Permalink
feat(natives/vehicle): update vehicle natives - Part 2/4 (#951)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
spacevx and 4mmonium authored Dec 22, 2023
1 parent f7b963b commit 20f503d
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 34 deletions.
121 changes: 121 additions & 0 deletions VEHICLE/GetIsBoatCapsized.md
Original file line number Diff line number Diff line change
@@ -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!");
}
```
19 changes: 0 additions & 19 deletions VEHICLE/N_0x0a3f820a9a9a9ac5.md

This file was deleted.

15 changes: 0 additions & 15 deletions VEHICLE/N_0xba91d045575699ad.md

This file was deleted.

22 changes: 22 additions & 0 deletions VEHICLE/SetHeliCombatOffset.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 20f503d

Please sign in to comment.