[Deprecated] [ESX] Disc-InventoryHUD

We do get this error in server console: @disc-inventoryhud/server/player.lua:27: bad argument #1 to ‘pairs’ (table expected, got nil)

If this happens, the users inventory is empty. After /ensureinv their inventory is empty definitive.

Relogging or a server restart does not solve this problem.

The only thing to make their inventory working again is to delete all database information.

This error forces us to stop using this resource, because people are losing their stuff/money…

1 Like

I have this problem also, In order to fix it I had to go into the database under disc-inventory and change DATA to [] where it was showing “null”

My question: Lets say I have bread set to stack at a maximum of 10. How do I stop it from going into another inventory slot? Currently You can hold a full inventory of 10stacks of bread. I want the ONE STACK to be the only stack you can carry of that specific item, AKA Some sort of check to make sure you don’t have that item in an inventory slot already.

Weight you meant?

Negative, I’m still using ‘limit’
But if I have 5 empty inventory slots. I can fill them all with stacks of bread. I want it to only allow 1 stack of an item in my inventory. So i don’t have 5 stacks of bread taking up 5 inventory slots.

And for some reason, I can’t give items at all. Is the disc_inventory_itemdata used at all? Mine is 100% emprty at the moment.

seems like weapons dont do any dmg from time to time, anyone have an ide whats wrong?

Yes, i saw it in my database and changed it.

But some users lost their inventory after their first relog into the server

We have the same issue.
If we change all the nulls, the nulls are there again in some client relogs.

For anyone getting null in there database in the file server\inventory.lua

Line 508 to 521 replace with this

function saveInventories()
    for type, inventories in pairs(loadedInventories) do
        for identifier, inventory in pairs(inventories) do
            if inventory ~= nil then
                if table.length(inventory) > 0 then
                    saveLoadedInventory(identifier, type, inventory)
                else
                    deleteInventory(identifier, type)
                end
            end
        end
    end
    RconPrint('[Disc-InventoryHud][SAVED] All Inventories' .. "\n")
end

and line 523 to 547 replace with this

function saveLoadedInventory(identifier, type, data)
    if table.length(data) > 0 then
     MySQL.Async.execute('UPDATE disc_inventory SET data = @data WHERE owner = @owner AND type = @type', {
           ['@owner'] = identifier,
           ['@type'] = type,
           ['@data'] = json.encode(data)
     }, function(result)
            if result == 0 then
              createInventory(identifier, type, data)
          end
          loadedInventories[type][identifier] = nil
          TriggerEvent('disc-inventoryhud:savedInventory', identifier, type, data)
      end)
    end
end

this will fix the problem with null in the database.

2 Likes

We are testing this currently

works as it should :ok_hand:

2 Likes

Until now indeed! Amazing :slight_smile:

We use esx-kr-advanced-shops for our shops.

We can buy unlimited items, but offcourse they got lost if the inventory is full. Is there any way to implement the max. inventory items with esx-kr-advanced-shops?

Why not just use the inventory system to setup shops?

Because we want people to buy shops and manage their shops. That’s the beauty of kr-advanced-shops

Any bag inventory feature planned?

Currently using esx-kr-bag-inventory but this one is incompatible with disc

when you say when there inventory is full and they lose items you mean they have reached max slots on there inventory?

if thats the case either up the slots on the iventory or run a check in the shop to see if the players inventory is full before the final purchase

I will take a look into that one.

maybe you know the reason ? I install a new server and see error


I have a feeling that any resource that breaks the server pisses me off >=(
don’t tell me there’s no support esx_skin =( and shop not open aaaaaa…

ok so your problem with esx_skin the setmax weight

which version of es_extended are you using?
if you are using the latest one then you need the version just before that because this inventory does not support the latest esx yet with the weight system heres a link to the version you need.