server/no_escrow.lua
-- | # Inventory (ox_inventory) -------------------------------------------
Has_Item = function(source, item, amount)
amount = amount or 1
local Count = exports.ox_inventory:Search(source, 'count', item)
return Count and Count >= amount
end
Add_Item = function(source, item, amount)
amount = amount or 1
return exports.ox_inventory:AddItem(source, item, amount)
end
Remove_Item = function(source, item, amount, slot)
amount = amount or 1
return exports.ox_inventory:RemoveItem(source, item, amount, nil, slot)
end
-- | # Metadata Operations -------------------------------------------------
Add_Item_With_Metadata = function(source, item, amount, metadata)
amount = amount or 1
return exports.ox_inventory:AddItem(source, item, amount, metadata)
end
Get_Item_By_Slot = function(source, slot)
local Item = exports.ox_inventory:GetSlot(source, slot)
if not Item then return nil end
return { name = Item.name, slot = Item.slot, amount = Item.count, metadata = Item.metadata or {} }
end
Set_Item_Metadata = function(source, slot, metadata)
exports.ox_inventory:SetMetadata(source, slot, metadata)
return true
end
-- | # Notification ---------------------------------------------------------
Notification = function(source, message, type)
type = type or 'info'
TriggerClientEvent('ox_lib:notify', source, {
description = message,
type = type,
})
endLast updated