Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(natives/vehicle): update vehicle natives - Part 2/4 #951

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading