Merge pull request #35 from PenguScript/main

+ Inventory.HasItem
This commit is contained in:
MrNewb authored and GitHub committed 2025-02-17 14:27:29 -05:00
commit b9b90938d3
11 files changed
+55

No files matched your search

+5
View File
@@ -34,6 +34,11 @@ Framework.GetPlayerJob = function()
return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade
end end
Framework.HasItem = function(item)
local hasItem = ESX.SearchInventory(item, true)
return hasItem > 0 and true or false
end
Framework.GetPlayerInventory = function() Framework.GetPlayerInventory = function()
return ESX.GetPlayerData().inventory return ESX.GetPlayerData().inventory
end end
+6
View File
@@ -29,6 +29,12 @@ Framework.GetPlayerJob = function()
return group, title, title, grade return group, title, title, grade
end end
Framework.HasItem = function()
local itemCount = ox_inventory:Search('count', item)
local hasItem = itemCount ~= 0
return hasItem
end
Framework.GetPlayerInventory = function() Framework.GetPlayerInventory = function()
return exports.ox_inventory:GetPlayerItems() return exports.ox_inventory:GetPlayerItems()
end end
+4
View File
@@ -57,6 +57,10 @@ Framework.GetPlayerJob = function()
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
end end
Framework.HasItem = function(item)
return QBCore.Functions.HasItem(item)
end
Framework.GetPlayerInventory = function() Framework.GetPlayerInventory = function()
local items = {} local items = {}
local frameworkInv = QBCore.Functions.GetPlayerData().items local frameworkInv = QBCore.Functions.GetPlayerData().items
+4
View File
@@ -5,6 +5,10 @@ Inventory.GetItemInfo = function(item)
return Framework.GetItemInfo(item) return Framework.GetItemInfo(item)
end end
Inventory.HasItem = function(item)
return Framework.HasItem(item)
end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135" return "https://avatars.githubusercontent.com/u/47620135"
end end
@@ -1,5 +1,6 @@
if GetResourceState('jpr-inventory') ~= 'started' then return end if GetResourceState('jpr-inventory') ~= 'started' then return end
local jpr = exports['jpr-inventory']
Inventory = Inventory or {} Inventory = Inventory or {}
RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id, data) RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id, data)
@@ -8,6 +9,10 @@ RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id,
TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
end) end)
Inventory.HasItem = function(item)
return jpr:HasItem(item)
end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", 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) local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item)
@@ -17,6 +17,10 @@ Inventory.GetItemInfo = function(item)
return repackedTable or {} return repackedTable or {}
end end
Inventory.HasItem = function(item)
return origin:HasItem(item)
end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", 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) local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item)
@@ -17,6 +17,12 @@ Inventory.GetItemInfo = function(item)
return repackedTable return repackedTable
end end
Inventory.HasItem = function(item)
local itemCount = ox_inventory:Search('count', item)
local hasItem = itemCount ~= 0
return hasItem
end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", 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) local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item)
@@ -1,5 +1,7 @@
if GetResourceState('ps-inventory') ~= 'started' then return end if GetResourceState('ps-inventory') ~= 'started' then return end
local ps = exports['ps-inventory']
Inventory = Inventory or {} Inventory = Inventory or {}
RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id, data) RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id, data)
@@ -8,6 +10,10 @@ RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id,
TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
end) end)
Inventory.HasItem = function(item)
return ps:HasItem(item)
end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", 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) local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item)
@@ -1,5 +1,7 @@
if GetResourceState('qb-inventory') ~= 'started' then return end if GetResourceState('qb-inventory') ~= 'started' then return end
local qb = exports['qb-inventory']
Inventory = Inventory or {} Inventory = Inventory or {}
RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id, data) RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id, data)
@@ -8,6 +10,10 @@ RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id,
TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
end) end)
Inventory.HasItem = function(item)
return qb:HasItem(item)
end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", 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) local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item)
@@ -21,6 +21,11 @@ Inventory.GetItemInfo = function(item)
return repackedTable return repackedTable
end end
Inventory.HasItem = function(item)
local check = quasar:Search(item)
return check and true or false
end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", 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) local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item)
@@ -21,6 +21,10 @@ Inventory.GetItemInfo = function(item)
return repackedTable return repackedTable
end end
Inventory.HasItem = function(item)
return tgiann:HasItem(item)
end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", 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)) local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item))