-
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 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 <[email protected]>
- Loading branch information
Showing
4 changed files
with
143 additions
and
34 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,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!"); | ||
} | ||
``` |
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,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. |