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

# Configuration

`config.lua` holds the gameplay settings, `server_config.lua` the admin gating and the Discord webhooks.

### config.lua

```lua
Config.Locale = 'en'
Config.Debug = false
Config.VersionCheck = true

Config.Command = 'multijob'
Config.OpenKey = 'F4'
Config.Position = 'right'

Config.StandardJob = 'unemployed'
Config.MaxJobs = 2
Config.AllowSwitchToStandard = true
Config.AllowSelfRemove = true
Config.SwitchCooldown = 3
Config.ShowSalary = true
Config.Duty = true

Config.Categories = {
    enabled      = true,
    standardIcon = 'id-card',
    defaultIcon  = 'briefcase',
    list = {
        state = { icon = 'shield-halved', jobs = { 'police', 'ambulance' } },
        crime = { icon = 'masks-theater', jobs = { 'ballas', 'vagos' } },
    },
}
```

| Option                         | Description                                                                                                                          |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| `Config.Locale`                | Language of all texts, `'en'` or `'de'`                                                                                              |
| `Config.Debug`                 | Extra debug lines in the server console                                                                                              |
| `Config.VersionCheck`          | Prints a note in the server console when a newer version is out                                                                      |
| `Config.Command`               | Command and keybind name, default opens with `/multijob`                                                                             |
| `Config.OpenKey`               | Default key, rebindable in the FiveM settings. The same key and ESC close the menu                                                   |
| `Config.Position`              | Side the menu sits on and slides in from, `'left'` or `'right'`                                                                      |
| `Config.StandardJob`           | The ESX fallback job. Must match an existing ESX job name                                                                            |
| `Config.MaxJobs`               | How many extra jobs a character can hold on top of the standard job. Staff can be lifted past it, see Job limit bypass               |
| `Config.AllowSwitchToStandard` | Lets players switch back to the standard job from the menu                                                                           |
| `Config.AllowSelfRemove`       | Lets players remove their own extra jobs                                                                                             |
| `Config.SwitchCooldown`        | Seconds between two switches, anti spam. `0` turns it off                                                                            |
| `Config.ShowSalary`            | Shows the grade salary on each job row. A salary of 0 is never shown                                                                 |
| `Config.Duty`                  | Shows an on and off duty toggle in the menu header                                                                                   |
| `Config.Categories`            | Groups jobs into categories with their own icons, see Icons and categories. The categories are also what the faction lock works with |

#### About the standard job

The standard job is the ESX fallback and is **never** stored in the database. It cannot be added to anyone, and it never counts against `Config.MaxJobs`.

When a player removes their last extra job, or the one they currently have active, they fall back to the next job they hold, or to the standard job.

There is no blacklist setting. The only job that can never be added is `Config.StandardJob`.

#### About the duty toggle

The toggle uses the ESX duty flag on the active job. ESX forces `unemployed` off duty, so the button is dimmed and does nothing while the standard job is active. The switch cooldown does not apply to the duty toggle.

### server\_config.lua

#### Admin gating

```lua
ServerConfig.Admin = {
    ace    = 'l-multijob.admin',
    groups = { 'admin', 'superadmin' },
}
```

A player may run `/addmultijob` and `/removemultijob` if **either** their ESX group is in `groups` **or** they hold the ACE permission in `ace`. Grant the ACE in your `server.cfg`:

```
add_ace group.admin l-multijob.admin allow
```

Set `ace = false` to disable the ACE path, or leave `groups = {}` to disable the group path. The server console always passes. The same gating covers `/joblock`, `/jobunlock` and `/joblocks`.

#### Job limit bypass

```lua
ServerConfig.MaxJobsBypass = {
    enabled = true,
    ace     = 'l-multijob.maxjobs',
    groups  = { 'admin', 'superadmin' },
    max     = 0,
}
```

`Config.MaxJobs` is the limit for normal players. Everyone whose ESX group is in `groups` **or** who holds the ACE permission in `ace` gets the limit from `max` instead. `max = 0` means no limit at all, any other number is their own higher limit. Grant the ACE in your `server.cfg`:

```
add_ace group.admin l-multijob.maxjobs allow
```

The bypass is checked on the player who receives the job, not on the admin handing it out, and it counts everywhere a job is added: the F4 menu, `/addmultijob`, the `AddMultijob` and `CanAddMultijob` exports and the patched ESX `/setjob`. Those players see their own limit in the counter next to the menu title, `∞` when they have none.

For a character that is offline only the ESX group can be checked, since an offline player has no ACE permission. Give the group to anyone whose bypass should also count while they are offline.

Set `enabled = false` to turn the bypass off, `ace = false` or `groups = {}` to disable one of the two paths. The faction rules have their own `bypass` block, so a raised job limit does not let anyone past them.

#### Faction rules

`ServerConfig.CategoryLock` turns the job categories into rules: categories that exclude each other, and a lock after leaving one. It has its own page, see Faction lock.

#### Discord logging

```lua
ServerConfig.Logs = {
    enabled = false,
    botName = 'l-multijob',
    avatar  = '',

    colorSwitch = 2928893,
    colorAdd    = 4456246,
    colorRemove = 16729670,

    webhooks = {
        self_remove     = '',
        admin_add       = '',
        admin_remove    = '',
        switch          = '',
        category_lock   = '',
        category_unlock = '',
    },
}
```

The three colours are the embed bar of the Discord message, as decimal numbers rather than hex strings. The defaults are the house blue, green and red.

Each event type has its own webhook, so you can send them to different channels, or point several at the same URL. Leave a URL empty to skip that event, or set `enabled = false` to turn all logging off.

| Event             | Fires when                                                            |
| ----------------- | --------------------------------------------------------------------- |
| `self_remove`     | A player removes one of their own jobs from the F4 menu               |
| `admin_add`       | An admin grants a job with `/addmultijob`                             |
| `admin_remove`    | An admin removes a job with `/removemultijob`                         |
| `switch`          | A player switches their active job in the F4 menu                     |
| `category_lock`   | A faction lock was set, by someone leaving a faction or by `/joblock` |
| `category_unlock` | An admin lifted a faction lock with `/jobunlock`                      |

The `AddMultijob` export is not logged.

### Colours

Every colour of the menu, plus the server name shown above the panel title, lives in `html/style.css`. Change it there and restart the resource, no rebuild needed. The file is commented, one line per setting.
