Configuration

This section includes all configurable files for the selected script. Most settings are configured automatically, but each config.lua file contains a header comment explaining the purpose and usage of every configuration type. Be sure to read the header of each file carefully to fully understand how to customize and adapt the system for QBCORE, ESX, or standalone environments, ensuring seamless integration with your server.


qs-lottery-creator/config.lua
--──────────────────────────────────────────────────────────────────────────────
--  Quasar Store · Configuration Guidelines
--──────────────────────────────────────────────────────────────────────────────
--  This configuration file defines all adjustable parameters for the script.
--  Comments are standardized to help you identify which sections you can safely edit.
--
--  • [EDIT] – Safe for users to modify. Adjust these values as needed.
--  • [INFO] – Informational note describing what the variable or block does.
--  • [ADV]  – Advanced settings. Change only if you understand the logic behind it.
--  • [CORE] – Core functionality. Do not modify unless you are a developer.
--  • [AUTO] – Automatically handled by the system. Never edit manually.
--
--  Always make a backup before editing configuration files.
--  Incorrect changes in [CORE] or [AUTO] sections can break the resource.
--──────────────────────────────────────────────────────────────────────────────

Config  = Config  or {}  -- [CORE] Main configuration table.
Locales = Locales or {}  -- [CORE] Multilanguage container (if used by your resource).

--──────────────────────────────────────────────────────────────────────────────
-- Framework & Dependency Autodetection                                        [AUTO]
-- [INFO] Detects a supported framework by resource name.
-- [ADV]  If you renamed framework resources, map them below.
--──────────────────────────────────────────────────────────────────────────────

---[CORE] Returns mapped alias of the first dependency found.
---@param data table<string,string> -- resourceName -> alias
---@return string|false
local function DependencyCheck(data)
    for k, v in pairs(data) do
        if GetResourceState(k):find('started') ~= nil then
            return v
        end
    end
    return false
end

-- [CORE] Known frameworks → internal alias
local frameworks = {
    ['es_extended'] = 'esx',
    ['qb-core']     = 'qb',
    ['qbx_core']    = 'qb',
}

Config.Framework = DependencyCheck(frameworks) -- [AUTO]

--──────────────────────────────────────────────────────────────────────────────
-- Language & Targeting                                                        [EDIT]
-- 'ar','bg','ca','cs','da','de','el','en','es','fa','fr','he','hi','hu','it','jp','ko',
-- 'nl','no','pl','pt','ro','ru','sl','sv','th','tk','tr','zh-CN','zh-TW'
--──────────────────────────────────────────────────────────────────────────────
Config.Language  = 'en'   -- [EDIT] Two-letter language code for your locales (if available).
Config.UseTarget = false  -- [EDIT] true to use target systems (qb-target/ox_target) if integrated.

--──────────────────────────────────────────────────────────────────────────────
-- Universal Vendor Settings                                                   [EDIT]
-- [INFO] All vendor parameters are centralized here for easier adjustments.
--──────────────────────────────────────────────────────────────────────────────
Config.VendorSettings = {
    label           = 'Lottery Machine',           -- [EDIT] Title used in menus and notifications.
    item            = 'scratchcard',               -- [EDIT] The item sold by the machine.
    price           = 50,                          -- [EDIT] Purchase price per scratchcard.
    accountToCharge = 'money',                     -- [EDIT] Account type to charge ('money' or 'bank').
    prop            = 'lotrrery_vending_machine',         -- [EDIT] Object model used for the in-world machine.
}

--──────────────────────────────────────────────────────────────────────────────
-- Rewards Table                                                                [EDIT]
-- [INFO] Each entry defines a possible outcome when using a scratchcard.
--        • label  – Display text for the result.
--        • type   – 'money' to pay out framework cash, or 'none' for no prize.
--        • amount – Amount given when this prize is rolled.
--        • chance – Probability weight (not strict % unless you normalize).
--──────────────────────────────────────────────────────────────────────────────
Config.PossibleRewards = {
    { label='NO WIN',  type='none',  amount=0,    chance=80   },
    { label='$10',     type='money', amount=10,   chance=5    },
    { label='$50',     type='money', amount=50,   chance=3    },
    { label='$150',    type='money', amount=150,  chance=1    },
    { label='$250',    type='money', amount=250,  chance=0.5  },
    { label='$1,000',  type='money', amount=1000, chance=0.2  },
}

--──────────────────────────────────────────────────────────────────────────────
-- Win Animation                                                                [EDIT]
-- [INFO] Optional animation played when a player wins.
--──────────────────────────────────────────────────────────────────────────────
Config.EnableWinAnim = false -- [EDIT] true to play the animation on win.
Config.WinAnim = {
    dict     = 'anim@mp_player_intcelebrationmale@knuckle_crunch', -- [EDIT]
    anim     = 'knuckle_crunch',                                   -- [EDIT]
    duration = 2500                                                -- [EDIT] Duration in ms.
}

--──────────────────────────────────────────────────────────────────────────────
-- Interaction & Debug                                                          [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Config.VendorInteractDistance = 2.0 -- [EDIT] Max distance to interact with the machine (in meters).
Config.Debug                  = false -- [EDIT] Enable extra prints/markers to help diagnose issues.