> For the complete documentation index, see [llms.txt](https://shift-studios.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shift-studios.gitbook.io/docs/new/editor-3.md). Agents can also search and read this documentation through its [MCP server](https://shift-studios.gitbook.io/docs/~gitbook/mcp).

# Racing

Transform Your Server With Shift Studios — Powerful, Optimized, And Reliable Resources Built To Improve Every Experience.

<figure><img src="https://4062160621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fgqh3gjuJzDAWNXTD9sEE%2Fuploads%2FuS00LuvA2l6aa38tY2Ah%2Fracingh.png?alt=media&amp;token=44a7eda9-1030-483e-b114-f45b502e68db" alt=""><figcaption></figcaption></figure>

### Installation

{% stepper %}
{% step %}

### Racing

Read Everything Below To Install
{% endstep %}

{% step %}

### Drag & Drop

Drag & Drop The Resource Into Your FiveM Server
{% endstep %}

{% step %}

### Ensure The Resource

Make Sure To Ensure shift-racing In Your Server CFG.
{% endstep %}

{% step %}

### Configure Resource

Make Sure To Configure The Resource To Your Liking

You Can Configure Your Discord Logs In server/config.discord.lua

{% code expandable="true" %}

```lua
-- ⚫ ███████╗██╗  ██╗██╗███████╗████████╗    ███████╗████████╗██╗   ██╗██████╗ ██╗ ██████╗ ███████╗ ⚫
-- ⬛ ██╔════╝██║  ██║██║██╔════╝╚══██╔══╝    ██╔════╝╚══██╔══╝██║   ██║██╔══██╗██║██╔═══██╗██╔════╝ ⬛
-- ⚫ ███████╗███████║██║█████╗     ██║       ███████╗   ██║   ██║   ██║██║  ██║██║██║   ██║███████╗ ⚫
-- ⬛ ╚════██║██╔══██║██║██╔══╝     ██║       ╚════██║   ██║   ██║   ██║██║  ██║██║██║   ██║╚════██║ ⬛
-- ⚫ ███████║██║  ██║██║██║        ██║       ███████║   ██║   ╚██████╔╝██████╔╝██║╚██████╔╝███████║ ⚫
-- ⬛ ╚══════╝╚═╝  ╚═╝╚═╝╚═╝        ╚═╝       ╚══════╝   ╚═╝    ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝ ⬛

Config = {}

Config.Debug = false

-- auto = qbox -> qbcore -> esx -> standalone
-- You can also force: 'qbox', 'qbcore', 'esx', or 'standalone'.
Config.Framework = 'auto'
Config.Target = 'ox_target'
Config.Inventory = 'ox_inventory'

Config.FrameworkSettings = {
    -- Standalone can run free races normally. Paid bets require a money framework.
    standalonePaidBets = false
}

Config.Notification = {
    -- auto, ox_lib, qb, esx, okok, wasabi, custom
    system = 'auto',
    title = 'Racing System',
    position = 'center-left',
    messages = {
        waiting = 'Waiting For At Least %s Racers.',
        countdownReset = 'Race Countdown Stopped. At Least %s Racers Are Required.',
        go = 'GO!',
        alreadyInRace = 'You Are Already In A Race.',
        raceConfigMissing = 'Race Config Was Not Found.',
        vehicleLoadFailed = 'Race Vehicle Model Failed To Load.',
        vehicleSpawnFailed = 'Race Vehicle Failed To Spawn.',
        noActiveRace = 'You Are Not Currently In A Race.',
        raceLeft = 'You Left The Race And Returned To Spawn.',
        raceLeaveFailed = 'Could Not Leave The Race.'
    },

    duration = 4500,

    -- Used only when system = 'custom'.
    customEvent = 'shift-racing:client:customNotify'
}

Config.Command = {
    enabled = false,
    name = 'races'
}

Config.CancelRaceCommand = {
    enabled = true,
    name = 'cancelrace',

    -- Refund the player's buy-in only if they leave before the race actually starts.
    -- Cancelling after the race starts forfeits the buy-in.
    refundBeforeStart = true
}

-- Saved per-track statistics, available with /raceleaderboard.
Config.Leaderboard = {
    enabled = true,
    command = 'raceleaderboard',
    pageSize = 12
}

Config.Locations = {
    {
        id = 'aircraft',
        label = 'Aircraft Racing',

        -- Every race hub/location gets its own ped. Races assigned to this
        -- location use: location = 'aircraft'
        ped = {
            enabled = true,
            model = 's_m_y_xmech_02',
            coords = vec4(266.6095, -3376.8652, 14.7006, 226.8476),
            scenario = 'WORLD_HUMAN_CLIPBOARD',
            targetLabel = 'Open Aircraft Races',
            targetIcon = 'fa-solid fa-flag-checkered',
            distance = 2.0
        },

        blip = {
            enabled = true,
            sprite = 127,
            color = 0,
            scale = 0.6,
            label = 'Activity : Aircraft Racing'
        }
    },

    --[[
    ADD ANOTHER RACE LOCATION / PED:
    ,{
        id = 'street',
        label = 'Street Racing',
        ped = {
            enabled = true,
            model = 'a_m_y_stbla_02',
            coords = vec4(0.0, 0.0, 0.0, 0.0),
            scenario = 'WORLD_HUMAN_STAND_MOBILE',
            targetLabel = 'Open Street Races',
            targetIcon = 'fa-solid fa-flag-checkered',
            distance = 2.0
        },
        blip = {
            enabled = true,
            sprite = 127,
            color = 1,
            scale = 0.6,
            label = 'Street Racing'
        }
    }
    ]]
}

Config.UI = {
    brandName = 'Racing System',
    brandSubtitle = 'Select A Race And Join The Grid.',
    hudPosition = 'right', -- center, left, right
    accent = '#f4f4f5', -- Default monochrome accent used by the approved UI revamp.

    -- Race types are generated from Config.Races automatically.
    -- These classes only control the badge color in the UI.
    tagClasses = {
        ['Street Race'] = 'street',
        ['Track Race'] = 'track',
        ['Bike Race'] = 'bike',
        ['Drag Race'] = 'drag',
        ['Off-Road'] = 'offroad'
    }
}

Config.Race = {
    minRacers = 2, -- Global minimum racers required before a countdown can start.
    startCountdown = 10,
    stagingDelay = 1800, -- Time to load/position racers after the minimum is met before countdown starts.
    joinUntilCountdown = 3,
    startFrozen = true,
    freezeAfterFinish = true,
    returnDelay = 3500,
    deleteVehicleAfterFinish = true,
    maxCheckpointDistance = 18.0,
    finalCheckpointDistance = 30.0, -- Separate finish line tolerance from normal checkpoints.
    finalCheckpointHeightTolerance = 20.0,
    checkpointMarker = {
        enabled = true,
        type = 21, -- GTA checkpoint marker type 21
        scale = vec3(7.0, 7.0, 1.0),
        color = { r = 255, g = 255, b = 255, a = 115 }
    }
}

-- Default race vehicle. A race can override any of these values with race.vehicle.
Config.Vehicle = {
    model = 'veto',
    platePrefix = 'RACE',
    fuel = 100.0,
    warpIntoVehicle = true
}

Config.Keys = {
    enabled = true,
    system = 'wasabi_carlock',
    resource = 'wasabi_carlock',

    -- false = client exports: exports.wasabi_carlock:GiveKey(plate) / RemoveKey(plate)
    -- true = server exports: exports.wasabi_carlock:GiveKey(source, plate) / RemoveKey(source, plate)
    useServerExports = false,

    removeAfterRace = true,
    printMissingResource = true
}

Config.Security = {
    -- Basic server-side abuse protection. These values are intentionally generous
    -- enough for normal racing while rejecting spammed or impossible updates.
    joinCooldownMs = 1000,
    leaveCooldownMs = 1000,
    progressCooldownMs = 125,
    finishCooldownMs = 1000,
    minFinishTimeMs = 5000,
    requireNearCompleteProgress = true,
    minimumFinishProgress = 95,
    requireNearFinish = true, -- Validate the finish request near the final checkpoint.
    maxFinishDistance = 50.0 -- Server-side tolerance for sync/vehicle position.
}

Config.Betting = {
    enabled = true,
    account = 'money', -- money, bank, black_money
    allowFreeRace = true,
    customBet = true,
    presetBets = { 0, 500, 1000, 2500 },
    minBet = 0,
    maxBet = 5000000,
    housePrize = 1500,
    refundIfRaceCanceled = true
}

--[[
    RACE UI / TYPE OPTIONS

    tag        = Text shown on the race badge/filter.
    tagClass   = Optional badge style. street / track / bike / drag / offroad.
                 If omitted, Config.UI.tagClasses[tag] is used.
    style      = Race profile text shown on the large race card.
    startType  = Grid Start / Rolling Start / Staged Start / etc.
    runLabel   = Optional UI override such as "1 Run", "1 Pass", "3 Laps".
    minRacers  = Optional per-race override. Falls back to Config.Race.minRacers.
    maxRacers  = Maximum racers for this race. Add the same number of spawn points.
    uiPath     = Optional SVG route shape used only by the NUI race preview.
    location   = Config.Locations id. The race only appears at that location's ped.

    VEHICLE OVERRIDE EXAMPLE:
    vehicle = {
        model = 'bati',
        platePrefix = 'BIKE',
        fuel = 100.0,
        warpIntoVehicle = true
    }
]]

Config.Races = {
    {
        id = 'acrt',
        location = 'aircraft', -- Must match a Config.Locations id.
        label = 'Aircraft Track',
        description = 'Clean Turns, Fast Straights, And Quick Laps Around The Aircraft Yard.',
        tag = 'Track Race',
        tagClass = 'track',
        style = 'Circuit',
        startType = 'Grid Start',
        runLabel = '1 Lap',
        laps = 1,
        minRacers = 1, -- Remove this line to use Config.Race.minRacers.
        maxRacers = 10,
        basePrize = 1500,
        uiPath = 'M 88 86 C 62 57 39 57 30 83 C 22 106 27 164 28 188 C 29 215 53 217 82 207 C 122 191 154 179 190 182 C 214 184 222 211 248 217 C 282 225 308 213 312 191 C 315 164 300 144 339 140 C 398 134 491 130 546 125 C 574 122 592 107 579 84 C 567 58 545 59 526 63 C 472 70 425 95 372 116 C 325 137 299 144 257 142 C 198 140 160 150 129 135 C 94 118 93 87 74 88 C 52 89 55 133 67 146 C 83 165 129 147 149 136 C 192 109 250 101 297 85 C 331 73 338 46 359 38 C 373 31 415 34 434 31 C 457 29 474 28 480 43 C 492 65 473 78 442 88 C 383 108 346 124 308 130 C 252 141 209 135 178 124 C 155 117 134 94 110 90 C 82 83 57 97 57 130 C 56 152 71 165 88 163 C 110 160 125 154 150 153 C 194 151 215 166 228 188 C 238 203 269 212 289 202 C 310 191 301 162 315 147 C 338 126 396 136 436 132 C 488 128 539 135 558 127',

        -- Optional per-race vehicle override. Remove this block to use Config.Vehicle.
        vehicle = {
            model = 'formula2',
            platePrefix = 'RACE',
            fuel = 100.0,
            warpIntoVehicle = true
        },

        returnCoords = vec4(271.4078, -3371.9675, 14.7014, 182.0383),

        -- This sample race contains 10 grid positions to match maxRacers = 10.
        spawns = {
            vec4(240.6429, -3408.0203, 14.8217, 100.4257),
            vec4(244.9206, -3403.4329, 14.8217, 100.2726),
            vec4(251.1803, -3406.3496, 14.8217, 105.2414),
            vec4(256.3290, -3401.3909, 14.8218, 102.5656),
            vec4(262.9612, -3404.2341, 14.8217, 100.6643),
            vec4(268.1450, -3399.4902, 14.8218, 102.7320),
            vec4(273.8512, -3402.3265, 14.8218, 101.9440),
            vec4(279.0084, -3397.6791, 14.8218, 102.1180),
            vec4(284.6249, -3400.4228, 14.8218, 101.7730),
            vec4(289.7521, -3395.7432, 14.8218, 102.0040)
        },

        -- The finish gate spans the start/finish straight; tight 18m spherical
        -- detection left racers at 7/7 and 85% despite crossing the line.
        finishRadius = 60.0,
        checkpoints = {
            vec3(4.8937, -3427.2405, 14.8336),
            vec3(311.0532, -3341.8469, 20.3330),
            vec3(268.7046, -3391.4636, 20.3492),
            vec3(260.6573, -3441.7310, 8.5769),
            vec3(317.4849, -3367.8828, 5.6177),
            vec3(380.2203, -3426.0540, 14.8185),
            vec3(232.3360, -3407.7205, 14.8217)
        }
    }
}

```

{% endcode %}
{% endstep %}

{% step %}

### Restart / Start Your Server

Ensure Everything Is Working Well & Enjoy !!
{% endstep %}
{% endstepper %}
