if Config.Inventory ~= "framework" then return end if Config.Framework == "es_extended" then --- @param itemName string --- @return boolean function JobCenterHasItem(itemName) if Config.Core.SearchInventory then local item = Config.Core.SearchInventory(itemName) return item ~= nil and (tonumber(item.count) or 0) > 0 end local items = Config.Core.PlayerData and Config.Core.PlayerData.inventory or {} for i = 1, #items do if items[i].name == itemName then return (tonumber(items[i].count) or 0) > 0 end end return false end RegisterNetEvent("esx:removeInventoryItem", function(item, count) Debugprint("Removing item: " .. tostring(item) .. " Count: " .. tostring(count)) if Config.ItemName[item] and PhoneUniqueId and LastItemData and LastItemData.name == item then ItemPhoneDeleted() end end) RegisterNetEvent("esx:addInventoryItem", function(item) if Config.ItemName[item] and PhoneUniqueId == nil then ForceLoadPhone(item) end end) elseif Config.Framework == "qb-core" or Config.Framework == "qbx_core" then RegisterNetEvent('QBCore:Player:SetPlayerData', function(val) Debugprint('QBCore:Player:SetPlayerData', val) if not LocalPlayer.state.isLoggedIn then return end if PlayerData.job == nil then return end Wait(1000) local item = val.items if not item then return end item = type(item) == "string" and json.decode(item) or item local itemCheck = false for _, v in pairs(item) do if v and Config.ItemName[v.name] and LastItemData and v.name == LastItemData.name then if Config.MetaItem then local metadata = v.metadata or v.info if metadata and metadata.phoneID == PhoneUniqueId then itemCheck = true break end else itemCheck = true break end end end if not itemCheck and Config.ItemRequire then ItemPhoneDeleted() end if PhoneUniqueId == nil then ForceLoadPhone() end end) end