# Configuration

`ID Card System` uses a configuration file located in:

* `data/config.lua`

This file controls localization, display settings, wallet behavior, job permissions, badge props, document types, and framework integration functions.

### Localization

```lua
Locale = 'en' -- 'en' or 'pl'
```

Defines which language should be used.

Supported values:

* `en`
* `pl`

To add a new language, copy `locales/en.json` and create your own language file.

***

### General Settings

```lua
Locale = 'en',
ShowDistance = 5.0,
DisplayTime = 15000,
CityName = 'LOS SANTOS',
DocPrefix = 'LS',

WalletKeybind = {
    enabled = false,
    key = 'HOME',
}
```

#### `ShowDistance`

Defines how close other players must be to see a presented document.

```lua
ShowDistance = 5.0
```

This value is measured in game units.

#### `DisplayTime`

Defines how long a document remains visible before auto-hide.

```lua
DisplayTime = 15000
```

This value is measured in milliseconds.

Set `0` to disable automatic hiding.

#### `CityName`

Defines the city or server name shown in the document header.

```lua
CityName = 'LOS SANTOS'
```

#### `DocPrefix`

Defines the prefix used before document numbers.

```lua
DocPrefix = 'LS'
```

Example output:

```lua
LS 000001
```

#### `WalletKeybind`

Controls the built-in wallet keybind.

```lua
WalletKeybind = {
    enabled = false,
    key = 'HOME',
}
```

**`enabled`**

* `true` — enables the wallet keybind
* `false` — disables the wallet keybind

The wallet can still always be opened through the export.

**`key`**

Defines the key used for `RegisterKeyMapping`.

***

### Job Configuration

#### Insurance Jobs

```lua
InsuranceJobs = { 'police', 'bcso', 'saspr', 'ambulance', 'mechanic' }
```

Jobs listed here automatically receive NW insurance.

This list is also used by the `HasInsuranceJob()` export.

#### Badge Jobs

```lua
BadgeJobs = {
    ['police'] = 'Los Santos Police Department',
    ['bcso']   = 'Blaine County Sheriff Office',
    ['saspr']  = 'San Andreas State Park Rangers',
}
```

These jobs are allowed to show badge documents.

The value is used as the department name in proximity messages.

#### Service ID Jobs

```lua
ServiceIdJobs = {
    ['ambulance'] = 'Los Santos Medical Center',
    ['mechanic']  = 'BennyS Motor Works',
}
```

These jobs are allowed to show service ID documents.

The value is used as the company or organization name in proximity messages.

***

### Badge Animation

```lua
DefaultBadgeProp = 'prop_fib_badge'

BadgePropOverrides = {
    ['police'] = 'prop_lspd_badge',
    ['bcso']   = 'prop_lspd_badge',
}
```

#### `DefaultBadgeProp`

Defines the default prop model used when showing a badge.

#### `BadgePropOverrides`

Allows specific jobs to use a different badge prop model.

***

### Special Badge Patterns

```lua
SpecialBadgePatterns = {
    { type = 'SWAT', keywords = { 'DAVID', 'BRAVO', 'CHARLIE', 'ALFA', 'DELTA', 'X%-RAY' } },
    { type = 'GU', keywords = { 'GU' } },
    { type = 'UNDERCOVER', keywords = { 'UNDERCOVER' } },
}
```

These patterns are used when generating proximity messages for badge presentation.

If the player’s badge number or callsign matches one of the configured patterns, the matching `type` label is used.

Keywords support Lua patterns.

***

### Document Types

Each document is defined inside the `Types` table.

Supported categories:

* `id_card`
* `license`
* `business_card`
* `badge`
* `service_id`

Example:

```lua
Types = {
    {
        id = 'dowod',
        category = 'id_card',
        label = 'Dowód osobisty',
        icon = 'fa-id-card',
        color = '#4F46E5',
        licenseChips = {
            { key = 'drive_bike', label = 'A' },
            { key = 'drive', label = 'B' },
            { key = 'drive_truck', label = 'C' },
            { divider = true },
            { key = 'weapon', icon = 'fa-gun' },
            { key = 'nw', label = 'NW' },
        },
    },
    {
        id = 'odznaka',
        category = 'badge',
        label = 'Odznaka',
        icon = 'fa-shield-halved',
        color = '#4F46E5',
        jobRequired = true,
        showAnim = true,
    },
}
```

