[Release] Object Spawner

Default key to open menu is “E”.

Requires NativeUI

Download ObjectSpawner (github.com)

12 Likes

Nice release dude. [20 char]

2 Likes

Why not use the police barrier?

The police barrier I’ve had issues with so I left it out for now until I can get it fixed.
But if you would like to add it for your own use the object name is “prop_barrier_work05”.

What were the problems?

1 Like

It kept falling through the map and wouldn’t spawn properly. It may be something on my end.

Is this only for the cop? or can a normal citezen also spawn it?

Anyone can use it. I’ll add another version soon so that only an LEO can use it.

That would be Nice if the only police og Medic can do it :slight_smile:

Otherwise you look at how the code is made and integrate it into your :heart_eyes:

2 Likes

I just downloaded this and put into my server to test it, but the cones and barriers aren’t spawning. And yes it’s in the resource folder and started, Because the commands show up.

1 Like

Same problem.

202020202

1 Like

I had to take a server.lua from a similar resource and edit it a bit to make this one work.

1 Like

I apologize for the problems this script has caused. This new update SHOULD fix those problems! If you are still having any problems please let me know so I can fix them. :muscle:

New update, Check it out!

1 Like

How do you open the Menu?

The default button is “E”.

If you would like to change the button just go here to find a button:

Change " IsControlJustPressed(1, 51) "
51 = E

1 Like

Thank you very much. I was just being a noob and had not added the dependency :stuck_out_tongue:

1 Like

Hi. Is it possible to add options to get it to stick to the server, even if it’s reloaded? A json file or something to hold the cords for the item.

I’ve added this to my Policejob and EMS Menu with the help of Alpha on the discord.

To the menu I added

{label = _U('object22'), value = 'object22'},

and put -- infront of the old spawner.

esx_policejob/client/main.lua

		title    = 'Police',
		align    = 'bottom-right',
		elements = {
			{label = _U('citizen_interaction'),	value = 'citizen_interaction'},
			{label = _U('vehicle_interaction'),	value = 'vehicle_interaction'},
			--{label = _U('object_spawner'),		value = 'object_spawner'},
			{label = _U('object22'),		    value = 'object22'},

esx_ambulancejob/client/jobs.lua

		title		= _U('ambulance'),
		align		= 'bottom-right',
		elements	= {
			{label = _U('ems_menu'), value = 'citizen_interaction'}
			{label = _U('object22'),	value = 'object22'},
		}

then I added this to it as well to trigger it when the menu selects it.

Policejob

		elseif data.current.value == 'object22' then
		TriggerEvent('objectmenuv2')
		ESX.UI.Menu.CloseAll()

ambulancejob was different it needs to go above the citizen_interaction menu like this and change the if to elseif at the start of if data.current.value == 'citizen_interaction' then

	}, function(data, menu)


		if data.current.value == 'object22' then
		TriggerEvent('objectmenuv2')
		ESX.UI.Menu.CloseAll()	
		
		elseif data.current.value == 'citizen_interaction' then

In Objectspawnerv2/client.lua I replaced this

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        _menuPool:ProcessMenus()
        if IsControlJustPressed(1, 51) then
            mainMenu:Visible(not mainMenu:Visible())
        end
    end
end)

With this

AddEventHandler("objectmenuv2", function()
    mainMenu:Visible(not mainMenu:Visible())
end)

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        _menuPool:ProcessMenus()
    end
end)

This should allow you to use them in your policejob and ems menus.

I did also change the allowed peds

pedsList = {
	"mp_f_freemode_01",
	"mp_m_freemode_01",
}

But that was just for how I needed it set up.

And of course add the locales to the language.lua you are using in this case

  ['object22'] = 'Object Selection Menu',