Snippets

Coin Voucher Item

Example of a 100-coin voucher item using ox_inventory. When used, the player receives 100 coins.

-- Item definition
['voucher_100'] = {
    label = 'voucher 100 coins',
    weight = 220,
    stack = true,
    close = true,
    server = {export = "ox_inventory.use_voucher"},
    metadata = {value = 100}
}

-- Export added to ox_inventory
exports("use_voucher", function(event, item, inventory, slot, data)
      if event == 'usedItem' then
            exports["LuxuVipShop"]:UpdateCoinBalance(inventory.id, item.metadata.value, "add")
      end
end)