# Main Config (/docs/es_extended/config)

The main es_extended config controls accounts, starting money and items, spawn points, command permissions, paychecks, weight and a few framework switches. It lives in `es_extended/shared/config/main.lua` and is loaded on both server and client. You can read it from other resources with `ESX.GetConfig()`.

## Overview [#overview]

| Fact | Value |
| --- | --- |
| File | `es_extended/shared/config/main.lua` |
| Side | Shared (server and client) |
| Read from other resources | `ESX.GetConfig()` or `ESX.GetConfig("MaxWeight")` |
| Other config files | [weapons](/docs/es_extended/config/weapons), [adjustments](/docs/es_extended/config/adjustments), [logs](/docs/es_extended/config/logs) |
| Apply changes | Restart the server |

<Callout type="warn">
Do not edit other core files. The config files are meant to be changed; logic files get overwritten on every update. Keep a copy of your config so you can merge it after updating. See [updating ESX](/docs/getting-started/updating).
</Callout>

## Reading the config [#reading-the-config]

```lua
local maxWeight = ESX.GetConfig("MaxWeight")
local config = ESX.GetConfig() -- the whole Config table
```

`ESX.GetConfig(key)` returns `Config[key]`, or the whole table without a key. See [shared functions](/docs/es_extended/shared).

## Convars [#convars]

Some values are read from convars, so you set them in `server.cfg` instead of the Lua file. Use `setr` so the client can read them too.

| Convar | Default | Sets | Description |
| --- | --- | --- | --- |
| `esx:locale` | not set | `Config.Locale` | Language code, for example `en`, `de`, `fr`. Falls back to the `txAdmin-locale` convar, then `en`. |
| `esx:localeFallback` | `"true"` | `Config.LocaleFallback` | Fill missing translation keys from English. Set to `"false"` while writing a new translation. |
| `esx:identifier` | `"license"` | `Config.Identifier` | Identifier type used to store characters (`license`, `license2`, `steam`, `discord`, `fivem`, ...). |

```bash title="server.cfg"
setr esx:locale "en"
setr esx:identifier "license"
```

## Framework [#framework]

| Key | Type | Default | Description |
| --- | --- | --- | --- |
| `Locale` | `string` | from convars | Active language. Set it with the `esx:locale` convar. |
| `LocaleFallback` | `boolean` | `true` | Use English for missing translation keys. |
| `CustomInventory` | `false` or `string` | `false` | Leave `false`. Set to `"ox"` automatically when the `ox_inventory` resource exists. Other values only for inventories that ship their own ESX bridge. |
| `EnableDebug` | `boolean` | `false` | Enables `ESX.Trace` output and extra error messages (for example in `getMeta`). Keep it off in production. |
| `Multichar` | `boolean` | auto | `true` when the `esx_multicharacter` resource exists. Do not set it by hand unless a third-party multicharacter resource tells you to. |
| `Identity` | `boolean` | `true` | Load `firstname`, `lastname`, `dateofbirth`, `sex` and `height` from `users`. Always active with multicharacter. |
| `Identifier` | `string` | `"license"` | From the `esx:identifier` convar. Do not change it in the file. |
| `EnableDefaultInventory` | `boolean` | auto | `true` when `CustomInventory` is `false`. Enables the default `F2` inventory. Do not change. |
| `OxInventory` | `boolean` | auto | Backwards compatibility flag, equals `CustomInventory == "ox"`. Defined in `shared/main.lua`. |

## Accounts [#accounts]

### Accounts [#accounts-1]

`Config.Accounts` defines the money accounts every character has. Each key is the account name.

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | | Display name, usually a translation. |
| `round` | `boolean` | `true` | Round amounts to whole numbers. Set to `false` for accounts with decimals. |
| `transferable` | `boolean?` | `true` | Set to `false` to stop players from giving or dropping this account through the default inventory. `bank` is not transferable by default. |

```lua title="shared/config/main.lua"
Config.Accounts = {
    bank = { label = TranslateCap("account_bank"), round = true, transferable = false },
    black_money = { label = TranslateCap("account_black_money"), round = true },
    money = { label = TranslateCap("account_money"), round = true },
    crypto = { label = "Crypto", round = false, transferable = false }, -- custom account
}
```

New accounts appear for all characters on their next load, with the starting value from `StartingAccountMoney` or `0`. Learn more in the [money and accounts guide](/docs/guides/money-and-accounts).

### StartingAccountMoney [#startingaccountmoney]

| Type | Default |
| --- | --- |
| `table<string, number>` | `{ bank = 50000 }` |

Balances for new characters. Also used as the starting value when an existing character is missing an account. With ox_inventory, accounts stored as items (`money`, `black_money`) are given as items on creation.

```lua
Config.StartingAccountMoney = { bank = 50000, money = 500 }
```

### StartingInventoryItems [#startinginventoryitems]

| Type | Default |
| --- | --- |
| `table<string, number>` or `false` | `false` |

Items for new characters (default inventory), as `{ [itemName] = count }`.

```lua
Config.StartingInventoryItems = { bread = 2, water = 2, phone = 1 }
```

## Spawning [#spawning]

| Key | Type | Default | Description |
| --- | --- | --- | --- |
| `DefaultSpawns` | `table[]` | one spawn at Legion Square | List of `{ x, y, z, heading }`. One is picked at random for new characters and when a saved position is invalid. |
| `PlayerCoordinateLimit` | `number` | `10000.0` | Maximum absolute `x`, `y` and `z` that ESX accepts for player positions. Raise it if you use maps far outside the default world. |

