Skip to content

Commit

Permalink
fix(client/qb): hasItem fix when item does not exist (#1587)
Browse files Browse the repository at this point in the history
  • Loading branch information
someone005 committed Mar 1, 2024
1 parent 74e4fa1 commit 7632fea
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions modules/bridge/qb/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,17 @@ end
local function hasItem(items, amount)
amount = amount or 1

local count = Inventory.Search('count', items)

if type(items) == 'table' and type(count) == 'table' then
for _, v in pairs(count) do
if v < amount then
if type(items) == 'table' then
for _, v in pairs(items) do
if Inventory.GetItemCount(v) < amount then
return false
end
end

return true
else
return Inventory.GetItemCount(items) >= amount
end

return count >= amount
end

AddStateBagChangeHandler('inv_busy', ('player:%s'):format(cache.serverId), function(_, _, value)
Expand Down

0 comments on commit 7632fea

Please sign in to comment.