okokDocs
  • About Us
  • Scripts
    • okokVehicleControl
      • Config file
    • okokMechanicJob
      • Config file
    • okokPoliceJob
      • Config file
      • qb-inventory support
    • okokBossMenu
      • Config file
    • okokMulticharacter
      • Config file
    • okokPhone
    • okokSpawnSelector
      • Config file
      • qb-multicharacter support
    • okokLoadingScreen
      • Config file
    • okokVehicleSales
      • Config file
    • okokShop
      • Config file
    • okokGasStation
      • Config file
    • okokTuning
      • Config file
    • okokGarage
      • Config file
      • RGB vehicle colors
      • Inventories metadata
      • Housing integrations
      • qb-phone support
    • okokVehicleShop
      • Config file
      • Common errors
    • okokBanking
      • Config file
      • Paycheck transactions
      • Registering transactions
    • okokMarketplace
      • Config file
      • Common errors
    • okokChat
      • Config file
      • Export
    • okokBilling
      • Config file
      • Snippets
    • okokCrafting
      • Config file
    • okokContract
      • Config file
    • okokTalkToNPC
      • Config file
    • okokReports
      • Config file
    • okokNotify
      • Config file
      • Snippets
    • okokTextUI
      • Config file
      • Snippets
    • okokRequests
    • okokDeleteVehicles
      • Config file
  • Others
    • Discord Webhook
Powered by GitBook
On this page
  1. Scripts
  2. okokPoliceJob

qb-inventory support

MOST RECENT VERSION ONLY

Navigate to server/main.lua and after print(#result .. ' inventories successfully loaded'), add the following code:

canClear = true

Then, go to server/functions.lua, and paste following code after exports('ClearInventory', ClearInventory):

local canClear = false

function ClearInventoryByName(inventory)
    local stopThread = false
    CreateThread(function()
        while not canClear and not stopThread do
            Wait(100)
            local player = QBCore.Functions.GetPlayer(source)
            for k,v in pairs(Inventories) do
                if k == inventory then
                    print('Inventory found, clearing...')
                    print('Inventory: ' .. k)
                    Inventories[k] = nil
                    stopThread = true
                    break
                end
            end
        end
    end)
end

exports('ClearInventoryByName', ClearInventoryByName)
PreviousConfig fileNextokokBossMenu

Last updated 10 months ago