mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
Fix getPlayerInv() for CodeM Inventory
This commit is contained in:
@@ -341,7 +341,7 @@ local InvFunc = {
|
|||||||
local count = 0
|
local count = 0
|
||||||
for _, itemData in pairs(invCache) do
|
for _, itemData in pairs(invCache) do
|
||||||
if itemData and itemData.name == item then
|
if itemData and itemData.name == item then
|
||||||
count += (itemData.amount or itemData.count or 1)
|
count += (itemData.amount or 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return count >= amount, count
|
return count >= amount, count
|
||||||
@@ -384,7 +384,7 @@ local InvFunc = {
|
|||||||
if src then
|
if src then
|
||||||
grabInv = exports[CodeMInv]:GetInventory(getPlayer(src).citizenId, src)
|
grabInv = exports[CodeMInv]:GetInventory(getPlayer(src).citizenId, src)
|
||||||
else
|
else
|
||||||
grabInv = exports[CodeMInv]:getUserInventory()
|
grabInv = exports[CodeMInv]:GetClientPlayerInventory()
|
||||||
end
|
end
|
||||||
return grabInv
|
return grabInv
|
||||||
end,
|
end,
|
||||||
@@ -1279,6 +1279,7 @@ end
|
|||||||
function hasItem(items, amount, src)
|
function hasItem(items, amount, src)
|
||||||
local amount = amount and amount or 1
|
local amount = amount and amount or 1
|
||||||
local grabInv, foundInv = getPlayerInv(src)
|
local grabInv, foundInv = getPlayerInv(src)
|
||||||
|
jsonPrint(grabInv)
|
||||||
if type(items) ~= "table" then items = { [items] = amount and amount or 1, } end
|
if type(items) ~= "table" then items = { [items] = amount and amount or 1, } end
|
||||||
|
|
||||||
local hasTable = {}
|
local hasTable = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user