Weapon inventory problem

Hi, I have the same issue, What was deleted?
Regards
Renata

I have the version Version 6.2.1

Sorry for delay in response. Are you using inventory hud 2.xx with trunks? I actually caused my problem because I incorrectly edited the es extended .lua file to remove the F2 key bind. I had to be in-game and push F8 to bring down the console. Scroll up until you reach the first error message and it give you the file and a hint to the line that causes the error. I restored the original .lua and only deleted the lines that it specifically calls for. (First time I trimmed off some lines that looked out of place. That was a mistake.)

Same problem here, someone know of which script this bug came ?

Just had this issue and solved it by disabled esx_weaponsync thats are culprit !

This script replaces the weapon loadout system in FiveM and ESX. Instead of handling the loadout as its own thing, all weapons are stored as items in the player’s inventory. Ammo is also stored as items.

Before using this, you should modify ESX to allow “silent” removal of inventory items, or the players will be spammed when they are shooting. In my version of ESX, I modified the following in es_extended/client/main.lua :

RegisterNetEvent('esx:removeInventoryItem')
AddEventHandler('esx:removeInventoryItem', function(item, count, silent)

  for i=1, #ESX.PlayerData.inventory, 1 do
    if ESX.PlayerData.inventory[i].name == item.name then
      ESX.PlayerData.inventory[i] = item
    end
  end

  if not silent then
    ESX.UI.ShowInventoryItemNotification(false, item, count)
  end

  if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
    ESX.ShowInventory()
  end

end)

Secondly, you must add all weapons you would like to use in your item database. See the attached items.sql for an example.

Lastly, you must modify ESX and all other resources that handles the weapon loadout to use items instead. Otherwise things will f up.

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

3 Likes

Did you find a fix ?

Hi sorry did you manage to get esx_weaponsync working as I have all the weapons as items but they are no longer useable

i know this topic has been stale a while but esx v1 has massive ammo issues, it needs to be completely reworked to work correctly … ie compact pistol and reg pistol share same ammo and record as seperate values into db… thats the issue right there … ammo getloadout needs complete rework

Hello guys! i have a question, we are having a very similar problem… when someone disconnect and reconnect people lose all the ammo … anyone knows what’s the error ? this will help us a lot! :smiley:

if u use esx, you have to give ammo via server function and not via client, with the function: xPlayer.addWeaponAmmo

1 Like

This is working great but, now the problem is people Disconnect and reconnect and they get full ammo on the weapon, there is any way to avoid that? or is a poblem from esx? or u can show me the code to make this work properly sorry this error is taking a lot of time and we really neeed it.

Get a resource to use weapons as items; the way load outs are designed it is impossible to properly track ammo. It has always linked ammo to the weapon despite GTA not working in that way, and load outs have always had problems with duplication and ammo.

The alternative is removing the ammo saving from load outs and storing it separately by ammo type since that’s how GTA does it.

Hello, I have a problem with my inventory. Does anyone know how to make that weapons will be separated and not stacked?
For example: If a player buys a pistol and again buys the same pistol it will show 2 separate pistols in his inventory.

(I am using weapons as items)

how did you put weapon has a item??

Just use ox_inventory… It’s a lot better and optimized. Read their documentation for installation guide.

Mine is a zombie server so when a zombie #npc give me a weapon and i disconnect and reconnect my weapon are gun you know how to fix that??

I think that’s related with the database. Insure you have the items u are using in the database so when you disconnect from the server it remembers that u had an item in your inventory…

i have everything the Weapon on weapon category and everything

did u find the fix

same do you now how i can fix it