> For the complete documentation index, see [llms.txt](https://newily-scripts.gitbook.io/newily-scripts-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://newily-scripts.gitbook.io/newily-scripts-docs/documentation/scripts/newily-dealership/config.md).

# Config

```
Config = {}

-------------------------------------------------
-- GENERAL SETTINGS
-------------------------------------------------

Config.Locale = "sv"    -- Choose language
Config.Debug = true     -- Show debug messages in console

-------------------------------------------------
-- ORDER & STOCK SETTINGS
-------------------------------------------------

Config.OrderCooldown = 30           -- Seconds before ordered vehicle arrives (use hours in production, e.g., 24 * 3600)
Config.MaxPendingOrders = 10        -- Max pending orders per dealership
Config.MaxStockPerDealership = 200  -- Max vehicles in stock per dealership
Config.DefaultMarkupPercent = 15    -- Default markup percentage for sell price

-------------------------------------------------
-- TEST DRIVE SETTINGS
-------------------------------------------------

Config.TestDrive = {
    enabled = true,
    duration = 60,              -- Seconds
    returnDistance = 100.0,     -- Max distance before teleport back
}

-------------------------------------------------
-- BUYER OFFER SETTINGS
-------------------------------------------------

Config.OfferTimeout = 30  -- Seconds before offer expires

-------------------------------------------------
-- INTERACTION SETTINGS
-------------------------------------------------

Config.InteractionDistance = 2.5    -- Distance to open the menu
Config.MarkerDrawDistance = 5.0    -- Distance to show the marker

-- Keys
Config.Keys = {
    openMenu = 38,  -- E key
}

-------------------------------------------------
-- NOTIFICATION SETTINGS
-------------------------------------------------

Config.NotificationType = "esx"  -- "esx", "ox", "custom"

-- Custom notification (if Config.NotificationType = "custom")
Config.CustomNotify = function(message, type)
    -- Example: exports["notification"]:SendAlert(type, message)
end

-------------------------------------------------
-- ADMIN PANEL SETTINGS
-------------------------------------------------

Config.AdminPanel = {
    -- Command to open admin panel (nil = no command)
    command = "dealershipadmin",

    -- Permission type: "identifier" or "group"
    permissionType = "group",

    -- If permissionType = "group", set groups here
    -- Uses ACE permissions (group.admin, group.superadmin) and ESX groups
    groups = {"admin", "superadmin"},

    -- If permissionType = "identifier", set identifiers here
    -- Supports: license, steam, discord, fivem
    identifiers = {
        -- "license:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        -- "steam:xxxxxxxxxxx",
        -- "discord:xxxxxxxxxxxxxxxxxx",
    },
}

-------------------------------------------------
-- DEALERSHIPS
-------------------------------------------------
--[[
    Each dealership needs:
    - label: Display name
    - jobRequired: Required job (nil = open for everyone)
    - bossGrade: Minimum grade for boss features

    - blip: Map marker
        - sprite: Icon ID (see: https://docs.fivem.net/docs/game-references/blips/)
          Common: 326 = car, 225 = garage, 50 = parking
        - color: Color ID (see: https://docs.fivem.net/docs/game-references/blips/#blip-colors)
          Common: 0 = white, 1 = red, 2 = green, 3 = blue, 5 = yellow

    - marker: Ground marker
        - color: Hex color (e.g. "#0A54A7") or RGBA {r, g, b, a}

    - vehicleSpawn: Where purchased/test vehicles spawn (x, y, z, heading)
    - vehiclePreview: Where vehicle preview is shown (x, y, z, heading)
]]

Config.Dealerships = {
    ["premium_motors"] = {
        label = "Premium Motors",
        jobRequired = "cardealer",
        bossGrade = 3,

        blip = {
            enabled = true,
            coords = vector3(-57.0, -1097.0, 26.0),
            sprite = 326,   -- Car icon
            color = 3,      -- Blue
            scale = 0.8,
        },

        marker = {
            enabled = true,
            coords = vector3(-56.5, -1096.5, 25.5),
            color = "#0A54A7",  -- Blue (hex format)
        },

        vehicleSpawn = vector4(-46.0157, -1097.0649, 26.4223, 248.3453),
        vehiclePreview = vector4(-21.3071, -1115.4365, 26.6721, 160.9854),
    },

    ["luxury_auto"] = {
        label = "Luxury Auto",
        jobRequired = "luxurydealer",
        bossGrade = 3,

        blip = {
            enabled = true,
            coords = vector3(-800.0, -223.0, 37.0),
            sprite = 326,   -- Car icon
            color = 5,      -- Yellow
            scale = 0.8,
        },

        marker = {
            enabled = true,
            coords = vector3(-800.0, -223.0, 36.0),
            color = "#C89632",  -- Gold (hex format)
        },

        vehicleSpawn = vector4(-797.0, -213.0, 37.0, 90.0),
        vehiclePreview = vector4(-790.0, -220.0, 36.5, 120.0),
    },
}

-------------------------------------------------
-- WEBHOOK SETTINGS (Discord logging)
-------------------------------------------------

Config.Webhooks = {
    enabled = true,
    sales = "https://discord.com/api/webhooks/1233778139469975673/Y8bD5Z0ANOTuTXlD-I5_udkNhNrF99R-jhjZ8DQyoXS-MjcQsJRjnCL0qkoNO8RRK7rk",
    orders = "https://discord.com/api/webhooks/1233778139469975673/Y8bD5Z0ANOTuTXlD-I5_udkNhNrF99R-jhjZ8DQyoXS-MjcQsJRjnCL0qkoNO8RRK7rk",
    showcase = "https://discord.com/api/webhooks/1233778139469975673/Y8bD5Z0ANOTuTXlD-I5_udkNhNrF99R-jhjZ8DQyoXS-MjcQsJRjnCL0qkoNO8RRK7rk",
    admin = "https://discord.com/api/webhooks/1233778139469975673/Y8bD5Z0ANOTuTXlD-I5_udkNhNrF99R-jhjZ8DQyoXS-MjcQsJRjnCL0qkoNO8RRK7rk",
}

-------------------------------------------------
-- KEY SYSTEM INTEGRATION
-------------------------------------------------
--[[
    Enable this if you have a vehicle key system on your server.
    When a vehicle is sold, the buyer will receive keys automatically.

    To add your key system:
    1. Set enabled = true below
    2. Open source/shared/unlocked.lua
    3. Add your export/event in the GiveVehicleKeys function
]]

Config.KeySystem = {
    enabled = false,    -- Set to true if you have a key system
}

-------------------------------------------------
-- SHOWCASE SYSTEM
-------------------------------------------------
--[[
    Showcase allows employees to let customers test drive vehicles
    from the dealership's vehicle catalog. The customer can drive
    around for a set duration before being teleported back.
]]

Config.Showcase = {
    enabled = true,
    duration = 90,                      -- Duration in seconds (1:30)

    -- Each dealership can have its own showcase settings
    -- Add showcase config inside each dealership in Config.Dealerships
}

-- Add showcase settings to dealerships
-- Example structure (add these inside your dealership config):
--[[
    showcase = {
        enabled = true,
        marker = {
            enabled = true,
            coords = vector3(-50.0, -1100.0, 25.5),
            color = "#22C55E",  -- Green
        },
        vehicleSpawn = vector4(-45.0, -1105.0, 26.5, 180.0),
        returnPoint = vector3(-50.0, -1100.0, 26.0),  -- Where player teleports back
    },
]]

-- Update the example dealerships with showcase config:
Config.Dealerships["premium_motors"].showcase = {
    enabled = true,
    marker = {
        enabled = true,
        coords = vector3(-48.5118, -1103.4415, 25.4224),
        color = "#22C55E",  -- Green
    },
    vehicleSpawn = vector4(-39.6942, -1079.4476, 26.6483, 340.8481),
    returnPoint = vector3(-48.5118, -1103.4415, 26.4224),
}

Config.Dealerships["luxury_auto"].showcase = {
    enabled = true,
    marker = {
        enabled = true,
        coords = vector3(-795.0, -230.0, 36.0),
        color = "#22C55E",  -- Green
    },
    vehicleSpawn = vector4(-790.0, -235.0, 37.0, 180.0),
    returnPoint = vector3(-795.0, -230.0, 37.0),
}

-------------------------------------------------
-- INTERNAL - DO NOT EDIT BELOW
-------------------------------------------------

-- Convert hex color to RGBA
function Config.HexToRGBA(hex, alpha)
    alpha = alpha or 180
    hex = hex:gsub("#", "")
    return {
        r = tonumber(hex:sub(1, 2), 16),
        g = tonumber(hex:sub(3, 4), 16),
        b = tonumber(hex:sub(5, 6), 16),
        a = alpha
    }
end

-- Get marker color (supports both hex and RGBA)
function Config.GetMarkerColor(marker)
    if type(marker.color) == "string" then
        return Config.HexToRGBA(marker.color, marker.alpha or 180)
    else
        return marker.color
    end
end

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://newily-scripts.gitbook.io/newily-scripts-docs/documentation/scripts/newily-dealership/config.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
