[Release] [Updated 2/19/19] Object Spawner v3


#1

Simple object spawner to spawn a barrier and cone.

Commands:
“/cone” - Spawn Cone
“/barrier” - Spawn Barrier (Player Rotation)
“/ro” - Deletes Object (Stand Close)

ObjectSpawner.zip (1.2 KB)

NOTE: I do not know if this will work for VRP or ESX I know nothing of those frameworks.

Updated (7/20/2018) : Added ped restriction and fixed a couple bugs.


Object Spawner v2:
This version now uses NativeUI by Frazzle. (Not Included)
Added custom coroner stretcher.

ObjectSpawnerv2.zip (1.4 MB)


Object Spawner v3:
There currently is no permissions to use the menu. (Will be updated soon with ACE perms)
Default key is F6.
This version is now written in C# for better performance.
Menu is now using MenuAPI by @Vespura.
Added Message Board by @SebastienGaming.
All credits are included in the source.

Source code and compiled version included!

Download Version 3


[HELP] Prop Spawning ( NOT MAPS )
#2

Nice release dude. [20 char]


#3

Why not use the police barrier?


#4

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”.


#5

What were the problems?


#6

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


#7

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


#8

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


#9

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


#10

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


#11

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.


#12

Same problem.

202020202


#13

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


#14

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:


#15

New update, Check it out!


#16

How do you open the Menu?


#17

The default button is “E”.

If you would like to change the button just go here to find a button:
https://docs.fivem.net/game-references/controls/#controls

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


#18

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


#20

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.


#21

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',