From f069db5c61e2680dcb9ca746a6816b8575880877 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Wed, 7 May 2025 16:36:18 +0100 Subject: [PATCH] Update QBInv stash retrieval Now uses GetInventory to grab the stash from its cache instead of directly from database Also fixes old qb inv support for stash retrieval --- shared/stashcontrol.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shared/stashcontrol.lua b/shared/stashcontrol.lua index d7aa7f9..477e888 100644 --- a/shared/stashcontrol.lua +++ b/shared/stashcontrol.lua @@ -59,7 +59,7 @@ function GetStashTimeout(stashName, stop) -- If timeout has expired, update the stash items from the server. if stashCache[stashName].timeout <= 0 then stashCache[stashName].items = triggerCallback(getScript()..':server:GetStashItems', stashName) - stashCache[stashName].timeout = 15000 -- Timeout in milliseconds. + stashCache[stashName].timeout = 10000 -- Timeout in milliseconds. CreateThread(function() while stashCache[stashName] and stashCache[stashName].timeout > 0 do stashCache[stashName].timeout -= 1000 @@ -270,13 +270,13 @@ function getStash(stashName) elseif isStarted(QBInv) then stashResource = QBInv - local result = MySQL.scalar.await("SELECT items FROM "..(QBInvNew and "inventories" or "stashitems").." WHERE identifier = ?", { stashName }) - if result then stashItems = json.decode(result) end - - elseif isStarted(PSInv) then - stashResource = PSInv - local result = MySQL.scalar.await("SELECT items FROM stashitems WHERE identifier = ?", { stashName }) - if result then stashItems = json.decode(result) end + if QBInvNew then + local result = exports[QBInv]:GetInventory(stashName) or {} + stashItems = result.items or {} + else + local result = MySQL.scalar.await("SELECT items FROM stashitems WHERE stash = ?", { stashName }) + if result then stashItems = json.decode(result) end + end elseif isStarted(RSGInv) then stashResource = RSGInv