[ESX][Idea] Weapon as item in inventory

I have an idea for a script, but i lack the knowledge of lua scripting.

I wish for a script that gives you an option to get weapons as an inventory item, for example the Mafia, it would be alot easier for them or any other faction to sell weapons or bring in large quantities into the city.

Could be, maybe… If you have say, a pistol in your inventory you could press “enter” on it and then “use” to “assemble” that weapon and give the player who uses the item a pistol.

Now, the trunk system isn’t enough or the system in place today that you carry one firearm and store one in the trunk.

3 Likes

Sounds like vRP

Yeah… except vRP is worse in a multitude of other ways unfortunately. I really wanted to make vRP work but … it just doesn’t have the support ESX does.

True, Maybe you can look at the code and convert to esx but you have to make your own system to work With this.

found a way of making all weapons an items? @Bengteke

1 Like

InventoryHud for ESX does this

inventoryhud is like a buggy as f*k.People can duplicate items/weapons.I could’nt suggest you to use this its very buggy.

You must have not configured it correctly. I dont have duping issues.

There’s not duplicing issue anymore mate

There is.I’m using lastest version of inventoryhud+trunk addon.People can easily clone weapons and items.

How are they doing this?

I want help After Loot Dead person And Take Weapon I Found Weapon With Him After Revive I Want Help Items Is Every Thing Is Good But Weapon I Cant

Working on this right now, requires some work both on ESX and vRP, but its very doable.

1 Like

This is solution? And I can have 2 pistol rn?

They have been able to find some?

Hi, have you found any way to get it?

Hey just create a script where is an item usable, and it gives you the weapon

ESX.RegisterUsableItem('advancedrifle', function(source)
	local xPlayer = ESX.GetPlayerFromId(source)
	xPlayer.removeInventoryItem('advancedrifle', 1)
	local weaponName = 'weapon_advancedrifle'
    if ESX.GetWeapon(weaponName) then
		weaponName = string.upper(weaponName)
	end

	if xPlayer.hasWeapon(weaponName) then
		TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player already has that weapon.' } })
	else
		xPlayer.addWeapon(weaponName, 0)
	end
end)

like that

3 Likes

Make an item like ‘Pistol Weapon Case’ and register it as a usable item. When used, ‘Pistol Weapon Case’ can give you a WEAPON_Pistol, etc. I think this is the easier way to implement something like that.

1 Like

where do you insert the script?