HasItem + partial support for shops
This commit is contained in:
1 parent
f28e511de6
commit
dee14600ba
14 files changed
+220
-7
No files matched your search
@@ -54,6 +54,15 @@ Inventory.GetItemCount = function(src, item, metadata)
|
||||
return ox_inventory:GetItemCount(src, item, metadata, false)
|
||||
end
|
||||
|
||||
---comment
|
||||
---@param src number
|
||||
---@param item string
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(src, item)
|
||||
local count = ox_inventory:GetItemCount(src, item, nil, false)
|
||||
return count > 0
|
||||
end
|
||||
|
||||
---comment
|
||||
---@param src number
|
||||
---@return table
|
||||
@@ -142,4 +151,18 @@ Inventory.GetImagePath = function(item)
|
||||
local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item))
|
||||
local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
local registeredShops = {}
|
||||
|
||||
Inventory.OpenShop = function(src, shopTitle)
|
||||
TriggerClientEvent('ox_inventory:openInventory', src, 'shop', {type = shopTitle})
|
||||
end
|
||||
|
||||
Inventory.CreateShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
||||
if registeredShops[shopTitle] then return true end
|
||||
registeredShops[shopTitle] = true
|
||||
ox_inventory:RegisterShop(shopTitle, { name = shopTitle, inventory = shopInventory, groups = shopGroups, })
|
||||
--return Inventory.OpenShop(src, shopTitle)
|
||||
return true
|
||||
end
|
||||
Reference in new issue
Block a user