```lua
Config.DefaultSpawns = {
    { x = 222.2027, y = -864.0162, z = 30.2922, heading = 1.0 },
    { x = -1037.5, y = -2737.6, z = 20.2, heading = 330.0 }, -- airport
}
```

<Callout type="warn">
`DefaultSpawns` must contain at least one valid position. Without one, new players are dropped with the error code `invalid-spawn-config`.
</Callout>

## Permissions [#permissions]

### CommandPermissions [#commandpermissions]

| Type | Default |
| --- | --- |
| `table<string, string[]>` | see below |

Maps every built-in command to the groups that may use it. Commands without an entry are limited to `admin`. Aliases use the entry of their main command.

| Groups | Commands |
| --- | --- |
| `owner`, `admin` | `setcoords`, `setjob`, `car`, `cardel`, `fix`, `setaccountmoney`, `giveaccountmoney`, `removeaccountmoney`, `giveitem`, `giveweapon`, `giveammo`, `giveweaponcomponent`, `clearall`, `refreshjobs`, `refreshitems`, `clearinventory`, `clearloadout`, `setgroup`, `save`, `saveall`, `goto`, `bring`, `kill`, `freeze`, `unfreeze`, `setdim`, `players`, `noclip`, `tpm`, `coords` |
| `user`, `admin`, `owner` | `clear`, `group`, `job`, `info`, `playtime` |

See the [commands page](/docs/es_extended/commands) for what each command does.

### AdminGroups [#admingroups]

| Type | Default |
| --- | --- |
| `table<string, boolean>` | `{ owner = true, admin = true }` |

<Callout type="warn" title="Deprecated">
Marked deprecated in favor of `CommandPermissions` (the comment says it will be removed in 1.15, but it is still present and used in 1.16.4). ESX still uses it in `xPlayer.isAdmin()` and the `esx:isUserAdmin` callback, which `/tpm` and `/noclip` rely on.
</Callout>

### ValidCharacterSets [#validcharactersets]

| Type | Default |
| --- | --- |
| `table<string, boolean>` | all `false` |

Extra alphabets that `ESX.IsValidLocaleString` accepts, for example in character names. Basic Latin and the alphabet of the active locale are always allowed. Keys: `el` (Greek), `sr` (Cyrillic), `he` (Hebrew), `ar` (Arabic), `zh-cn` (Chinese, Japanese, Korean).

```lua
Config.ValidCharacterSets = { ["el"] = false, ["sr"] = true, ["he"] = false, ["ar"] = false, ["zh-cn"] = false }
```

## Paychecks [#paychecks]

| Key | Type | Default | Description |
| --- | --- | --- | --- |
| `EnablePaycheck` | `boolean` | `true` | Pay salaries at a fixed interval. |
| `PaycheckInterval` | `number` | `7 * 60000` | Interval in milliseconds (7 minutes). |
| `PaycheckBatchSize` | `number` | `100` | Players paid before the loop yields. |
| `PaycheckBatchDelay` | `number` | `250` | Milliseconds to wait between batches. |
| `PaycheckJitter` | `number` | `30 * 1000` | Up to this many extra milliseconds of random delay per run, so servers do not pay at the exact same moment. |
| `OffDutyPaycheckMultiplier` | `number` | `0.5` | Share of the salary paid to off-duty players (`0.5` = 50 %). |
| `EnableSocietyPayouts` | `boolean` | `false` | Pay salaries from the job's society account (needs esx_society and esx_addonaccount). If the society cannot pay, the player gets nothing. |
| `LogPaycheck` | `boolean` | `false` | Log paychecks to the `Paycheck` webhook in the [logs config](/docs/es_extended/config/logs). |

Unemployed players receive their `unemployed` grade salary as welfare. Salaries are always paid to the `bank` account. Use `xPlayer.togglePaycheck(false)` to skip single players.

## Jobs [#jobs]

| Key | Type | Default | Description |
| --- | --- | --- | --- |
| `DefaultJobDuty` | `boolean` | `true` | Duty state after `setJob` when no duty is passed, and for characters without a saved duty state. `unemployed` is always off duty. |

## Player [#player]

| Key | Type | Default | Description |
| --- | --- | --- | --- |
| `MaxWeight` | `number` | `24` | Inventory weight limit without a backpack. With ox_inventory it sets the `inventory:weight` convar (`MaxWeight * 1000` grams). |
| `SaveDeathStatus` | `boolean` | `true` | Restore a saved health of `0` on reconnect, so players who log out dead are still dead. |
| `DistanceGive` | `number` | `4.0` | Maximum distance for giving items, money and weapons to another player. |

## Logging [#logging]

| Key | Type | Default | Description |
| --- | --- | --- | --- |
| `AdminLogging` | `boolean` | `false` | Send admin command usage to the `UserActions` webhook. |

## Related [#related]

- [Weapons config](/docs/es_extended/config/weapons)
- [Adjustments config](/docs/es_extended/config/adjustments)
- [Logs config](/docs/es_extended/config/logs)
- [server.cfg setup](/docs/getting-started/server-cfg)
- [Admin permissions guide](/docs/guides/admin-permissions)
