Remove Item
By default, our scripts are ready to use with qb and esx inventories.
If you want to modify the functions to another inventory, for example OX_Inventory or QS-Inventory here we show you how to do it. If it is another inventory you will have to check the documentation provided by its developer and adapt it.
QB + QB-Inventory
function removeItem(playerID, item, amount)
local player = QBCore.Functions.GetPlayer(playerID)
if player then
player.Functions.RemoveItem(item, amount)
end
end
QB + OX_Inventory
function removeItem(playerID, item, amount)
exports.ox_inventory:RemoveItem(playerID, item, amount)
end
QB + QS-Inventory
function removeItem(playerID, item, amount)
exports['qs-inventory']:RemoveItem(playerID, item, amount)
end
ESX
function removeItem(playerID, item, amount)
local xPlayer = ESX.GetPlayerFromId(playerID)
if xPlayer then
xPlayer.removeInventoryItem(item, amount)
end
end
Last updated