HKN Works Logo
HKN Works/Docs/hkn-works-resources

Agents can also search and read this documentation through its MCP server.

Installation

Installation

Requirements

Resource Description
oxmysql Required. Used to store the vouchers.
qb-core or es_extended Framework used to give the items.

General Setup

  1. Extract the resource into your server's resources folder.
  2. Make sure the folder name is strictly hkn_voucher.
  3. Import the install.sql file into your database.
  4. Open shared/config.lua and set your framework, admin identifiers and inventory image path.
  5. Open your server.cfg.
  6. Make sure oxmysql and your framework are started before this script.
  7. Add the following line:
ensure oxmysql
ensure qb-core # or es_extended

ensure hkn_voucher

Database

The install.sql file creates the table used to store the vouchers.

CREATE TABLE IF NOT EXISTS `hkn_vouchers` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `code` VARCHAR(50) NOT NULL UNIQUE,
  `items` LONGTEXT NOT NULL,
  `uses_left` INT NOT NULL DEFAULT 1,
  `claimed_by` LONGTEXT NOT NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Usage

Commands

Command Description
/voucher Opens the dashboard to create, list, edit and delete vouchers. Admins only.
/voucherkey Opens the menu where players enter a code to claim a voucher.

Note: Each player can claim a voucher only once. A voucher is deleted automatically when it has no uses left.


Configuration

Below are all available configuration options for hkn_voucher. The config file is located at shared/config.lua.

Update Check

Enable or disable the version check on resource start.

Config.UpdateCheck = true

Language

Select the language used by the interface.

Config.Locale = 'tr'

Theme Color

Customize the interface theme color.

Config.ThemeColor = '#ff0066'

Admin Identifiers

Players allowed to open the voucher dashboard.

Config.AdminIdentifiers = {
    'steam:110000100000000',
    -- 'license:abc1234567890def',
}

Framework

Select the framework your server is running.

Config.Framework = 'qbcore'

Discord Webhook

Webhook used for the creation and redemption logs.

Config.DiscordWebhook = ''

Image Path

Path to your inventory's item images.

Config.ImagePath = 'nui://qb-inventory/html/images/'

Commands

Change the commands used by the script.

Config.Commands = {
    CreateVoucher = 'voucher',
    ClaimVoucher = 'voucherkey'
}

Options

Setting Description
CreateVoucher Command that opens the voucher dashboard.
ClaimVoucher Command that opens the claim menu.

Voucher Items

Items that can be added to a voucher are listed in shared/items.lua.

Config.VoucherItems = {
    { name = 'weapon_pistol', label = 'Walther P99' },
    { name = 'weapon_knife', label = 'Knife' },
}

For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs; this page is available as Markdown.