# Configs, Locales & SQL

{% tabs %}
{% tab title="Config" %}

```lua
Config = {}
function L(cd) if Locales[Config.Language][cd] then return Locales[Config.Language][cd] else print('Locale is nil ('..cd..')') end end


--███████╗██████╗  █████╗ ███╗   ███╗███████╗██╗    ██╗ ██████╗ ██████╗ ██╗  ██╗
--██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██║    ██║██╔═══██╗██╔══██╗██║ ██╔╝
--█████╗  ██████╔╝███████║██╔████╔██║█████╗  ██║ █╗ ██║██║   ██║██████╔╝█████╔╝ 
--██╔══╝  ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝  ██║███╗██║██║   ██║██╔══██╗██╔═██╗ 
--██║     ██║  ██║██║  ██║██║ ╚═╝ ██║███████╗╚███╔███╔╝╚██████╔╝██║  ██║██║  ██╗
--╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝ ╚══╝╚══╝  ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝


--WHAT DOES 'auto_detect' DO?
--The 'auto_detect' feature automatically identifies your framework and applies the appropriate default settings.

Config.Framework = 'auto_detect' --[ 'auto_detect' / 'other' ]   If you select 'auto_detect', only ESX, QBCore and Standalone frameworks will be detected. Use 'other' for custom frameworks.
Config.Notification = 'auto_detect' --[ 'auto_detect' / 'other' ]   If you select 'auto_detect', the default notifications for your framework will be used. Use 'other' for custom notification resources.
Config.Language = 'EN' --[ 'EN' / 'BG' / 'CZ' / 'DE' / 'ES' / 'FI' / 'FR' / 'NL' / 'PT' / 'SE' / 'SK' ]   You can add your own locales to Locales.lua, but be sure to update the Config.Language to match it.

Config.FrameworkTriggers = {
    esx = { --If you have modified the default event names in the es_extended resource, change them here.
        resource_name = 'es_extended',
        main = 'esx:getSharedObject'
    },
    qbcore = { --If you have modified the default event names in the qb-core resource, change them here.
        resource_name = 'qb-core',
        main = 'QBCore:GetObject'
    }
}


--██╗███╗   ███╗██████╗  ██████╗ ██████╗ ████████╗ █████╗ ███╗   ██╗████████╗
--██║████╗ ████║██╔══██╗██╔═══██╗██╔══██╗╚══██╔══╝██╔══██╗████╗  ██║╚══██╔══╝
--██║██╔████╔██║██████╔╝██║   ██║██████╔╝   ██║   ███████║██╔██╗ ██║   ██║   
--██║██║╚██╔╝██║██╔═══╝ ██║   ██║██╔══██╗   ██║   ██╔══██║██║╚██╗██║   ██║   
--██║██║ ╚═╝ ██║██║     ╚██████╔╝██║  ██║   ██║   ██║  ██║██║ ╚████║   ██║   
--╚═╝╚═╝     ╚═╝╚═╝      ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═══╝   ╚═╝


Config.FuelScript = 'none' --[ 'none' / 'legacyfuel' / 'frfuel' / 'other' ] Choose your fuel script so we can get a vehicles fuel to display on the carhud UI.
Config.Debug = false --To enable debug prints.


--███╗   ███╗ █████╗ ██╗███╗   ██╗
--████╗ ████║██╔══██╗██║████╗  ██║
--██╔████╔██║███████║██║██╔██╗ ██║
--██║╚██╔╝██║██╔══██║██║██║╚██╗██║
--██║ ╚═╝ ██║██║  ██║██║██║ ╚████║
--╚═╝     ╚═╝╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝


Config.DisableExitingVehicle = false --Do you want to disable exiting the vehicle when the seatbelt is enabled? (If this is enabled, this will increase the ms usage slightly).
Config.HideMiniMapOnFootOnFoot = false --Do you want the mini-map to be hidden when the player is on foot, and only show when a player is in a vehicle? (if disabled the mini-map will always be visible).


--██╗  ██╗███████╗██╗   ██╗███████╗     █████╗ ███╗   ██╗██████╗      ██████╗ ██████╗ ███╗   ███╗███╗   ███╗ █████╗ ███╗   ██╗██████╗ ███████╗
--██║ ██╔╝██╔════╝╚██╗ ██╔╝██╔════╝    ██╔══██╗████╗  ██║██╔══██╗    ██╔════╝██╔═══██╗████╗ ████║████╗ ████║██╔══██╗████╗  ██║██╔══██╗██╔════╝
--█████╔╝ █████╗   ╚████╔╝ ███████╗    ███████║██╔██╗ ██║██║  ██║    ██║     ██║   ██║██╔████╔██║██╔████╔██║███████║██╔██╗ ██║██║  ██║███████╗
--██╔═██╗ ██╔══╝    ╚██╔╝  ╚════██║    ██╔══██║██║╚██╗██║██║  ██║    ██║     ██║   ██║██║╚██╔╝██║██║╚██╔╝██║██╔══██║██║╚██╗██║██║  ██║╚════██║
--██║  ██╗███████╗   ██║   ███████║    ██║  ██║██║ ╚████║██████╔╝    ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║██║  ██║██║ ╚████║██████╔╝███████║
--╚═╝  ╚═╝╚══════╝   ╚═╝   ╚══════╝    ╚═╝  ╚═╝╚═╝  ╚═══╝╚═════╝      ╚═════╝ ╚═════╝ ╚═╝     ╚═╝╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚═════╝ ╚══════╝


Config.Settings = {
    ENABLE = true, --Do you want to allow player's to use the settings UI?
    command = 'carhud', --The chat command.
    key = 'y' --The key to press.
}

Config.Seatbelt = {
    ENABLE = true, --Do you want to use the built-in seatbelt?
    command = 'seatbelt',
    key = 'b',

    eject = true, --Do you want player's to be ejected from the vehicle when they crash hard enough?
    ragdoll = true, --Do you want player's to ragdoll for a short time after being ejected from a vehicle?
    tyrepop = true, --Do you want a random tyre to pop when they crash hard enough?
}

Config.Cruise = {
    ENABLE = true, --Do you want to use the built-in cruise control?
    command = 'cruise',
    key = 'equals'
}

Config.ToggleCarhud = {
    ENABLE = true, --Do you want to allow player's to show/hide their carhud UI?
    command = 'carhudtoggle',
    minimap = true, --Do you want the map to be hidden while the main carhud UI is hidden?
}


-- █████╗ ██╗   ██╗████████╗ ██████╗     ██████╗ ███████╗████████╗███████╗ ██████╗████████╗
--██╔══██╗██║   ██║╚══██╔══╝██╔═══██╗    ██╔══██╗██╔════╝╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
--███████║██║   ██║   ██║   ██║   ██║    ██║  ██║█████╗     ██║   █████╗  ██║        ██║   
--██╔══██║██║   ██║   ██║   ██║   ██║    ██║  ██║██╔══╝     ██║   ██╔══╝  ██║        ██║   
--██║  ██║╚██████╔╝   ██║   ╚██████╔╝    ██████╔╝███████╗   ██║   ███████╗╚██████╗   ██║   
--╚═╝  ╚═╝ ╚═════╝    ╚═╝    ╚═════╝     ╚═════╝ ╚══════╝   ╚═╝   ╚══════╝ ╚═════╝   ╚═╝   


-----DO NOT TOUCH ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING.-----
if Config.Framework == 'auto_detect' then
    if GetResourceState(Config.FrameworkTriggers.esx.resource_name) == 'started' then
        Config.Framework = 'esx'
    elseif GetResourceState(Config.FrameworkTriggers.qbcore.resource_name) == 'started' then
        Config.Framework = 'qbcore'
    else
        Config.Framework = 'standalone'
    end
    if Config.Framework == 'esx' or Config.Framework == 'qbcore' then
        for c, d in pairs(Config.FrameworkTriggers[Config.Framework]) do
            Config.FrameworkTriggers[c] = d
        end
        Config.FrameworkTriggers.esx, Config.FrameworkTriggers.qbcore = nil, nil
    end
end

if Config.Notification == 'auto_detect' then Config.Notification = Config.Framework if Config.Notification == 'standalone' then Config.Notification = 'chat' end end
-----DO NOT TOUCH ANYTHING ABOVE THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING.-----
```

