-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vehicle/cargobob): update natives for cargobob
- Loading branch information
Showing
7 changed files
with
406 additions
and
53 deletions.
There are no files selected for viewing
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,79 @@ | ||
--- | ||
ns: ENTITY | ||
aliases: ["0xD7B80E7C3BEFC396"] | ||
--- | ||
## SET_PICK_UP_BY_CARGOBOB_DISABLED | ||
|
||
```c | ||
// 0xD7B80E7C3BEFC396 | ||
void SET_PICK_UP_BY_CARGOBOB_DISABLED(Entity entity, cs_type(Any) BOOL toggle); | ||
``` | ||
Configures an entity to either allow or prevent it from being picked up by Cargobobs. | ||
``` | ||
NativeDB Introduced: v1180 | ||
``` | ||
## Parameters | ||
* **entity**: The entity to be configured for pick up by Cargobob. | ||
* **toggle**: A boolean value where `true` prevents the entity from being picked up by Cargobobs, and `false` allows it. | ||
## Examples | ||
```lua | ||
-- This example prevents a entity (in this example the vehicle of the player) from being picked up by any Cargobobs. | ||
-- Retrieve the player ped | ||
local playerPed = PlayerPedId() | ||
-- Retrieve the player's vehicle (cargobob) | ||
local vehicle = GetVehiclePedIsIn(playerPed, false) | ||
-- 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 | ||
-- Prevent the vehicle from being picked up by Cargobobs. | ||
SetPickUpByCargobobDisabled(vehicle, true) | ||
``` | ||
|
||
```js | ||
// This example prevents a entity (in this example the vehicle of the player) from being picked up by any Cargobobs. | ||
|
||
// Retrieve the player ped. | ||
const playerPed = PlayerPedId(); | ||
|
||
// Retrieve the player's vehicle. | ||
const vehicle = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// 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; | ||
} | ||
|
||
// Prevent the vehicle from being picked up by Cargobobs. | ||
SetPickUpByCargobobDisabled(vehicle, true); | ||
``` | ||
|
||
```cs | ||
// This example prevents a entity (in this example the vehicle of the player) from being picked up by any Cargobobs. | ||
using static CitizenFX.Core.Native.API; | ||
|
||
// Retrieve the player ped. | ||
Ped playerPed = PlayerPedId(); | ||
|
||
// Retrieve the player's vehicle. | ||
Vehicle vehicle = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// 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; | ||
} | ||
|
||
// Prevent the vehicle from being picked up by Cargobobs. | ||
SetPickUpByCargobobDisabled(vehicle, true); | ||
``` |
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,118 @@ | ||
--- | ||
ns: VEHICLE | ||
aliases: ["0x2C1D8B3B19E517CC"] | ||
--- | ||
## CAN_CARGOBOB_PICK_UP_ENTITY | ||
|
||
```c | ||
// 0x2C1D8B3B19E517CC | ||
cs_type(Any) BOOL CAN_CARGOBOB_PICK_UP_ENTITY(Vehicle cargobob, Entity entity); | ||
``` | ||
Determines whether the specified Cargobob can pick up a given entity. | ||
## Parameters | ||
* **cargobob**: The Cargobob helicopter to be checked. | ||
* **entity**: The entity to be checked for pick-up. | ||
## Return value | ||
Returns `true` if the Cargobob can pick up the specified entity, `false` otherwise. | ||
## Examples | ||
```lua | ||
-- This example checks if the player is in a Cargobob and if the Cargobob can pick up the specified entity. | ||
-- Retrieve the player ped. | ||
local playerPed = PlayerPedId() | ||
-- Retrieve the player's vehicle (cargobob). | ||
local cargobob = GetVehiclePedIsIn(playerPed, false) | ||
-- Retrieve the model hash of the cargobob. | ||
local model = GetEntityModel(cargobob) | ||
-- Check if the vehicle exists and if it's a Cargobob. If not, terminate the script. | ||
if not DoesEntityExist(cargobob) or GetHashKey("cargobob") ~= model then | ||
return | ||
end | ||
local entityID = 15362 -- The entity you want to check if the Cargobob can pick up (this is a random entity ID). | ||
-- Check if the entity exists. If not, terminate the script. | ||
if not DoesEntityExist(entityID) then | ||
return | ||
end | ||
-- Check if the Cargobob can pick up the specified entity. | ||
if CanCargobobPickUpEntity(vehicle, entityID) then | ||
print("Cargobob can pick up the specified entity") | ||
else | ||
print("Cargobob can't pick up the specified entity") | ||
end | ||
``` | ||
|
||
```js | ||
// This example checks if the player is in a Cargobob and if the Cargobob can pick up the specified entity. | ||
|
||
// Retrieve the player ped. | ||
const playerPed = PlayerPedId(); | ||
|
||
// Retrieve the player's vehicle (cargobob). | ||
const cargobob = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// Retrieve the model hash of the cargobob. | ||
const model = GetEntityModel(cargobob); | ||
|
||
// Check if the vehicle exists and if it's a Cargobob. If not, terminate the script. | ||
if (!DoesEntityExist(cargobob) || GetHashKey("cargobob") !== model) { | ||
return; | ||
} | ||
|
||
const entityID = 15362; // The entity you want to check if the Cargobob can pick up (this is a random entity ID). | ||
|
||
// Check if the entity exists. If not, terminate the script. | ||
if (!DoesEntityExist(entityID)) { | ||
return; | ||
} | ||
|
||
// Check if the Cargobob can pick up the specified entity. | ||
if (CanCargobobPickUpEntity(vehicle, entityID)) { | ||
console.log("Cargobob can pick up the specified entity"); | ||
} else { | ||
console.log("Cargobob can't pick up the specified entity"); | ||
} | ||
``` | ||
|
||
```cs | ||
// This example checks if the player is in a Cargobob and if the Cargobob can pick up the specified entity. | ||
using static CitizenFX.Core.Native.API; | ||
|
||
// Retrieve the player ped. | ||
Ped playerPed = PlayerPedId(); | ||
|
||
// Retrieve the player's vehicle (cargobob). | ||
Vehicle cargobob = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// Retrieve the model hash of the cargobob. | ||
uint model = GetEntityModel(cargobob); | ||
|
||
// Check if the vehicle exists and if it's a Cargobob. If not, terminate the script. | ||
if (!DoesEntityExist(cargobob) || (uint)GetHashKey("cargobob") != model) { | ||
return; | ||
} | ||
|
||
int entityID = 15362; // The entity you want to check if the Cargobob can pick up (this is a random entity ID). | ||
// Check if the entity exists. If not, terminate the script. | ||
if (!DoesEntityExist(entityID)) { | ||
return; | ||
} | ||
|
||
// Check if the Cargobob can pick up the specified entity. | ||
if (CanCargobobPickUpEntity(vehicle, entityID)) { | ||
Debug.WriteLine("Cargobob can pick up the specified entity"); | ||
} else { | ||
Debug.WriteLine("Cargobob can't pick up the specified entity"); | ||
} | ||
``` |
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 |
---|---|---|
@@ -1,16 +1,114 @@ | ||
--- | ||
ns: VEHICLE | ||
aliases: ["0xAF03011701811146"] | ||
aliases: ["0xAF03011701811146", "_DETACH_ENTITY_FROM_CARGOBOB"] | ||
--- | ||
## _DETACH_ENTITY_FROM_CARGOBOB | ||
## DETACH_ENTITY_FROM_CARGOBOB | ||
|
||
```c | ||
// 0xAF03011701811146 | ||
Any _DETACH_ENTITY_FROM_CARGOBOB(Vehicle vehicle, Entity entity); | ||
cs_type(Any) BOOL DETACH_ENTITY_FROM_CARGOBOB(Vehicle vehicle, Entity entity); | ||
``` | ||
Detaches the specified entity currently being carried by a Cargobob. | ||
## Parameters | ||
* **vehicle**: | ||
* **entity**: | ||
* **vehicle**: The Cargobob helicopter. | ||
* **entity**: The entity to be detached. | ||
## Return value | ||
This native returns `true` if the entity was successfully detached from the cargobob, `false` otherwise. | ||
## Examples | ||
```lua | ||
-- This example detaches a specific entity from a Cargobob. | ||
-- Retrieve the player ped. | ||
local playerPed = PlayerPedId() | ||
-- Retrieve the player's vehicle (cargobob). | ||
local cargobob = GetVehiclePedIsIn(playerPed, false) | ||
-- Retrieve the model hash of the cargobob. | ||
local cargobobModel = GetEntityModel(cargobob) | ||
-- Check if the vehicle exists and if it's a Cargobob. If not, terminate the script. | ||
if not DoesEntityExist(cargobob) or cargobobModel ~= GetHashKey("cargobob") then | ||
return | ||
end | ||
local entityID = 15362 -- The entity you want to detach from the Cargobob (this is a random entity ID). | ||
-- Check if the entity exists; if not, terminate the script. | ||
if not DoesEntityExist(yourEntity) then | ||
return | ||
end | ||
-- Detach the entity from the Cargobob. | ||
local result = DetachEntityFromCargobob(cargobob, entityID) | ||
-- Print the result to the console. | ||
print(result) | ||
``` | ||
|
||
```js | ||
// This example detaches a specific entity from a Cargobob. | ||
|
||
// Retrieve the player ped. | ||
const playerPed = PlayerPedId(); | ||
|
||
// Retrieve the player's vehicle. | ||
const cargobob = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// Retrieve the model hash of the cargobob. | ||
const cargobobModel = GetEntityModel(cargobob); | ||
|
||
// Check if the player is in a Cargobob and if the vehicle is a Cargobob; if not, terminate the script. | ||
if (!DoesEntityExist(cargobob) || cargobobModel !== GetHashKey("cargobob")) { | ||
return; | ||
} | ||
|
||
const entityID = 15362; // The entity you want to detach from the Cargobob (this is a random entity ID). | ||
|
||
// Check if the entity exists; if not, terminate the script. | ||
if (!DoesEntityExist(entityID)) { | ||
return; | ||
} | ||
|
||
// Detach the entity from the Cargobob. | ||
const result = DetachEntityFromCargobob(cargobob, entityID); | ||
|
||
// Print the result to the console. | ||
console.log(result); | ||
``` | ||
|
||
```cs | ||
using static CitizenFX.Core.Native.API; | ||
// This example detaches a specific entity from a Cargobob. | ||
// Retrieve the player ped. | ||
Ped playerPed = PlayerPedId(); | ||
|
||
// Retrieve the player's vehicle. | ||
Vehicle cargobob = GetVehiclePedIsIn(playerPed, false); | ||
|
||
// Retrieve the model hash of the cargobob. | ||
uint cargobobModel = (uint)GetEntityModel(cargobob); | ||
|
||
// Check if the player is in a Cargobob and if the vehicle is a Cargobob; if not, terminate the script. | ||
if (!DoesEntityExist(cargobob) || cargobobModel != (uint)GetHashKey("cargobob")) { | ||
return; | ||
} | ||
|
||
int entityID = 15362; // The entity you want to detach from the Cargobob (this is a random entity ID). | ||
// Check if the entity exists; if not, terminate the script. | ||
if (!DoesEntityExist(entityID)) { | ||
return; | ||
} | ||
|
||
// Detach the entity from the Cargobob. | ||
bool result = DetachEntityFromCargobob(cargobob, entityID); | ||
|
||
// Print the result to the console. | ||
Debug.WriteLine($"{result}"); | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.