# Config

```lua
TZMCTimeTrialConfig = {}

TZMCTimeTrialConfig.RecentlyCompletedCooldown = 900
TZMCTimeTrialConfig.UsingSQL = true -- If you're using oxmysql, you can send the results of the time trials to your db. If this is disabled, this will be stored as a JSON file to use from.

--[[
    LOCATIONS

    A random location will be selected on script start, the locations below are just from GTAO. 
    Feel free to create your own, you can do this by doing the following:

    TimeTrialID = {                                 -- This is used to save the results for each time trial
        Name = "Time Trial",                        -- The pretty name of this time trial
        ParTime = 120,                              -- How many seconds to complete the time trial under PAR
        StartLocation = vector3(0.0, 0.0, 0.0),     -- The start location of the time trial
        EndLocation = vector3(0.0, 0.0, 0.0)        -- The end location of the time trial
    },
]]

TZMCTimeTrialConfig.Locations = {
    StormDrain ={
        Name = "Storm Drain",
        ParTime = 38,
        StartLocation = vector3(643.76, -1843.36, 8.57),
        EndLocation = vector3(1049.0, -264.48, 50.8)
    },
}

-- BLIP --
TZMCTimeTrialConfig.Blip = {
    TimeTrialStart = {
        enabled = true,
        text = "Time Trial"
    },
    TimeTrialEnd = {
        text = "Destination"
    }
}

-- COUNTDOWN BAR --

TZMCTimeTrialConfig.CountdownBarText = {
    failTime = "FAIL TIME",         -- This is when the player exits the vehicle
    parTime = "PAR TIME",           -- The par time that the player needs to get
    currentTime = "CURRENT TIME"    -- The current time of the player
}

--[[
    BANNER NOTIFICATIONS / HELP TEXT

    Paramaters

    ${locationName} =           The time trial location name
    ${parTime} =                The time trial PAR time
    ${fastestPlayerName} =      The name of the fastest player
    ${fastestTime} =            The fastesttime for this time trial
    ${fastestTimeCreatedAt} =   When the fastest time was done
    ${currentPlayerName} =      The current player name
    ${currentTime} =            The current time of the player

]]


TZMCTimeTrialConfig.HelpText = {
    VehicleMoving = "You must remain stationary to start the time trial",
    NotInVehicle = "You must be in a vehicle to start this time trial",
    StartTimeTrial = "Press ~INPUT_CONTEXT~ to start the time trial\n${locationName} - ${parTime}\nFastest Time: ${fastestTime}\nPlayer: ${fastestPlayerName}\nDate: ${fastestTimeCreatedAt}"
}

TZMCTimeTrialConfig.BannerNotifications = {
    timeTrialStarted = {
        title = "TIME TRIAL STARTED",
        description = ""
    },
    timeTrialFailed = {
        title = "TIME TRIAL FAILED",
        description = "You exited the vehicle"
    },
    timeTrialPassedInPar = {
        title = "TIME TRIAL PASSED",
        description = "You finished with a time of ${currentTime}"
    },
    timeTrialPassedOutsidePar = {
        title = "TIME TRIAL FAILED",
        description = "You didn't finish within the target time; your time was ${currentTime}"
    }
}


--[[
    DISCORD 

    Webhook URL:    The Discord webhook url you would like to send the message to. These are separted incase you want to send messages in different channels. You can find more information here: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
    enabled:        Enable this notification
    username:       The Discord webhook username
    avatarUrl:      The image URL of the Discord avatar
    showImage:      Show an embed image
    embedColor:     The colour of the embed message
    title:          The embed title
    description:    The embed description

    timeTrialStarted:               When the time trial has started
    timeTrialCompletedInPar:        The time trial was completed within the par time
    timeTrialCompletedOutsidePar:   The time trial was completed however it was outside the par time
    failed:                         The time trial was not completed

    Paramaters

    ${locationName} =           The time trial location name
    ${parTime} =                The time trial PAR time
    ${fastestPlayerName} =      The name of the fastest player
    ${fastestTime} =            The fastesttime for this time trial
    ${fastestTimeCreatedAt} =   When the fastest time was done
    ${currentPlayerName} =      The current player name
    ${currentTime} =            The current time of the player

]]

TZMCTimeTrialConfig.DiscordNotification = {
    timeTrialStarted = {
        enabled = true,
        webhookUrl = "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXX",
        username = "Time Trial",
        avatarUrl = "https://cdn.betterttv.net/emote/618758081f8ff7628e6ccc46/3x.webp",
        showImage = "",
        embedColor = 0xff8a00,
        title = "${currentPlayerName} has started a time trial at ${locationName}",
        description = ""
    },
    timeTrialCompletedInPar = {
        enabled = true,
        webhookUrl = "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXX",
        username = "Time Trial",
        avatarUrl = "https://cdn.betterttv.net/emote/618758081f8ff7628e6ccc46/3x.webp",
        showImage = "",
        embedColor = 0xff8a00,
        title = "${currentPlayerName} has completed a time trial",
        description = "Time: ${currentTime}"
    },
    timeTrialCompletedOutsidePar = {
        enabled = true,
        webhookUrl = "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXX",
        username = "Time Trial",
        avatarUrl = "https://cdn.betterttv.net/emote/618758081f8ff7628e6ccc46/3x.webp",
        showImage = "",
        embedColor = 0xff8a00,
        title = "${currentPlayerName} has completed a time trial",
        description = "Time: ${currentTime}"
    },
    failed = {
        enabled = true,
        webhookUrl = "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXX",
        username = "Time Trial",
        avatarUrl = "https://cdn.betterttv.net/emote/618758081f8ff7628e6ccc46/3x.webp",
        showImage = 'https://media.tenor.com/4kv_-VHCwLIAAAAM/rip-bozo-unlive2774.gif',
        embedColor = 0xff8a00,
        title = "${currentPlayerName} failed the time trial",
        description = ""
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tzmc.dev/docs/standalone/time-trial/config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
