# Configs, Locales & SQL

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

```lua
Config = {}
Config.Keys={['ESC']=322,['F1']=288,['F2']=289,['F3']=170,['F5']=166,['F6']=167,['F7']=168,['F8']=169,['F9']=56,['F10']=57,['~']=243,['1']=157,['2']=158,['3']=160,['4']=164,['5']=165,['6']=159,['7']=161,['8']=162,['9']=163,['-']=84,['=']=83,['BACKSPACE']=177,['TAB']=37,['Q']=44,['W']=32,['E']=38,['R']=45,['T']=245,['Y']=246,['U']=303,['P']=199,['[']=39,[']']=40,['ENTER']=18,['CAPS']=137,['A']=34,['S']=8,['D']=9,['F']=23,['G']=47,['H']=74,['K']=311,['L']=182,['LEFTSHIFT']=21,['Z']=20,['X']=73,['C']=26,['V']=0,['B']=29,['N']=249,['M']=244,[',']=82,['.']=81,['LEFTCTRL']=36,['LEFTALT']=19,['SPACE']=22,['RIGHTCTRL']=70,['HOME']=213,['PAGEUP']=10,['PAGEDOWN']=11,['DELETE']=178,['LEFTARROW']=174,['RIGHTARROW']=175,['TOP']=27,['DOWNARROW']=173,['NENTER']=201,['N4']=108,['N5']=60,['N6']=107,['N+']=96,['N-']=97,['N7']=117,['N8']=61,['N9']=118,['UPARROW']=172,['INSERT']=121}
function L(cd) if Locales[Config.Language][cd] then return Locales[Config.Language][cd] else print('Locale is nil ('..cd..')') end end


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


Config.Database = 'mysql' --[ 'mysql' / 'ghmattimysql' / 'oxmysql' ] Choose your sql database script.
Config.Language = 'EN' --[ 'EN' / 'BG' / 'DE' / 'CZ' / 'ES' / 'FI' / 'FR' / 'NL' / 'PT' / 'SE' / 'SK' ] You can add your own locales to the Locales.lua. But make sure to change the Config.Language to match it.

Config.FrameworkTriggers = { --You can change the esx events (IF NEEDED).
    main = 'esx:getSharedObject',
    load = 'esx:playerLoaded',
    job = 'esx:setJob',
}

Config.NotificationType = { --[ 'esx' / 'mythic_old' / 'mythic_new' / 'chat' / 'other' ] Choose your notification script.
    server = 'esx',
    client = 'esx', 
}

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


Config.PassportRegisteringTime = 5 --(in seconds) How long should we wait after creating your identity until the random mesages stop and the passport UI closes.
Config.SpawnPosition = vector4(-206.24, -1013.56, 30.14, 341.3) --This is the location where players will be teleported to after they have created their identity.

Config.UseNationality = true --If enabled, the nationality of players will be saved into the database when they create a new character and can be displayed on the id cards.
Config.UsePlaceOfBirth = true --If enabled, the place of birth of players will be saved into the database when they create a new character and can be displayed on the id cards.


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


Config.IDcard = {
    ENABLE = true, --Do you want to allow players to use the id card? (if disabled, none of the options below will be used).
    use_licenses = true, --Do you want to display the players licenses on the id card?
    close_key = Config.Keys['BACKSPACE'], --The key to close the id card.
    close_timer = nil, --(in seconds) The id card will automatically close after x amount of seconds. (This is disabled by default; to enable this replace nil with a number eg., 10).
    
    Usage = {
        item = true, --Do you want to allow players to show their id card to players by using a usable item.
        item_name = 'idcard', --The spawn name of the usable item.

        command = true, --Do you want to allow players to show their id card to other players by using a command?
        command_itemcheck = false, --Do you want to make players be required to have the id card item in their inventory? (the 'item_name' above will be the item we are checking for ^^^).

        command_name_1 = 'idcard', --Name of the chat command.
        distance_1 = 5, --Gets the closest player within this distance to show your id card to.
        description_1 = L('command_description_1'), --The description for the chat message.

        --This 2nd command will show your id card to the closest player who is NOT in a vehicle (useful in traffic stops for when you want to show your id card to an officer outside your vehicle instead of your passenger).
        command_name_2 = 'idcard_outside',
        distance_2 = 5,
        description_2 = L('command_description_2'),
    },

    ESX_LicenseLabels = { --If you are using esx_license, add your license types into this table and then set alabel for it. (this label will be displayed on the id card).
        ['dmv'] = 'Theory',
        ['drive'] = 'Vehicle',
        ['drive_bike'] = 'Motorcycle',
        ['drive_truck'] = 'Trucking',
        ['weapon'] = 'Weapon',
    }
}


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


Config.EnableTestCommand = false ---The test command is 'identitytest'.
```

{% endtab %}

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

{% tab title="Locales UI" %}
[https://github.com/RampBST/Codesign\_Locales/blob/main/cd\_identity/locale\_ui.js](https://github.com/RampBST/Codesign_Locales/blob/main/cd_identity/locales_ui.js)
{% endtab %}

{% tab title="SQL" %}
Watch this video if you are unsure how to insert an SQL Query into your database.\
[HeidiSQL ](https://youtu.be/s3tqlHV3yb0)/ [PHPMyAdmin](https://youtu.be/NXqmYn7bbMM).

```sql
-- Most likely you will already have the users table, so this will create it if it dosn't exist.
CREATE TABLE IF NOT EXISTS `users` (
	`firstname` VARCHAR(50) NULL DEFAULT '' COLLATE 'utf8mb4_bin',
	`lastname` VARCHAR(50) NULL DEFAULT '' COLLATE 'utf8mb4_bin',
	`dateofbirth` VARCHAR(25) NULL DEFAULT '' COLLATE 'utf8mb4_bin',
	`sex` VARCHAR(10) NULL DEFAULT '' COLLATE 'utf8mb4_bin',
	`cd_identity` LONGTEXT NULL DEFAULT '{"placeofbirth":"Los Santos","dateofissue":"01/01/2021","dateofexpiry":"01/01/2031","nationality":"USA"}' COLLATE 'utf8mb4_bin'
)
COLLATE='utf8mb4_bin'
ENGINE=InnoDB
;

-- If you already have the users table, we will add these new columns to it.
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `firstname` VARCHAR(50) NULL DEFAULT '' COLLATE 'utf8mb4_bin';
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `lastname` VARCHAR(50) NULL DEFAULT '' COLLATE 'utf8mb4_bin';
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `dateofbirth` VARCHAR(25) NULL DEFAULT '' COLLATE 'utf8mb4_bin';
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `sex` VARCHAR(10) NULL DEFAULT '' COLLATE 'utf8mb4_bin';
ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `cd_identity` LONGTEXT NULL DEFAULT '{"placeofbirth":"Los Santos","dateofissue":"01/01/2021","dateofexpiry":"01/01/2031","nationality":"USA"}' COLLATE 'utf8mb4_bin';
```

{% 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/identity/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.
