From a4959882b31f9043f9335cdb56818e44a9df86b7 Mon Sep 17 00:00:00 2001 From: ONyambura <51477970+ONyambura@users.noreply.github.com> Date: Fri, 26 Sep 2025 19:02:30 +0300 Subject: [PATCH] FIX - QB-Core - Framework/Inventory - Item properties fix QB-Core Framework. Some inventories has item property `count` instead of `amount`. +/- Added fallback to `count` if `amount` doesn't exists. --- modules/framework/qb-core/client.lua | 4 ++-- modules/framework/qb-core/server.lua | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/framework/qb-core/client.lua b/modules/framework/qb-core/client.lua index 21b5dac..a58be12 100644 --- a/modules/framework/qb-core/client.lua +++ b/modules/framework/qb-core/client.lua @@ -184,7 +184,7 @@ Framework.GetItemCount = function(item) local count = 0 for _, v in pairs(frameworkInv) do if v.name == item then - count = count + v.amount + count = count + (v.amount or v.count) end end return count @@ -199,7 +199,7 @@ Framework.GetPlayerInventory = function() table.insert(items, { name = v.name, label = v.label, - count = v.amount, + count = v.amount or v.count, slot = v.slot, metadata = v.info, stack = v.unique, diff --git a/modules/framework/qb-core/server.lua b/modules/framework/qb-core/server.lua index 765855d..4601ec5 100644 --- a/modules/framework/qb-core/server.lua +++ b/modules/framework/qb-core/server.lua @@ -100,7 +100,7 @@ Framework.GetItem = function(src, item, metadata) if v.name == item and (not metadata or v.info == metadata) then table.insert(repackedTable, { name = v.name, - count = v.amount, + count = v.amount or v.count, metadata = v.info, slot = v.slot, }) @@ -141,7 +141,7 @@ Framework.GetItemCount = function(src, item, metadata) local count = 0 for _, v in pairs(playerInventory) do if v.name == item and (not metadata or v.info == metadata) then - count = count + v.amount + count = count + (v.amount or v.count) end end return count @@ -170,7 +170,7 @@ Framework.GetPlayerInventory = function(src) for _, v in pairs(playerInventory) do table.insert(repackedTable, { name = v.name, - count = v.amount, + count = v.amount or v.count, metadata = v.info, slot = v.slot, }) @@ -206,7 +206,7 @@ Framework.GetItemBySlot = function(src, slot) name = v.name, label = v.label, weight = v.weight, - count = v.amount, + count = v.amount or v.count, metadata = v.info, slot = v.slot, stack = v.unique or false,