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(vehicle/cargobob): update natives for cargobob #956

Merged
merged 2 commits into from
Apr 21, 2024
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
17 changes: 0 additions & 17 deletions ENTITY/N_0xd7b80e7c3befc396.md

This file was deleted.

79 changes: 79 additions & 0 deletions ENTITY/SetPickUpByCargobobDisabled.md
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);
```
118 changes: 118 additions & 0 deletions VEHICLE/CanCargobobPickUpEntity.md
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");
}
```
98 changes: 92 additions & 6 deletions VEHICLE/DetachEntityFromCargobob.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,102 @@
---
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);
Any 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.

## 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.
DetachEntityFromCargobob(cargobob, entityID)
```

```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);

## Return value
// 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.
DetachEntityFromCargobob(cargobob, entityID);
```

```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.
DetachEntityFromCargobob(cargobob, entityID);
```
15 changes: 0 additions & 15 deletions VEHICLE/N_0x1f34b0626c594380.md

This file was deleted.

16 changes: 0 additions & 16 deletions VEHICLE/N_0x2c1d8b3b19e517cc.md

This file was deleted.

Loading
Loading