mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
Add better fallbacks for if no metadata table is found
```lua
durability = v.info.durability
```
to:
```lua
durability = v.info and v.info.durability or nil
```
This commit is contained in:
@@ -433,7 +433,7 @@ function getDurability(item)
|
|||||||
if v.name == item then
|
if v.name == item then
|
||||||
if v.slot <= lowestSlot then
|
if v.slot <= lowestSlot then
|
||||||
lowestSlot = v.slot
|
lowestSlot = v.slot
|
||||||
durability = itemcheck[k].info.durability
|
durability = itemcheck[k].info and itemcheck[k].info.durability or nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -445,7 +445,7 @@ function getDurability(item)
|
|||||||
if v.slot <= lowestSlot then
|
if v.slot <= lowestSlot then
|
||||||
debugPrint(v.slot, itemcheck[k].metadata.durability)
|
debugPrint(v.slot, itemcheck[k].metadata.durability)
|
||||||
lowestSlot = v.slot
|
lowestSlot = v.slot
|
||||||
durability = v.metadata.durability
|
durability = v.metadata and v.metadata.durability or nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -455,7 +455,7 @@ function getDurability(item)
|
|||||||
for _, v in pairs(itemcheck) do
|
for _, v in pairs(itemcheck) do
|
||||||
if v.name == item and v.slot <= lowestSlot then
|
if v.name == item and v.slot <= lowestSlot then
|
||||||
lowestSlot = v.slot
|
lowestSlot = v.slot
|
||||||
durability = v.info.durability
|
durability = v.info and v.info.durability or nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -465,7 +465,7 @@ function getDurability(item)
|
|||||||
for _, v in pairs(itemcheck) do
|
for _, v in pairs(itemcheck) do
|
||||||
if v.name == item and v.slot <= lowestSlot then
|
if v.name == item and v.slot <= lowestSlot then
|
||||||
lowestSlot = v.slot
|
lowestSlot = v.slot
|
||||||
durability = v.metadata.durability
|
durability = v.metadata and v.metadata.durability or nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -475,7 +475,7 @@ function getDurability(item)
|
|||||||
for _, v in pairs(itemcheck) do
|
for _, v in pairs(itemcheck) do
|
||||||
if v.name == item and v.slot <= lowestSlot then
|
if v.name == item and v.slot <= lowestSlot then
|
||||||
lowestSlot = v.slot
|
lowestSlot = v.slot
|
||||||
durability = v.info.durability
|
durability = v.info and v.info.durability or nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -485,7 +485,7 @@ function getDurability(item)
|
|||||||
for _, v in pairs(itemcheck) do
|
for _, v in pairs(itemcheck) do
|
||||||
if v.name == item and v.slot <= lowestSlot then
|
if v.name == item and v.slot <= lowestSlot then
|
||||||
lowestSlot = v.slot
|
lowestSlot = v.slot
|
||||||
durability = v.metadata.durability
|
durability = v.metadata and v.metadata.durability or nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -495,7 +495,7 @@ function getDurability(item)
|
|||||||
for _, v in pairs(itemcheck) do
|
for _, v in pairs(itemcheck) do
|
||||||
if v.name == item and v.slot <= lowestSlot then
|
if v.name == item and v.slot <= lowestSlot then
|
||||||
lowestSlot = v.slot
|
lowestSlot = v.slot
|
||||||
durability = v.metadata.durability
|
durability = v.metadata and v.metadata.durability or nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ function openShop(data)
|
|||||||
elseif isStarted(OXInv) then
|
elseif isStarted(OXInv) then
|
||||||
exports[OXInv]:openInventory('shop', { type = data.shop })
|
exports[OXInv]:openInventory('shop', { type = data.shop })
|
||||||
|
|
||||||
elseif isStarted(QSInv) then
|
elseif isStarted(QSInv) or isStarted(CodeMInv) then
|
||||||
TriggerServerEvent("inventory:server:OpenInventory", "shop", data.items.label, data.items)
|
TriggerServerEvent("inventory:server:OpenInventory", "shop", data.items.label, data.items)
|
||||||
|
|
||||||
elseif isStarted(TgiannInv) then
|
elseif isStarted(TgiannInv) then
|
||||||
|
|||||||
Reference in New Issue
Block a user