[RELEASE][ESX] Items for weapons and accessories

Why is that bad? The script uses ammo as single bullets not ammo kits. :grinning_face_with_smiling_eyes:

Because i add them to ammunation shop and its very hard to add 200+ bulletsā€¦
Can you add something like this in your config so users can define itself?

Config.AmmoBoxes = {
Pistol = 50, ā€“ 9mm @ 0.28 per round | 50 x 1.05 = 14
SMG = 50, ā€“ 9mm @ 0.28 per round | 50 x 1.05 = 14
Shotgun = 25, ā€“ 12g @ 0.36 per round | 25 x 0.36 = 9
Rifle = 25, ā€“ 5.56 @ 0.47 per round | 25 x 0.47 = 11.75 (12)
MG = 50, ā€“ 5.56 @ 0.47 per round | 50 x 0.47 = 23.50 (24)
Sniper = 20, ā€“ 7.62 @ 1.05 per round | 20 x 1.05 = 21
Flare = 5, ā€“ Not doing Realistic Price
BoxBig = 100,
BoxSmall = 50
}

To be honest Iā€™ve no clue what you want to get out from me adding that into the config? Because still the ammunition in this script is registered as single bullets, and one bullet canā€™t be fifty bullets.

And why would you add 200 different bullets to your shop or am I not understanding that correctly,
an easy thing you can do is scripting an ammo box that converts the box to bullets on use or add so the shop sells packages of like 50 or so this way it will work the way youā€™ll want it to work on your server.

Can you add support for ammo boxes?

How do you mean this ammo boxes should work? Because i have no plan to add something like ammo boxes because the script is doing weapons and ammo into items in esx and the ammo count is single bullets.

Thatā€™s the point. :smiley: Iā€™ve added the bullets into my ammo shop, but to buy single bullets is very exhausting. So its not possible to add ammo boxes they have included 30-50 bullets? e.G Pistol Ammobox, Rifle Ammobox and so onā€¦

Thanks and regards

Whatā€™s the point?

What you have to do if you do not like your weapons store is to create your own mod, as I have done and so you can make it more comfortable for your players.

1 Like

I donā€™t understand why you publish a script that doesnā€™t provide full functionality. Which user would like seperate bullets as an item? That is exactly the problem that FiveM has. You have to create a new script over and over again to complement to the other. Why not just publish a script that works just as the users want it? But all right guys, Iā€™ll do it myself. Have a good time.

This script works exactly as I want it to work? It makes the weapons and ammunition to items in esx a weapon fires one bullet at a time and not 30 therefore I use single bullets so I donā€™t really see why you say I donā€™t have full functionality in the script?

I think you do not understand the problem, @Friped has created a script that allows you to use items as if they were weapons in esx, and it perfectly fulfills that function. You have a problem with your weapons store which has nothing to do with this script. What you have to modify is the store.

1 Like

Also you have never even awnsered my questions what you mean and stuff with the requests you make so you canā€™t go all full complain about it not workinf the way you would want it

I suggest various solutions to fix your problem:
-Create an item that when consuming it gives you x amount of bullets, this item is sold in your weapons store.
-Make that in your store you can easily select the amount of bullets you want to buy. This can be done with default options (Example: 50 bullets) or that the user indicates how many bullets he wants.

If you decide to do the usable item you would have to use something like this (ESX Documentation):
server.lua:

ESX.RegisterUsableItem('ammobox_pistol', function(playerId)
    local xPlayer = ESX.GetPlayerFromId(playerId)
    xPlayer.removeInventoryItem('ammobox_pistol', 1)
    xPlayer.showNotification('You have used a pistol ammobox and obtained 50 pistol bullets')
    xPlayer.addInventoryItem('ammo_pistol', 50)
end)
2 Likes

Thank you, thats exactly what i wanted.

Hello Friped,

Thanks a lot for this script, it is working pretty good but the only issue i got right now is when i give my weapon to a friend when i have 50 ammo, and he handles me the weapon back the 50 ammo just dissapears. And i canā€™t give the ammunition to someone in-game because it isnā€™t registered as a item.

Can you maybe help me out with this?

Thanks a lot,

Greets,
PlazaRP

1 Like

to get the weapon do you use / giveitem or / giveweapon?

/giveweapon, and the ammo as /giveitem but when i give the weapon with ammo to a friend and he gives it back the ammo just dissapears.

thatā€™s the problem you have to use giveitem for everything

1 Like

Thanks you, that is working now but is there a way that i can give my ammo to another person?

for everything to work well erase the weapons generated with / giveweapon and you have to give yourself the ammunition and the weapon with / giveitem. If everything has worked well in your inventory you have 2 items, the weapon and the bullets, which you can give to other users