Any scripts, that can add props

Hello out there,

I am currently working on redesign some places with some extra objects.

  • But i dont want to make a whole new ymap for this.

So my question is.

  • Is there any scripts, that I can use to add props / objects where I want, by adding some lines of code that will spawn the objects on start or do anyone know how to script something like this.

That would just be amazing.

Thanks.

You can basicly add a prop with CreateObject(https://runtime.fivem.net/doc/natives/#_0x509D5878EB39E842).

But I don’t think there’s any tool to generate a script with all your objects. If you aren’t familiar with scripting, I suggest you to use ymap

I am kindda familiar with scripting, but just this problem doesn’t seems to be fixed.
I could use a ymap, but we are only talking about 10 chairs for now, which is kindda overkill to use a ymap for, and it would be easier later to add more, if you just add another line.

But thanks for the respons, I will look into it. :slight_smile:

local Objects = {
    { ["x"] = 100.0, ["y"] = 100.0, ["z"] = 100.0, ["h"] = 69.0, ["model"] = "prop_chair_08" },
    { ["x"] = 100.0, ["y"] = 100.0, ["z"] = 100.0, ["h"] = 69.0, ["model"] = "prop_chair_08" },
    { ["x"] = 100.0, ["y"] = 100.0, ["z"] = 100.0, ["h"] = 69.0, ["model"] = "prop_chair_08" },
    { ["x"] = 100.0, ["y"] = 100.0, ["z"] = 100.0, ["h"] = 69.0, ["model"] = "prop_chair_08" },
    { ["x"] = 100.0, ["y"] = 100.0, ["z"] = 100.0, ["h"] = 69.0, ["model"] = "prop_chair_08" },
    { ["x"] = 100.0, ["y"] = 100.0, ["z"] = 100.0, ["h"] = 69.0, ["model"] = "prop_chair_08" },
    { ["x"] = 100.0, ["y"] = 100.0, ["z"] = 100.0, ["h"] = 69.0, ["model"] = "prop_chair_08" }
}

Citizen.CreateThread(function()
    for i = 1, #Objects, 1 do
        while not HasModelLoaded(GetHashKey(Objects[i]["model"])) do
            RequestModel(GetHashKey(Objects[i]["model"]))

            Citizen.Wait(5)
        end

        Objects[i]["objectId"] = CreateObject(GetHashKey(Objects[i]["model"]), Objects[i]["x"], Objects[i]["y"], Objects[i]["z"], false)

        PlaceObjectOnGroundProperly(Objects[i]["objectId"])
        SetEntityHeading(Objects[i]["objectId"], Objects[i]["h"])
        FreezeEntityPosition(Objects[i]["objectId"], true)
        SetEntityAsMissionEntity(Objects[i]["objectId"], true, true)
    end

    print("Spawned Chairs!")
end)

This could be what you’re looking for. This is untested as i just wrote this here. Tell me if its not working.

4 Likes

Wauw, thanks.
I will try it out as soon as possible. The server is currently full of players. So cant test it.

You will need to edit coords and heading as you see. And model if you would like.

Yup, of course. :slight_smile:

So I have tried your code-snippet now.
And it doesn’t seems to work. Sadly.

Maybe I am doing something wrong.
I have made a folder called props . Added start props to server.cfg in that folder i have a _resource.lua in that lua file I have added following code:

resource_manifest_version ‘77731fab-63ca-442c-a67b-abc70f28dfa5’

client_script ‘prop.lua’

Which should be enough. I added your code-snippet in the prop.lua file.

So if I did everything right, it does not work.

But thanks for trying. :slight_smile:

Any error in your client log?

resource_manifest_version ‘77731fab-63ca-442c-a67b-abc70f28dfa5’

You got the wrong manifest_version…

resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937"

Try changing to this, and say if you get error.

1 Like

No, didn’t get any errors.

I will try it out tomorrow. Will get back if is works or not. :slight_smile:

Good news my friend.

  • It is working like i wanted to.
    Thanks alot for the help.

And how can I eliminate the prop later, is that I need the player to interact with the prop so that the prop disappears, sorry for my bad English and thanks