DeleteObject
Docslocal object = DeleteObject()Description
Introduced in build 323
Deletes the specified object.
Note: If for some reason the entity won't delete, you might want to check if the object is a mission entity.
Parameters
| Name | Type | Description |
|---|---|---|
object | Object* | The object you want to delete. |
Returns
voidThis native does not return a value.
Examples
Official
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local objectHash = GetHashKey("v_ret_gc_chair03")
local object = GetClosestObjectOfType(playerCoords, 10.0, objectHash, true, false, false)
if object == 0 then return end
-- If the object is a mission entity, we have to set it to false. Otherwise, it won't be possible to delete the object.
if IsEntityAMissionEntity(object) then
SetEntityAsMissionEntity(object, false, true)
end
DeleteObject(object)