# 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.

***

<details>

<summary>qs-advancedracing/shared/main.lua</summary>

```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.
--──────────────────────────────────────────────────────────────────────────────

-- Check enums.lua for the vehicle classes and etc.

Config = {} -- [CORE]

--──────────────────────────────────────────────────────────────────────────────
-- Language Selection                                                          [EDIT]
-- [INFO] Select your preferred language for this asset (see locales/*).
--──────────────────────────────────────────────────────────────────────────────
Config.Locale = 'en' -- [EDIT]

--──────────────────────────────────────────────────────────────────────────────
-- Framework Detection                                                         [AUTO]
-- [INFO] Auto-detects ESX/QBCore. If renamed, adjust your framework adapters.
--──────────────────────────────────────────────────────────────────────────────
local frameworks = {
    ['es_extended'] = 'esx',
    ['qb-core']     = 'qb',
    ['qbx_core']    = 'qb'
}
Config.Framework = DependencyCheck(frameworks) -- [AUTO]

--──────────────────────────────────────────────────────────────────────────────
-- Competition / ELO                                                           [EDIT]
-- [INFO] Minimum ELO to create competitions and tag thresholds.
--──────────────────────────────────────────────────────────────────────────────
Config.CompetitionCreationMinElo = 1250 -- [EDIT]

-- Tags by elo points (Don't change the 0)
Config.Tags = { -- [EDIT]
    [0]     = 'newbie',
    [500]   = 'rookie',
    [1000]  = 'experienced',
    [2000]  = 'veteran',
    [3000]  = 'expert',
    [6000]  = 'master',
    [20000] = 'legend',
    [50000] = 'god',
}

--──────────────────────────────────────────────────────────────────────────────
-- Race Behaviour & Visuals                                                    [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Config.Ghost            = true          -- [EDIT] Enable ghost mode when racing.
Config.NoNpc            = true          -- [EDIT] Disable NPC cars when racing.
Config.CheckpointSize   = 10.0          -- [EDIT] Checkpoint marker size.
Config.DefaultBlipImage = 'https://img.gta5-mods.com/q95/images/street-races/76827a-20161227202832_1.jpg' -- [EDIT]

--──────────────────────────────────────────────────────────────────────────────
-- Vehicle Classes → Tiers                                                     [EDIT]
-- [INFO] Maps GTA vehicle classes to your internal tier (0..7 etc.).
--──────────────────────────────────────────────────────────────────────────────
Config.VehicleClasses = {
    [0]  = 7, -- Compacts = D
    [1]  = 6, -- Sedans = C
    [2]  = 4, -- SUVs = B
    [3]  = 5, -- Coupes = B
    [4]  = 4, -- Muscle = B
    [5]  = 3, -- Sports Classics = A
    [6]  = 3, -- Sports = A
    [7]  = 2, -- Super = A
    [8]  = 3, -- Motorcycles = S
    [9]  = 6, -- Off-road = C
    [10] = 7, -- Industrial = D
    [11] = 7, -- Utility = D
    [12] = 7, -- Vans = D
    [13] = 7, -- Cycles = D
    [14] = 3, -- Boats = S
    [15] = 2, -- Helicopters = X
    [16] = 2, -- Planes = X
    [17] = 6, -- Service = C
    [18] = 6, -- Emergency = C
    [19] = 6, -- Military = C
    [20] = 6, -- Commercial = C
    [21] = 6, -- Trains = C
}

--──────────────────────────────────────────────────────────────────────────────
-- Camera Animations (Showcase)                                                [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Config.CameraAnimations = {
    { distance = 4.0,  fovFrom = 20.0, fovTo = 35.0, from = 'front-middle', to = 'front-left' },
    { distance = 5.0,  fovFrom = 30.0, fovTo = 40.0, from = 'front-left',   to = 'left' },
    { distance = 6.0,  fovFrom = 40.0, fovTo = 35.0, from = 'back-middle',  to = 'back-right' },
    { distance = 5.0,  fovFrom = 30.0, fovTo = 30.0, from = 'back-right',   to = 'right' },
    { distance = 5.0,  fovFrom = 35.0, fovTo = 40.0, from = 'right',        to = 'front-right' },
    { distance = 8.0,  fovFrom = 50.0, fovTo = 50.0, from = 'top-middle',   to = 'front-middle' },
    { distance = 7.0,  fovFrom = 30.0, fovTo = 50.0, from = 'left',         to = 'top-middle' },
    { distance = 4.5,  fovFrom = 40.0, fovTo = 35.0, from = 'back-left',    to = 'back-right' },
    { distance = 3.5,  fovFrom = 25.0, fovTo = 30.0, from = 'right',        to = 'back-right' },
    { distance = 6.5,  fovFrom = 45.0, fovTo = 50.0, from = 'back-middle',  to = 'top-middle' }
}

--──────────────────────────────────────────────────────────────────────────────
-- Creator Settings                                                            [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Config.Creator = {}
Config.Creator.objectDistance     = 3.0  -- [EDIT] Default object distance.
Config.Creator.minObjectDistance  = 1.0  -- [EDIT]
Config.Creator.maxObjectDistance  = 20.0 -- [EDIT]

---@type {[string]: {justPress: boolean, keys: number}}
Config.Creator.keys = {
    objectPlace               = { justPress = true,  keys = 176 }, -- LShift + E (mapped)
    pointPlace                = { justPress = true,  keys = 38  }, -- E
    increaseObjectDistance    = { justPress = false, keys = 172 }, -- Up
    decreaseObjectDistance    = { justPress = false, keys = 173 }, -- Down
    turnLeftObjectRotation    = { justPress = false, keys = 174 }, -- Left
    turnRightObjectRotation   = { justPress = false, keys = 175 }, -- Right
    changeObject              = { justPress = true,  keys = 19  }, -- L ALT
    deleteObject              = { justPress = true,  keys = 36  }, -- L CTRL
    deleteCheckpoint          = { justPress = true,  keys = 178 }, -- Delete
}

--──────────────────────────────────────────────────────────────────────────────
-- Economy / Inputs                                                            [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Config.MoneyType          = 'money'   -- [EDIT] money, bank or black_money
Config.TabletItem         = 'tablet'  -- [EDIT] Item to open race tablet (nil to disable)
Config.AccessTabletWithKey= 'F10'     -- [EDIT] Key to open tablet (nil to disable)

-- Splits work as follows: [x] = y means position x gets y % of the profit
Config.Splits = { -- [EDIT]
    three = { [1] = 0.7, [2] = 0.3 },
    more  = { [1] = 0.6, [2] = 0.3, [3] = 0.1 }
}

--──────────────────────────────────────────────────────────────────────────────
-- Creator Objects & Effects                                                   [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Config.Creator.objects = {
    joaat('prop_offroad_tyres02'),
    joaat('stt_prop_flagpole_2e')
}

Config.Creator.particledObjects = { -- [EDIT] Particle FX near object.
    [joaat('prop_offroad_tyres02')] = true,
}

--──────────────────────────────────────────────────────────────────────────────
-- Intl Formatting                                                             [EDIT]
-- [INFO] Affects UI currency formatting.
--──────────────────────────────────────────────────────────────────────────────
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
Config.IntlSettings = {
    locale = 'en-US',
    options = {
        style = 'currency',
        currency = 'USD'
    }
}

--──────────────────────────────────────────────────────────────────────────────
-- Feed / Events / Timers                                                      [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Config.RecentEvents = {
    winner              = 'Competition winner on track: %s',
    create_track        = 'Created a new track: %s',
    create_competition  = 'Created a new competition: %s'
}

Config.DnfTimer = 120 -- [EDIT] DNF timer in seconds after the first player finishes.

--──────────────────────────────────────────────────────────────────────────────
-- Debug Options                                                               [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Config.Debug           = true  -- [EDIT] Verbose mode; disable in production.
Config.DebugSkipCamera = false -- [EDIT] Skip camera & timer in debug (unsafe for prod).

--──────────────────────────────────────────────────────────────────────────────
-- Server-Only Section                                                         [CORE]
-- [INFO] Everything below runs only on the server context.
--──────────────────────────────────────────────────────────────────────────────
if not IsDuplicityVersion() then
    return
end

local date = os.date('*t') -- [CORE]

---@param timeKey string
---@return number | false
function GetDefinedTime(timeKey) -- [CORE]
    local time = Config.PredefinedTimes[timeKey]
    if not time then
        Error('The defined time does not exist.', timeKey)
        return false
    end
    if type(time) == 'number' then
        return os.time() + time
    end
    if type(time) == 'table' then
        local currentTime = os.time()
        local newTime = os.time(time)
        if newTime < currentTime then
            Debug('The time is in the past, we will add a day to it.')
        end
        newTime = newTime + 86400
        if newTime < currentTime then
            Error('We add a day to the time and it is still in the past.', timeKey)
            return false
        end
        return newTime
    end
    Error('The time is not a valid type.', timeKey)
    return false
end

--──────────────────────────────────────────────────────────────────────────────
-- Predefined Times & Automation                                               [EDIT]
-- [INFO] Human-friendly presets for automated competition start times.
--──────────────────────────────────────────────────────────────────────────────
Config.PredefinedTimes = {
    ['60sec'] = 120, -- Every 60 seconds race will start
    ['2min']  = 120, -- Every 2 minutes race will start
    ['5min']  = 300, -- Every 5 minutes race will start
    ['every18'] = {  -- Specified date
        year = date.year,
        month = date.month,
        day = date.day,
        hour = 18,
        min = 0,
        sec = 0
    },
    ['every20'] = {  -- Specified date
        year = date.year,
        month = date.month,
        day = date.day,
        hour = 20,
        min = 0,
        sec = 0
    }
}

---@type AutomatedCompetition[]
Config.AutomatedCompetitions = {
    -- {
    --     id = 1,
    --     tracks = nil,          -- trackId or {trackIds}; nil = random verified track
    --     minElo = 100,
    --     startTime = 'every18', -- Uses predefined keys above
    --     vehicle_class = 3,     -- 1 = none
    --     prize = 50000,
    --     laps = 0               -- 0 = sprint
    -- }
}

Config.AutomatedUser = { -- [EDIT]
    name   = 'Automated',
    avatar = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSRRYBOO_9QMR5ZPJbtkVM1mNhmmTqAcfh2nQ&s',
}

```

