Native referenceFiveM

DOES_ENTITY_EXIST

0x7239B21A38F536BA ENTITY
FUNCTION SIGNATURE
BOOL DOES_ENTITY_EXIST(Entity entity);
Property Value
Native Name DOES_ENTITY_EXIST
Hash 0x7239B21A38F536BA
Return Type BOOL
Parameters entity (Entity)

Description: Checks whether an entity exists in the game world.

Parameters

  • entity (Entity) — The entity to check if it exists.

Examples

local currentVehicle = GetVehiclePedIsIn(PlayerPedId(), false)

if DoesEntityExist(currentVehicle) then
    DeleteEntity(currentVehicle)
end
const currentVehicle = GetVehiclePedIsIn(PlayerPedId(), false);

if (DoesEntityExist(currentVehicle)) {
  DeleteEntity(currentVehicle);
}
using static CitizenFX.Core.Native.API
// ...

int currentVehicle = GetVehiclePedIsIn(PlayerPedId(), false);

if(DoesEntityExist(currentVehicle))
{
    DeleteEntity(currentVehicle);
}

// or the preferred use of C# wrapper
Vehicle currentVehicle = Game.PlayerPed.CurrentVehicle;

// DoesEntityExist already invoked using Game.PlayerPed.CurrentVehicle
if(currentVehicle != null)
{
    currentVehicle.Delete();
}
Back to ENTITY