diff --git a/modules/framework/es_extended/client.lua b/modules/framework/es_extended/client.lua index eb92eaf..6841e62 100644 --- a/modules/framework/es_extended/client.lua +++ b/modules/framework/es_extended/client.lua @@ -34,6 +34,11 @@ Framework.GetPlayerJob = function() return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade end +Framework.HasItem = function(item) + local hasItem = ESX.SearchInventory(item, true) + return hasItem > 0 and true or false +end + Framework.GetPlayerInventory = function() return ESX.GetPlayerData().inventory end diff --git a/modules/framework/ox_core/client.lua b/modules/framework/ox_core/client.lua index cb054e4..8084091 100644 --- a/modules/framework/ox_core/client.lua +++ b/modules/framework/ox_core/client.lua @@ -29,6 +29,12 @@ Framework.GetPlayerJob = function() return group, title, title, grade end +Framework.HasItem = function() + local itemCount = ox_inventory:Search('count', item) + local hasItem = itemCount ~= 0 + return hasItem +end + Framework.GetPlayerInventory = function() return exports.ox_inventory:GetPlayerItems() end @@ -55,4 +61,4 @@ RegisterNetEvent('ox:setGroup', function(name, grade) PlayerJobGradeName = grade PlayerJobGradeLevel = grade TriggerEvent('community_bridge:Client:OnPlayerJobUpdate',PlayerJobName, PlayerJobLabel, PlayerJobGradeName, PlayerJobGradeLevel) -end) \ No newline at end of file +end) diff --git a/modules/framework/qb-core/client.lua b/modules/framework/qb-core/client.lua index 3b8291b..cb62bc9 100644 --- a/modules/framework/qb-core/client.lua +++ b/modules/framework/qb-core/client.lua @@ -57,6 +57,10 @@ Framework.GetPlayerJob = function() return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level end +Framework.HasItem = function(item) + return QBCore.Functions.HasItem(item) +end + Framework.GetPlayerInventory = function() local items = {} local frameworkInv = QBCore.Functions.GetPlayerData().items @@ -109,4 +113,4 @@ RegisterNetEvent('QBCore:Client:OnGangUpdate', function(data) PlayerJobGradeLevel = data.grade.level TriggerEvent('community_bridge:Client:OnPlayerGangUpdate', PlayerGangName, PlayerGangLabel, PlayerGangGradeName, PlayerGangGradeLevel) --]] -end) \ No newline at end of file +end) diff --git a/modules/inventory/_default/client.lua b/modules/inventory/_default/client.lua index db02090..bd5f17b 100644 --- a/modules/inventory/_default/client.lua +++ b/modules/inventory/_default/client.lua @@ -5,6 +5,10 @@ Inventory.GetItemInfo = function(item) return Framework.GetItemInfo(item) end +Inventory.HasItem = function(item) + return Framework.HasItem(item) +end + Inventory.GetImagePath = function(item) return "https://avatars.githubusercontent.com/u/47620135" -end \ No newline at end of file +end diff --git a/modules/inventory/codem-inventory/client.lua b/modules/inventory/codem-inventory/client.lua index 6ad452c..83a0228 100644 --- a/modules/inventory/codem-inventory/client.lua +++ b/modules/inventory/codem-inventory/client.lua @@ -38,4 +38,4 @@ Inventory.GetPlayerInventory = function() }) end return items -end \ No newline at end of file +end diff --git a/modules/inventory/jpr-inventory/client.lua b/modules/inventory/jpr-inventory/client.lua index d29debf..cf5a4df 100644 --- a/modules/inventory/jpr-inventory/client.lua +++ b/modules/inventory/jpr-inventory/client.lua @@ -1,5 +1,6 @@ if GetResourceState('jpr-inventory') ~= 'started' then return end +local jpr = exports['jpr-inventory'] Inventory = Inventory or {} RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id, data) @@ -8,8 +9,12 @@ RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id, TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) end) +Inventory.HasItem = function(item) + return jpr:HasItem(item) +end + Inventory.GetImagePath = function(item) local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item)) local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" -end \ No newline at end of file +end diff --git a/modules/inventory/origen_inventory/client.lua b/modules/inventory/origen_inventory/client.lua index ebb4154..e7c139a 100644 --- a/modules/inventory/origen_inventory/client.lua +++ b/modules/inventory/origen_inventory/client.lua @@ -17,6 +17,10 @@ Inventory.GetItemInfo = function(item) return repackedTable or {} end +Inventory.HasItem = function(item) + return origin:HasItem(item) +end + Inventory.GetImagePath = function(item) local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item)) local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item) @@ -39,4 +43,4 @@ Inventory.GetPlayerInventory = function() }) end return items -end \ No newline at end of file +end diff --git a/modules/inventory/ox_inventory/client.lua b/modules/inventory/ox_inventory/client.lua index 3f1c239..dc2f1d0 100644 --- a/modules/inventory/ox_inventory/client.lua +++ b/modules/inventory/ox_inventory/client.lua @@ -17,6 +17,12 @@ Inventory.GetItemInfo = function(item) return repackedTable end +Inventory.HasItem = function(item) + local itemCount = ox_inventory:Search('count', item) + local hasItem = itemCount ~= 0 + return hasItem +end + 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) @@ -27,4 +33,4 @@ Inventory.GetPlayerInventory = function() return exports.ox_inventory:GetPlayerItems() end ---Bridge.RegisterModule("Inventory", Inventory) \ No newline at end of file +--Bridge.RegisterModule("Inventory", Inventory) diff --git a/modules/inventory/ps-inventory/client.lua b/modules/inventory/ps-inventory/client.lua index f031826..b1f0332 100644 --- a/modules/inventory/ps-inventory/client.lua +++ b/modules/inventory/ps-inventory/client.lua @@ -1,5 +1,7 @@ if GetResourceState('ps-inventory') ~= 'started' then return end +local ps = exports['ps-inventory'] + Inventory = Inventory or {} RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id, data) @@ -8,8 +10,12 @@ RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id, TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) end) +Inventory.HasItem = function(item) + return ps:HasItem(item) +end + Inventory.GetImagePath = function(item) local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item)) local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" -end \ No newline at end of file +end diff --git a/modules/inventory/qb-inventory/client.lua b/modules/inventory/qb-inventory/client.lua index fc28b4a..cfe6b5c 100644 --- a/modules/inventory/qb-inventory/client.lua +++ b/modules/inventory/qb-inventory/client.lua @@ -1,5 +1,7 @@ if GetResourceState('qb-inventory') ~= 'started' then return end +local qb = exports['qb-inventory'] + Inventory = Inventory or {} RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id, data) @@ -8,8 +10,12 @@ RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id, TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) end) +Inventory.HasItem = function(item) + return qb:HasItem(item) +end + Inventory.GetImagePath = function(item) local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item)) local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" -end \ No newline at end of file +end diff --git a/modules/inventory/qs-inventory/client.lua b/modules/inventory/qs-inventory/client.lua index a7b7c1d..819abe6 100644 --- a/modules/inventory/qs-inventory/client.lua +++ b/modules/inventory/qs-inventory/client.lua @@ -21,6 +21,11 @@ Inventory.GetItemInfo = function(item) return repackedTable end +Inventory.HasItem = function(item) + local check = quasar:Search(item) + return check and true or false +end + Inventory.GetImagePath = function(item) local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item)) local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item) diff --git a/modules/inventory/tgiann-inventory/client.lua b/modules/inventory/tgiann-inventory/client.lua index 9508c85..bef81e4 100644 --- a/modules/inventory/tgiann-inventory/client.lua +++ b/modules/inventory/tgiann-inventory/client.lua @@ -21,6 +21,10 @@ Inventory.GetItemInfo = function(item) return repackedTable end +Inventory.HasItem = function(item) + return tgiann:HasItem(item) +end + Inventory.GetImagePath = function(item) local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item)) local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item)) @@ -44,4 +48,4 @@ Inventory.GetPlayerInventory = function() }) end return items -end \ No newline at end of file +end