From e64912622b838f297785adb19c93d46e1670b3d8 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Tue, 13 May 2025 17:57:27 +0100 Subject: [PATCH] Testing a fix with QS-INV item checks So..from what I can gather, QS-Inv doesn't seem to be updating the client cache of the players inventory correctly This is all speculation, I can't check this myself When `hasItem()` is used, its essentially reading from the client's cache. This seemingly is only updated when there is a new item in a slot, **not** when the amount of an item in that slot changes The only way to circumvent this is a workaround to the players inventory from the server side using a callback. This is painful to do because it can increase server load when checking multiples of items --- shared/inventories.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared/inventories.lua b/shared/inventories.lua index f9826ae..96ae2d6 100644 --- a/shared/inventories.lua +++ b/shared/inventories.lua @@ -99,7 +99,8 @@ function getPlayerInv(src) if src then grabInv = exports[QSInv]:GetInventory(src) else - grabInv = exports[QSInv]:getUserInventory() + --grabInv = exports[QSInv]:getUserInventory() + grabInv = triggerCallback(getScript().."getServerInvData", GetPlayerServerId(PlayerId())) end elseif isStarted(OrigenInv) then @@ -171,6 +172,10 @@ function getPlayerInv(src) return grabInv, foundInv end +createCallback(getScript()..":getServerInvData", function(source) + local src = source + return getPlayerInv(src) +end) function isInventoryOpen() if isStarted(OXInv) then