Skip to content

Commit

Permalink
fix(drops): drop deletion due to incorrect table length with empty in…
Browse files Browse the repository at this point in the history
…dexes
  • Loading branch information
Qwerty1Verified committed Sep 6, 2024
1 parent f01081d commit d10f3a6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,18 @@ QBCore.Functions.CreateCallback('qb-inventory:server:createDrop', function(sourc
local bag = CreateObjectNoOffset(Config.ItemDropObject, playerCoords.x + 0.5, playerCoords.y + 0.5, playerCoords.z, true, true, false)
local dropId = NetworkGetNetworkIdFromEntity(bag)
local newDropId = 'drop-' .. dropId
local itemsTable = setmetatable({ item }, {
__len = function(t)
local length = 0
for _ in pairs(t) do length += 1 end
return length
end
})
if not Drops[newDropId] then
Drops[newDropId] = {
name = newDropId,
label = 'Drop',
items = { item },
items = itemsTable,
entityId = dropId,
createdTime = os.time(),
coords = playerCoords,
Expand Down

0 comments on commit d10f3a6

Please sign in to comment.