CanCargobobPickUpEntity
Docslocal retval = CanCargobobPickUpEntity(cargobob, entity)Description
Determines whether the specified Cargobob can pick up a given entity.
Parameters
| Name | Type | Description |
|---|---|---|
cargobob | Vehicle | The Cargobob helicopter to be checked. |
entity | Entity | The entity to be checked for pick-up. |
Quick Snippet: Get Vehiclecargobob
cargobobUse this to get the current vehicle handle for this native.
-- Get the vehicle the player is currently in
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= 0 then
print("Vehicle handle: " .. vehicle)
print("Model: " .. GetEntityModel(vehicle))
else
print("Player is not in a vehicle")
endQuick Snippet: Get Entityentity
entityUse this to obtain an entity handle from the player's aim or crosshair.
-- Get the entity the player is aiming at
local ped = PlayerPedId()
local hit, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
if hit and entity ~= 0 then
print("Entity: " .. entity)
print("Model: " .. GetEntityModel(entity))
print("Type: " .. GetEntityType(entity)) -- 1=Ped, 2=Vehicle, 3=Object
endVehicle Models

adder
alpha
blade
ardent
asea
cogcabrio
baller
blistaReturns
BOOLReturns TRUE (1) or FALSE (0).
Examples
Official
-- 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