</details>

<details>

<summary>qs-advancedracing/shared/enums.lua</summary>

```lua
--──────────────────────────────────────────────────────────────────────────────
-- Enumerations                                                                [CORE]
-- [INFO] Do NOT change the enum keys. You may change the values safely.
-- [INFO] Keep values synchronized with ui/enums/index.js to prevent UI mismatch.
--──────────────────────────────────────────────────────────────────────────────
Enums = {}

--──────────────────────────────────────────────────────────────────────────────
-- Track Types                                                                 [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Enums.TrackTypes = {
    [1] = 'Sprint',   -- [EDIT] Point-to-point race
    [2] = 'Circuit'   -- [EDIT] Lap-based race
}

--──────────────────────────────────────────────────────────────────────────────
-- Race Types                                                                  [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Enums.RaceTypes = {
    [1] = 'Normal',       -- [EDIT] Standard race mode
    [2] = 'Competition'   -- [EDIT] ELO-based competitive mode
}

--──────────────────────────────────────────────────────────────────────────────
-- Vehicle Classes                                                             [EDIT]
--──────────────────────────────────────────────────────────────────────────────
Enums.VehicleClasses = {
    [1] = 'None',  -- [INFO] Unclassified
    [2] = 'X',     -- [INFO] Hypercars / Aircraft
    [3] = 'S',     -- [INFO] Supercars / Motorcycles
    [4] = 'A',     -- [INFO] Sports
    [5] = 'B',     -- [INFO] Coupes / Muscle
    [6] = 'C',     -- [INFO] Sedans / Service
    [7] = 'D'      -- [INFO] Compacts / Vans
}

--──────────────────────────────────────────────────────────────────────────────
-- Checkpoint Colors                                                           [EDIT]
-- [INFO] Defines RGB color values for checkpoint visuals.
-- [INFO] Color codes reference: 0 = white, 1 = red, 2 = green, 3 = blue,
--        7 = violet, 17 = orange.
--──────────────────────────────────────────────────────────────────────────────
Enums.CheckpointColors = {
    [0] = { r = 255, g = 255, b = 255 }, -- White
    [1] = { r = 255, g = 0,   b = 0   }, -- Red
    [2] = { r = 0,   g = 255, b = 0   }, -- Green
    [3] = { r = 0,   g = 0,   b = 255 }, -- Blue
    [7] = { r = 127, g = 0,   b = 255 }, -- Violet
    [17]= { r = 255, g = 165, b = 0   }  -- Orange
}

```

</details>
