Requirements
Nothing. No database, no ox_lib, no external dependencies.
If you already run ox_lib, ox_inventory or qb-inventory, they are detected and used automatically.
Halloween sale
Shop nowSetup, configuration and exports for DD-Giftcodes, written alongside the code and shipped with every download.
A gift code system for FiveM. Staff create codes in a glass admin panel and pick rewards from a live list of your server's items; players redeem them in a single-field panel. Works on QBCore, Qbox and ESX, with ox_inventory and qb-inventory style inventories, all detected automatically.
Nothing. No database, no ox_lib, no external dependencies.
If you already run ox_lib, ox_inventory or qb-inventory, they are detected and used automatically.
DD-Giftcodes folder into your resources directory.server.cfg, after your framework and inventory:
ensure DD-Giftcodes
Config.Admin.groups (admin, superadmin,
god by default), or use an ACE:
add_ace group.admin DD-Giftcodes.admin allow
The console prints what was detected:
[DigitalDEN] DD-Giftcodes v1.0.0 started
[DigitalDEN] Framework: qb | Inventory: ox | Notify: custom | Codes loaded: 0
That is the whole install. No SQL file is needed. Codes are stored in
data/codes.json inside the resource and persist through
restarts, so there is nothing to import and nothing to maintain.
| Command | Who | Description |
|---|---|---|
/giftcode | Everyone | Opens the redeem panel |
/giftcodesadmin | Staff | Opens the gift code manager |
Both names are set in config.lua. An optional rebindable keybind is there too, off by default:
Config.Keybind = {
enabled = true,
key = 'F7',
description = 'Open Gift Codes'
}
Everything lives in config.lua, which stays editable after purchase.
Config.Framework = 'auto' -- 'auto' | 'qbx' | 'qb' | 'esx'
Config.Inventory = 'auto' -- 'auto' | 'ox' | 'qb' | 'esx'
| Detected | Framework source | Inventory source |
|---|---|---|
qbx_core | Qbox | ox_inventory |
qb-core | QBCore | qb / ps / lj / qs-inventory |
es_extended | ESX | ox_inventory or ESX inventory |
Config.Notify = 'custom' -- 'custom' | 'ox' | 'qb' | 'esx' | 'event'
custom is the built-in DigitalDEN toast, styled to match the
panels. To route notifications into your own system instead:
Config.Notify = 'event'
Config.NotifyEvent = 'myNotify:show'
-- fired client side as: TriggerEvent(name, message, type)
-- type: 'success' | 'error' | 'info'
The admin panel builds its money fields from this list, so add whatever accounts your framework uses:
Config.Accounts = {
{ name = 'cash', label = 'Cash' },
{ name = 'bank', label = 'Bank' }
}
Item icons in the picker come from your detected inventory. Override the folder for a custom inventory:
Config.ItemImages = {
path = 'nui://my-inventory/html/images/',
extension = '.png'
}
Presets appear as one-click chips under the create form:
Config.Presets = {
{
label = 'Starter Pack',
reward = {
accounts = { cash = 5000 },
items = { { name = 'bread', amount = 5 } }
}
}
}
Config.Codes = {
cooldown = 3, -- seconds between redeem attempts
maxFailedAttempts = 8, -- wrong guesses before a timeout
failedAttemptsTimeout = 300 -- length of that timeout, in seconds
}
Config.UI sets the server name, panel title and accent colour,
and the accent drives the glow, borders and buttons across the whole
interface.
Config.LocaleUI holds every word shown inside the panels and
Config.Locale holds every notification message, so the script
can be fully translated without touching any other file.
O/0, I/1).Create a code from another script: a Discord bot, a vote reward, a shop.
exports['DD-Giftcodes']:CreateCode('WELCOME2025', {
accounts = { cash = 5000 },
items = { { name = 'bread', amount = 2 } }
}, {
maxUses = 100,
oncePerPlayer = true,
expires = os.time() + 604800 -- optional unix timestamp, 0 or nil = never
})
exports['DD-Giftcodes']:DeleteCode('WELCOME2025')
exports['DD-Giftcodes']:GetCodes() -- every code with its usage
exports['DD-Giftcodes']:GetCode('WELCOME2025') -- one code, or nil
exports['DD-Giftcodes']:OpenRedeem()
exports['DD-Giftcodes']:OpenAdmin()
exports['DD-Giftcodes']:IsAdmin()
Fired on the server after every successful redeem, which is what you want for Discord logging:
AddEventHandler('DD-Giftcodes:server:onRedeem', function(source, code, reward)
print(('%s redeemed %s'):format(GetPlayerName(source), code))
end)
Open a ticket and bring your console output from resource start. The banner tells us exactly which framework, inventory and notification system were detected. Support is 11:00 to 23:00 UK, every day.
Open a ticket