[Release] Object Spawner

If you want to move the position of the menu spawn too in the ObjectSpawnerv2/client.lua at Line 10, add the position arguments. For example this is the bottom right

mainMenu = NativeUI.CreateMenu("Object Spawner", "~b~Select Your Object", 1425, 500)

this is it unedited

mainMenu = NativeUI.CreateMenu(Title, Subtitle, X, Y, TxtDictionary, TxtName)
1 Like

It would be nice to have this in a future update

That’s possible however I’m no longer doing development. Everything you need is there you just have to find it.

1 Like

I cant spawn any of the things it says:
You are not allowed to use this command!
What should i do??

Heya

So i have been customizing the script for my personal use really and added a few objects.
However i would love to have my civs playing it too!
But to add every single ped in the list is kinda to much for me.
How would i remove the ped restriction deal beacuse whenever i try removing checkpedrestriction and stuff like that the script just does not work. And i have been messing around for it just cannot get the hang of it.

Not a pro LUA scripter but i do have my things here and there.

    if CheckPedRestriction(GetLocalPed(), pedsList) then
        local obj = CreateObject(GetHashKey(objectname), x, y, z-1.90, true, true, true)
	    PlaceObjectOnGroundProperly(obj)
        SetEntityHeading(obj, heading)
        FreezeEntityPosition(obj, true)
    else
       TriggerEvent("chatMessage", "", {255,255,255}, "^1You are not allowed to use this command.")
    end

end

I know it is something in here but i just dunno how to safely remove the whole ped restriction without having the whole script broken…

Oh and @PolakenZigeuner
You need to be any of the peds that is in your pedlist. If not you cannot use the menu. :slight_smile:

Just remove the “CheckPedRestriction”.

 local obj = CreateObject(GetHashKey(objectname), x, y, z-1.90, true, true, true)
	    PlaceObjectOnGroundProperly(obj)
        SetEntityHeading(obj, heading)
        FreezeEntityPosition(obj, true)

How do I open the menu?

Did it broke the menu somehow…

Something might be broken in this menu. I added it to my server, pressed all keys on my keyboard and the menu to spawn objects still won’t show up.

The default key is “'E” and you must have Native UI for it to work if you’re using version 2.

Is there somehow a way to white list this? So not everyone has access to opening the menu?

You can remove the ped restriction portion and add ace permissions which I was going to do that in the beginning but never got around to it.

Great tutorial for that here:

Version 3 available now. :+1:

1 Like

Version 3 is not working for me. I put it in and started it and when I click f6 it does nothing.

How Can I Stop The Ped Check Because We Use EUP And Not Peds

Here you go. Ive removed the ped check for you just replace your code with the following.

Summary
    local Player = GetPlayerPed(-1)
    local x, y, z = table.unpack(GetEntityCoords(Player, true))
    local heading = GetEntityHeading(Player)
   
    RequestModel(objectname)

    while not HasModelLoaded(objectname) do
	    Citizen.Wait(1)
    end

RegisterCommand('barrier2', function(source, args)
    --[ Spawns Police Barrier ]
    SpawnObject('prop_barrier_work05')
end, false)

RegisterCommand('barrier', function(source, args)
    --[ Spawns Work Barrier ]
    SpawnObject('prop_mp_barrier_02b')
end, false)

RegisterCommand('cone', function(source, args)
    --[ Spawn Traffic Cone ]
    SpawnObject('prop_mp_cone_01')
end, false)

RegisterCommand('ro', function(source, args)
    --[ Removes Objects (Standing Close) ]
        DeleteOBJ('prop_barrier_work05')
        DeleteOBJ('prop_mp_barrier_02b')
        DeleteOBJ('prop_mp_cone_01')
        TriggerEvent("chatMessage", "", {255,255,255}, "^3Objects(s) deleted.")
    else
        TriggerEvent("chatMessage", "", {255,255,255}, "^1You are not allowed to use this command.")
    end

end, false)

function DeleteOBJ(theobject)
    --[ Deletes The Object ]
    local object = GetHashKey(theobject)
    local x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), true))
    if DoesObjectOfTypeExistAtCoords(x, y, z, 0.9, object, true) then
        local obj = GetClosestObjectOfType(x, y, z, 0.9, object, false, false, false)
        DeleteObject(obj)
    end
end

function GetLocalPed()
    --[ Grabs The Player Ped (ID) ]
    return GetPlayerPed(PlayerId())
end
```

It Doesn’t Seem To Work

Also Im Using V1 As I Like It Better Or Is It Broken

hello the pedlist freemode as you add in the main lua

Nothing spawns in any idea