S_utils

ESX = exports.es_extended:getSharedObject()

function HasItems(src, item)
    local Player = ESX.GetPlayerFromId(src)
    if GetResourceState("ox_inventory") == "started" then
        return exports.ox_inventory:GetItemCount(src, item)
    end
end

function HasItemsAmount(src, item, amount)
    local Player = ESX.GetPlayerFromId(src)
    if GetResourceState("ox_inventory") == "started" then
        if exports.ox_inventory:GetItemCount(Player, item) >= amount then
            return amount
        end
    end
end

function AddItem(src, item, amount)
    local Player = ESX.GetPlayerFromId(src)
    if GetResourceState("ox_inventory") == "started" then
        return exports.ox_inventory:AddItem(src, item, amount)
    end
end

function RemoveItem(src, item, amount)
    local Player = ESX.GetPlayerFromId(src)
    if GetResourceState("ox_inventory") == "started" then
        return exports.ox_inventory:RemoveItem(src, item, amount)
    end
end

function AddMoney(src, amount)
    local Player = ESX.GetPlayerFromId(src)
    if GetResourceState("ox_inventory") == "started" then
        return exports.ox_inventory:AddItem(src, "cash", amount)
    end
end

Last updated