From 8d321f20cff92934067159d605cee5ee885aa154 Mon Sep 17 00:00:00 2001 From: Nordi98 Date: Sun, 27 Jul 2025 03:11:16 +0200 Subject: [PATCH] Update open.lua --- .../[Scripts]/pug-sling/client/open.lua | 99 +++++++++---------- 1 file changed, 47 insertions(+), 52 deletions(-) diff --git a/resources/[weapons]/[Scripts]/pug-sling/client/open.lua b/resources/[weapons]/[Scripts]/pug-sling/client/open.lua index 519e4e391..c001f1d4f 100644 --- a/resources/[weapons]/[Scripts]/pug-sling/client/open.lua +++ b/resources/[weapons]/[Scripts]/pug-sling/client/open.lua @@ -55,60 +55,55 @@ if not Config.UseOldSlingScript then end -- INVENTORY HAS ITEM CHECK - function CheckHasWeapon(Weapon) - if GetResourceState("qs-inventory") == 'started' then - local count = exports['qs-inventory']:Search(Weapon) - if count > 0 then - return true - else - return false - end - elseif GetResourceState("qb-inventory") == 'started' then - return exports['qb-inventory']:HasItem(Weapon) - elseif GetResourceState("ps-inventory") == 'started' then - return exports['ps-inventory']:HasItem(Weapon) - elseif GetResourceState("ox_inventory") == 'started' then - local count = exports.ox_inventory:GetItemCount(Weapon) - if count > 0 then - return true - else - return false - end - elseif GetResourceState("tgiann-inventory") == 'started' then - local count = exports["tgiann-inventory"]:Items(Weapon) - print("Miho output... \n Weapon: "..Weapon) - - if count then - return true - else - return false - end - elseif GetResourceState("core_inventory") == 'started' then - if Framework == "QBCore" then - local citizenid = FWork.Functions.GetPlayerData().citizenid - local Primary = exports['core_inventory']:getItems('primary-' .. citizenid, Weapon) - local Secondry = exports['core_inventory']:getItems('secondry-' .. citizenid, Weapon) - if Primary > 0 or Secondry > 0 then - return true - else - return false - end - else - return false - end - elseif Framework == "QBCore" then - local FinalValue = false - local items = FWork.Functions.GetPlayerData().items - for _, v in pairs(items) do - if v.name ~= nil then - if tostring(v.name) == tostring(Weapon) then - FinalValue = true - end - end - end - return FinalValue +function CheckHasWeapon(Weapon) + if GetResourceState("qs-inventory") == 'started' then + local count = exports['qs-inventory']:Search(Weapon) + if count > 0 then + return true + else + return false end + elseif GetResourceState("qb-inventory") == 'started' then + return exports['qb-inventory']:HasItem(Weapon) + elseif GetResourceState("ps-inventory") == 'started' then + return exports['ps-inventory']:HasItem(Weapon) + elseif GetResourceState("ox_inventory") == 'started' then + local count = exports.ox_inventory:GetItemCount(Weapon) + if count > 0 then + return true + else + return false + end + elseif GetResourceState("tgiann-inventory") == 'started' then + -- Fixed implementation for tgiann-inventory + return exports["tgiann-inventory"]:HasItem(Weapon, 1) + elseif GetResourceState("core_inventory") == 'started' then + if Framework == "QBCore" then + local citizenid = FWork.Functions.GetPlayerData().citizenid + local Primary = exports['core_inventory']:getItems('primary-' .. citizenid, Weapon) + local Secondry = exports['core_inventory']:getItems('secondry-' .. citizenid, Weapon) + if Primary > 0 or Secondry > 0 then + return true + else + return false + end + else + return false + end + elseif Framework == "QBCore" then + local FinalValue = false + local items = FWork.Functions.GetPlayerData().items + for _, v in pairs(items) do + if v.name ~= nil then + if tostring(v.name) == tostring(Weapon) then + FinalValue = true + end + end + end + return FinalValue end +end + local function CheckJobVerified() local PlayerJob = Config.FrameworkFunctions.GetPlayer().PlayerData.job.name