fix for if ox_inv can't find an item when trying to get image

This commit is contained in:
Jim Shield
2025-06-21 13:29:01 +01:00
parent 2e57e66095
commit d0b8fb16d6

View File

@@ -99,9 +99,9 @@ else
end
end
if isStarted(OXInv) then
for k, v in pairs(Items) do
local tempInfo = exports[OXInv]:Items(v.name)
if tempInfo.client then
for k, v in pairsByKeys(Items) do
local tempInfo = exports[OXInv]:Items(k)
if tempInfo and tempInfo.client then
Items[k].image = (tempInfo.client and tempInfo.client.image) and tempInfo.client.image:gsub("nui://"..OXInv.."/web/images/", "") or k..".png"
Items[k].hunger = tempInfo.client and tempInfo.client.hunger
Items[k].thirst = tempInfo.client and tempInfo.client.thirst