[RELEASE][ESX] Items for weapons and accessories

About Script:

  • This script replaces the weapon system in ESX, Instead it stores all of the weapons and ammunitions as items in the inventory which simplifies adding weight and carrying multiple at once.

  • Low ms for clients

Requirements:

  • es_extended

Config example:

{weapon = 'WEAPON_CARBINERIFLE', item = 'carbinerifle', ammoIteam = 'ammo_rifle'}

{item = 'pistol_silencer', weapon = 'WEAPON_PISTOL', componentHash = 0x65EA7EBB}

item and ammoIteam can be whatever you name the items in your database on the server.

Changelog:

    Version 1.1 - 2021-04-13
    1.Support added for throwable weapons into the scripts.
    2.Added weapons in the config file.
    3.Updated Readme.

    Version 1.2 - 2021-04-14
    1. Fixed issues with the ammunition synchronisation.

    Version 1.3 - 2021-04-22
    1. Fixed issues with an weapon ammo cap issue.

    Version 1.4 - 2021-11-25
    1. Setting for making weapon item usable added.
4 Likes

You should move this into the Releases folder :wink:

1 Like

I think an moderator needs to move it because I’m to low trust level to post there and the f.a.q said I could post here :grin:

1 Like

I’ve now got it moved to correct location, got the right trust level during the evening to do soo without an moderator too move it for me :joy:

1 Like

ah yeah i see okay sorry then :stuck_out_tongue:

1 Like

What is the benefit of using this one over weaponsync?

Lower ms for me at least and when i tried to use weapon sync it was pretty buggy an with this I don’t have the same bugs with bullet removal

Ok i checked the config file on GitHub, which is missing almost all weapons and ammo typed, do you plan to add them?

Also: arent these

RegisterNetEvent('FDev:AmmoUpdate')
AddEventHandler('FDev:AmmoUpdate', function(ammoItem, ammoCount)
    local playerId = source
    local xPlayer = ESX.GetPlayerFromId(playerId)

    xPlayer.setInventoryItem(ammoItem, ammoCount)
end)

AddEventHandler('esx:onAddInventoryItem', function(playerId, itemName, itemCount)
    TriggerEvent('FDev:InventoryUpdate', playerId, itemName, itemCount, false)
end)

AddEventHandler('esx:onRemoveInventoryItem', function(playerId, itemName, itemCount)
    TriggerEvent('FDev:InventoryUpdate', playerId, itemName, itemCount, true)
end)

highly vulerable to lua executors?

greetings,

Yes, I’ll plan to add all weapons in the future and also add the components.

To be honest most of the parts in any lua script that have anything like this is vulnerable against lua executors and two of the parts you posted is only calling an event when an event is triggered in es_extended.

Or do you mostly mean I use the xPlayer.setInventoryItem function?

New version is now out on the github.

  • Changelog:
   Version 1.3 - 2021-04-22
    1. Fixed issues with an weapon ammo cap issue.

When you shoot a bullet, 5 messages appear
image

Is the issue that you’ll get the message 5 times or is it that the message appears? There are instructions in the readme to make the messages disappear.

The problem is that when firing a bullet, five notifications appear instead of one. I would like only one notification to go out

Okey, I’ll see then I think I can work around that if I modify some of the code.

thanks for your help

Hello, it kinda saves the ammo for specific weapon for example if i get 50round of Rifle Ammo and draw my Carbine Rifle it saves them to Carbine. When i draw my Assault Rifle it removes the past 50round of Carbine and i need to take new rounds for AssaultRifle.

Can’t we just say something like, how much ammo you have, okay if it fits to Carbine or Assault it doesnt matter which one you using?

Can you set the ammoboxes with an amount? Because when i buy a ammo box e.G: ammo_pistol then its only 1 bullet. I think its better to set it higher e.G 1 ammo box is worth 40 bullets.

Thanks

What? The ammo goes after type, and i don’t really understand what you mean?

Well the ammo is bullets and not boxes?

Yeah, if i buy 1x Ammo Pistol, then i got only 1 bullet :smiley: Thats bad