Hi, how do you remove an object you spawn via CreateObject()
function?
I have tried SetObjectAsNoLongerNeeded(), DeleteEntity(), RemoveForcedObject(), DeleteObject()
,
but nothing seems to work…
How are you removing it exactly. Send us your code.
Currently it looks like this
Citizen.CreateThread(function()
Citizen.Wait(0)
local HashKey = GetHashKey("prop_cons_crate")
local SpawnObject = CreateObject(HashKey, 822.921, -995.976, 25.589)
PlaceObjectOnGroundProperly(SpawnObject)
Wait(math.ceil(10000))
DeleteObject(SpawnObject)
end)
Goal is to spawn an object at a dropoff location on keypress. Which then gets deleted after x time
You have to use SetEntityAsMissionEntity if you want to delete an object
Okay so, I changed nothing and now it deletes without any problems…
Thanks for the hint though, will keep that in mind if it breaks again!
Btw, is there a “visual” list of all the prop (web site, ressource), then i don’t have to spawn them one by one when looking for something?
I didn’t find any, and I don’t think many wants to create one either considering the amount of props existing ^^,
Hello I have been looking for a mod menu or some code or something to be able to spawn objects on the map either conos cans suitcases fences fences everything I want for my movie server but I do not know how to do it can help me? I’m a little green on this command thanks
There’s a solid function in Cops_FiveM for props placement
To okey and in the line of code I put all the names of the objects that I want?
http://objects.codeshock.hu/gallery.php
There you go!
It doesn’t contain every prop, but many of them
Just browsing and saw this, so glad i looked now! Been looking for something like this for ages.
You have the code right there…?
local prophash = GetHashKey(‘propname’)
local prophash2 = GetHashKey(‘propname2’)
Request said props
spawn said props
Add said props to array
And please don’t spam… @name to notify instead.
@itshb
ho sorry thanks
Thank you very much for the help I feel the spam is not even as well as the forum hehe hehe
How are you spawning the object?
You are spawning with worldZ, change that to offset.z+20
I have tried it and it worked perfectly. You saved my life many thanks: D
Hi I have spawnear like 7 different objects and it goes great. But now I have a problem and it’s just let me spawn about 25 objects in total the same or different. I would like to know if you could help me with this since you understand a lot more than I do codes. Many thanks in advance: D
Atleast try and read the code please…
if(#propslist < config.propsSpawnLimitByCop) then
“propsSpawnLimitByCop = 20”
@itshb
Friend this does not work in any way, I have tried it in 4 different ways now I send you the 4 codes that have not worked for me