ESX_Inventoryhud Shops - Adding it to Properties Help

Hello i am trying to figure out how to add inventoryhud to esx_property, i have tried:

Open esx_property/client/main.lua and do the following:
Find this code in OpenRoomMenu function:

			table.insert(elements, {label = _U('remove_object'),  value = 'room_inventory'})
			table.insert(elements, {label = _U('deposit_object'), value = 'player_inventory'})

And replace it with:

			table.insert(elements, {label = "Property inventory", value = "property_inventory"})

Then find this code:

			elseif data.current.value == 'room_inventory' then
				OpenRoomInventoryMenu(property, owner)
			elseif data.current.value == 'player_inventory' then
				OpenPlayerInventoryMenu(property, owner)

And replace it with:

			elseif data.current.value == "property_inventory" then
			menu.close()
			OpenPropertyInventoryMenu(property, owner)

And finally add this function:

			function OpenPropertyInventoryMenu(property, owner)
			ESX.TriggerServerCallback(
			"esx_property:getPropertyInventory",
			function(inventory)
			TriggerEvent("esx_inventoryhud:openPropertyInventory", inventory)
			end,
			owner
			)
			end

and it doesn’t work. Just disables esx_property.

2 Likes

When you say it just disables esx_properties what do you mean. It stops running all together, or the script runs but you can’t access it. If it stops running all together are there any console errors when you try and start it, either in f8 or server console. Hopefully with these answers someone can help you get it sorted out.

SpikE

I got it working i missed a little piece of code. Wouldn’t happen to know how i could add weapons to shops other then weapon shop would you. I’m trying to turn YouTool into a Black Market, i’ve managed to change the location and delete the blip all together but when i add weapons it just wont register the weapon as if it actually works. You can buy it and drop it but doesn’t work at all.

^^^^^^^^^^ Keep forgetting there is a reply button.

The server I used to work for had weapons as items so make it very easy to add weapons to any function in the city. If you are still using gta weapons you would need to recode the shops to check to see the name of the item and if it has WEAPON_ in it use the giveweapon instead of giveitem function on the server.

SpikE

I’m not really good at coding i’v tried changing the YouTool to weapos in config by doing

YouTool = {
        Locations = {
            {x = 905.8169555664, y = -3229.8996582032, z = -99.29434967041},
     },
        Weapons = {
            {name = "WEAPON_FLASHLIGHT", ammo = 1},
            {name = "WEAPON_STUNGUN", ammo = 1},
            {name = "WEAPON_KNIFE", ammo = 1},
            {name = "WEAPON_BAT", ammo = 1},
            {name = "WEAPON_PISTOL", ammo = 45},
            {name = "WEAPON_PUMPSHOTGUN", ammo = 25}
        },
        Ammo = {
            {name = "9mm_rounds", weaponhash = "WEAPON_PISTOL", ammo = 24},
            {name = "shotgun_shells", weaponhash = "WEAPON_PUMPSHOTGUN", ammo = 12}
        },
        Items = {
		
		}
	},

It opens up the shop but shows nothing in there.

Would need to see how it was formated before… you might only be able to list the name of the item… and then in the server side that gives the item to the player you would need to check to see if it has ‘WEAPON_’ in the name of the item and handle it different. For what you want to do it would require a fair bit of change in the code - prob not something someone that hasn’t been coding for very long would be able to do.

SpikE

I managed to get it working now i’m just trying to figure out how to add ammo to the shop, here’s what i changed.

inventoryhud > server > main

if shoptype == "youtool" then
			local weapons = Config.Shops.YouTool.Weapons
			for _, v in pairs(Config.Shops.YouTool.Weapons) do
				if v.name == itemResult[i].name then
					table.insert(itemShopList, {
						type = "item_weapon",
						name = itemInformation[itemResult[i].name].name,
						label = itemInformation[itemResult[i].name].label,
						limit = 1,
						ammo = v.ammo,
						rare = itemInformation[itemResult[i].name].rare,
						can_remove = itemInformation[itemResult[i].name].can_remove,
						price = itemInformation[itemResult[i].name].price,
						count = 99999999
					})
				end
			end
		end

Inventoryhud > config

YouTool = {
        Locations = {
            {x = 905.8169555664, y = -3229.8996582032, z = -99.29434967041},
     },
        Weapons = {
            {name = "WEAPON_PISTOL", ammo = 45},
            {name = "WEAPON_PUMPSHOTGUN", ammo = 25},
        },
        Ammo = {
            {name = "9mm_rounds", weaponhash = "WEAPON_PISTOL", ammo = 24},
            {name = "shotgun_shells", weaponhash = "WEAPON_PUMPSHOTGUN", ammo = 12}
        },
        Items = {
		
		}
	},

Do i need to add ammo under?

},
        Items = {

Can you help me out.

1 Like

Should just have to put the weapon hash and ammo count that needs to be added… and make sure it uses the AddPedAmmo on the server. I haven’t looked into this run time much but seems pretty str8 fwd in how it works.

SpikE

Hey, how did you get it synced with property inventory ? I’d like to use the inventoryhud as property inventory also instead of the default one

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.