Hello, I expose you my problem I arrive with success to make my object Spawn, Unfortunately impossible to remove it, I see unfortunately where is the error, then if people will not help me this would be a grade helped!
~~Google Translate
Code
function greenscreen_props_weazel_news() -- GetHashKey("prop_ld_greenscreen_01")
local mePed = GetPlayerPed(-1)
local pos = GetOffsetFromEntityInWorldCoords(mePed, 0.0, 0.2, 0.0)
local cone = GetClosestObjectOfType( pos.x, pos.y, pos.z, 1.0, GetHashKey("prop_ld_greenscreen_01"), false, false, false)
if cone ~= 0 then
-- ... /!\
NetworkRequestControlOfEntity(cone)
Citizen.InvokeNative(0xB736A491E64A32CF, Citizen.PointerValueIntInitialized(cone))
Citizen.InvokeNative(0x539E0AE3E6634B9F, Citizen.PointerValueIntInitialized(cone))
DeleteObject(cone)
SetEntityCoords(cone, -2000.0, -2000.0, -2000.0)
else
local h = GetEntityHeading(mePed)
local object = CreateObject("prop_ld_greenscreen_01", pos.x, pos.y, pos.z, GetEntityHeading(mePed), true, false)
local id = NetworkGetNetworkIdFromEntity(object)
SetNetworkIdCanMigrate(id, true)
PlaceObjectOnGroundProperly(object)
SetEntityDynamic(object , true)
SetEntityInvincible(object , false)
SetEntityCanBeDamaged(object , true)
SetEntityHealth(object , 1000)
SetEntityHasGravity(object , true)
SetEntityAsMissionEntity(object, true, true)
SetEntityLoadCollisionFlag(object , true)
SetEntityRecordsCollisions(object , true)
end
end