#### Common Fields

**`id`**

Unique document identifier.

**`category`**

Defines the document layout type.

**`label`**

Display name shown in the wallet and card UI.

**`icon`**

Font Awesome icon used for the document.

**`color`**

Accent color used for the card in HEX format.

***

### Category-Specific Fields

#### `license`

Used only for documents with category `license`.

```lua
license = 'weapon'
```

Defines which license key should be checked.

#### `showExpiry`

Used only for `license` documents.

```lua
showExpiry = true
```

Shows the license expiry date if available.

#### `jobRequired`

```lua
jobRequired = true
```

Requires the player to have a matching job from `BadgeJobs` or `ServiceIdJobs`.

#### `showAnim`

```lua
showAnim = true
```

Plays the badge prop animation when the document is shown.

#### `licenseChips`

Used only for `id_card` documents.

```lua
licenseChips = {
    { key = 'drive', label = 'B' },
    { key = 'weapon', icon = 'fa-gun' },
    { divider = true },
}
```

This defines which license chips are shown on the ID card.

**Chip Formats**

Text chip:

```lua
{ key = 'drive', label = 'B' }
```

Icon chip:

```lua
{ key = 'weapon', icon = 'fa-gun' }
```

Divider:

```lua
{ divider = true }
```

***

### Required Server Functions

These functions must be adapted to your framework and your server systems.

#### `GetPlayerLicenses`

Used to retrieve a player’s license data.

```lua
GetPlayerLicenses = function(playerId, xPlayer, cb)
    -- cb({ drive = true, weapon = false })
end
```

The callback should receive a table of license keys and boolean values.

#### `GetPhoneNumber`

Used to retrieve a player’s phone number.

```lua
GetPhoneNumber = function(xPlayer)
    return '123-456-789'
end
```

#### `GetLicenseExpiry`

Used to retrieve a formatted license expiry date.

```lua
GetLicenseExpiry = function(playerId, licenseType)
    return '2026-12-31'
end
```

Return a formatted string or `nil`.

***

### Required Client Function

#### `SendProximityMessage`

Used to send a local proximity `/me` style message when a document is presented.

```lua
SendProximityMessage = function(serverId, message)
end
```

This function should be adapted to your chat or roleplay messaging system.

***

### Client Exports

#### `OpenWallet()`

Opens the document wallet UI.

```lua
exports['msk_idcard']:OpenWallet()
```

The wallet shows all documents the player is allowed to use.

#### `HasInsuranceJob()`

Returns whether the player’s current job is listed in `InsuranceJobs`.

```lua
local hasInsurance = exports['msk_idcard']:HasInsuranceJob()
```

Returns:

* `true`
* `false`

***

### Display Behavior

When a document is shown:

* nearby players inside `ShowDistance` receive it
* the card appears in the UI
* the card auto-hides after `DisplayTime`
* multiple incoming cards are queued
* badge cards can trigger an animation

Players can also:

* press `BACK` to dismiss a visible card
* press `RCONTROL` to enter copy mode
* click values in copy mode to copy them
* edit card position and scale in the UI

***

### Keybinds

Default controls:

* `HOME` — open wallet, if enabled
* `BACK` — dismiss visible document
* `RCONTROL` — enable copy mode
* `ESC` — close wallet or active document
* `1` to `9` — quick-select documents inside the wallet

***

### Notes

* Avatar mugshots are generated from the player’s current appearance
* Card settings are stored locally in browser storage
* `InsuranceJobs` automatically grant `nw = true`
* Badge presentation requires both a valid job and a valid badge value
* Missing translation keys can fall back to Polish depending on implementation


---

# 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://mskscripts.gitbook.io/mskscripts/scripts/id-cards/configuration.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.