{% endtab %}

{% tab title="Config UI" %}

```javascript
// These are the default values for carhud
// Make sure you save a copy of this file in case you mess something up.
// Do not edit things you aren't sure about, instead ask a question on Codesign Discord and someone will respond.
let settings = {
  gauges:{
    elements:{    // Identifiers of elements
      fuel:"#fuel",
      fuel_bg:"#fuelFill",
      speed:"#speed",
      speed_bg:"#speedFill",
      rpm:"#rpm",
      rpm_bg:"#rpmFill"
    },
    units:"MPH", // Default units
    display:{ // Default display values for gauges
      fuel:true,
      speed:true,
      rpm:true,
    },
    color:{ // Default colors of bars
      speed:["#ffba08", "#faa307", "#f48c06", "#f48c06", "#e85d04", "#dc2f02", "#d00000","#9d0208", "#6a040f", "#370617"],
      rpm:["#d3d3d3", "#b1a7a6", "#e5383b", "#ba181b", "#660708"],
      fuel:["#ffba08", "#ffba08"]
    }
  },
  dashboard:{
    elements:{ // Identifiers of dashboard elements
      main:"#infoCluster",
      left:"#leftIndicatorDisplay",
      right:"#rightIndicatorDisplay",
      seatbelt:"#seatbeltDisplay",
      engine:"#engineDisplay",
      fuel:"#fuelDisplay",
      cruisecontrol:"#ccDisplay",
      lowbeam:"#lowBeamDisplay",
      highbeam:"#highBeamDisplay"
    },
    engineAlert:10, // Default engine alert
    fuelAlert:20, // Default fuel alert
    display:true, // Display of gauges
    individual:{
      left:true,
      engine:true,
      seatbelt:true,
      fuel:true,
      cruisecontrol:true,
      lowbeam:true,
      highbeam:true,
      right:true
    }
  },
  streetCompass:{ 
    elements:{
      street:"#streetName",
      compass:"#compass",
      heading:"#compass-current-number",
      caret:"#compass-current-caret"
    },
    display:{ // Display of street
      street:true,
      compass:true,
      heading:true,
      caret:true
    }
  },
  size:{
    fuel:{
      base:150, // Base size of fuel gauge
      scale:1, // Do not change
    },
    speed:{
      base:150, // Base size of speed gauge
      scale:1, // Do not change
      font:[32, 16] // Base sizes of speed font, first is speed, second is unit (MPH/KMH)
    },
    rpm:{
      base:100, // Base size of rpm gauge
      scale:1, // Do not change
      font:[16, 13.2] // Base sizes of rpm font, first is rpm value, second is rpm text (RPM)
    },
    dashboard:{
      base:48,
      scale:1,
      padding:10
    },
    street:"20px", // Default street size, make sure you also change it in html
    compass:{
      scale:1 // Scale, 1 = 100%, 0.5 = 50%, 1.5 = 150%
    },
  },
  position:{ // Default positions of elements
    fuel:{
      top:"0px",
      left:"0px"
    },
    speed:{
      top:"0px",
      left:"0px"
    },
    rpm:{
      top:"0px",
      left:"0px"
    },
    dashboard:{
      top:"0px",
      left:"0px"
    },
    street:{
      top:"0px",
      left:"0px"
    },
    compass:{
      top:"0px",
      left:"0px"
    }
  },
  refresh:500, // Default refresh rate, make sure you also change it in html (IN MILLISECONDS)
  compass: {
    display:true,
    movement_scale: 2.66666666667, // 2.66666666667px = 1 heading [DO NOT CHANGE IF YOU DON'T KNOW WHAT YOU ARE DOING, IT WILL BREAK THE ACCURACY OF COMPASS]
    background_position:1225, // N center
  }
};
let default_settings = JSON.parse(JSON.stringify(settings));
```

{% endtab %}

{% tab title="Locales" %}
<https://github.com/RampBST/Codesign_Locales/blob/main/cd_carhud/locales.lua>
{% endtab %}

{% tab title="Locales UI" %}
<https://github.com/RampBST/Codesign_Locales/blob/main/cd_carhud/locales_ui.js>
{% endtab %}

{% tab title="SQL" %}
N/A
{% endtab %}
{% endtabs %}


---

# 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.codesign.pro/paid-scripts/car-hud/configs-locales-and-sql.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.
