Native referenceFiveM

DELETE_ENTITY

0xAE3CBE5BF394C9C9 ENTITY
FUNCTION SIGNATURE
void DELETE_ENTITY(Entity* entity);
Property Value
Native Name DELETE_ENTITY
Hash 0xAE3CBE5BF394C9C9
Return Type void
Parameters entity (Entity*)

Description: Delete the specified entity, and invalidate the passed handle (i.e., the in/out argument). You might want to check if the entity exists before with DOES_ENTITY_EXIST.

Parameters

  • entity (Entity*) — The entity to delete.

Examples

-- Retrieve the vehicle the player is currently in. 
local vehicle = GetVehiclePedIsIn(PlayerPedId(), 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

-- If the vehicle does exist, delete the vehicle entity from the game world.
DeleteEntity(vehicle)
// Retrieve the vehicle the player is currently in.
const vehicle = GetVehiclePedIsIn(PlayerPedId(), 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;
}

// If the vehicle does exist, delete the vehicle entity from the game world.
DeleteEntity(vehicle);
using static CitizenFX.Core.Native.API;

// Retrieve the vehicle the player is currently in.
int vehicleHandle = GetVehiclePedIsIn(PlayerPedId(), false);

// Check if the vehicle exists in the game world.
if (!DoesEntityExist(vehicleHandle))
{
    // If the vehicle does not exist, end the execution of the code here.
    return;
}

// If the vehicle does exist, delete the vehicle entity from the game world.
DeleteEntity(ref vehicleHandle);
Back to ENTITY