From 76c34b8c0376f2260b93a642102e978e32d39ffa Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Wed, 4 Jun 2025 13:53:49 +0100 Subject: [PATCH] Unify `isInventoryOpen()` function This should fix issues for crafting complaining inventories are open when they aren't I was trying to use per inventory checks for them being open until I realised I could just use `IsNuiFocused()` for all inventories to check if there was an nui on the screen that used the mouse, this should be a good workaround for it --- shared/inventories.lua | 51 +++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/shared/inventories.lua b/shared/inventories.lua index 2fa671f..9e850a2 100644 --- a/shared/inventories.lua +++ b/shared/inventories.lua @@ -176,39 +176,44 @@ function getPlayerInv(src) end function isInventoryOpen() - if isStarted(OXInv) then - return LocalPlayer.state.invBusy - elseif isStarted(QSInv) then - return exports[QSInv]:inInventory() + return IsNuiFocused() - elseif isStarted(OrigenInv) then - return exports[OrigenInv]:IsInventoryOpen() + --if isStarted(OXInv) then + -- return LocalPlayer.state.invBusy - elseif isStarted(CoreInv) then - return exports[CoreInv]:isInventoryOpen() + --elseif isStarted(QSInv) then + -- return exports[QSInv]:inInventory() - elseif isStarted(CodeMInv) then - return false - -- CodeM doesn't have a function to check if the inventory is open - -- No idea what it uses, so it just skips the check + --elseif isStarted(OrigenInv) then + -- return exports[OrigenInv]:IsInventoryOpen() - elseif isStarted(TgiannInv) then - return exports[TgiannInv]:IsInventoryActive() + --elseif isStarted(CoreInv) then + -- return exports[CoreInv]:isInventoryOpen() - elseif isStarted(QBInv) then - return LocalPlayer.state.inv_busy + --elseif isStarted(CodeMInv) then + -- return false + -- -- CodeM doesn't have a function to check if the inventory is open + -- -- No idea what it uses, so it just skips the check - elseif isStarted(PSInv) then - return LocalPlayer.state.inv_busy + --elseif isStarted(TgiannInv) then + -- return IsNuiFocused() - elseif ESX and isStarted(ESXExport) then - return false + --elseif isStarted(QBInv) then + -- return LocalPlayer.state.inv_busy + + --elseif isStarted(PSInv) then + -- return LocalPlayer.state.inv_busy + + --elseif ESX and isStarted(ESXExport) then + -- return false + + --elseif isStarted(RSGInv) then + -- return LocalPlayer.state.inv_busy + + --end - elseif isStarted(RSGInv) then - return LocalPlayer.state.inv_busy - end end -------------------------------------------------------------