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

# Configuration

What each config file controls and the options worth changing.

All configuration files are in `config/`. Restart the resource after a change.

| File                          | Controls                                              |
| ----------------------------- | ----------------------------------------------------- |
| `config/main.lua`             | Debug mode                                            |
| `config/bridge/framework.lua` | Framework resource names, events and database columns |
| `config/bridge/banking.lua`   | Which banking system holds society money              |
| `config/bridge/target.lua`    | Target resource, or marker and text prompt            |
| `config/zones.lua`            | Where members open the tablet                         |
| `config/permissions.lua`      | Permission types and defaults per grade               |
| `config/navigation.lua`       | Tabs of the tablet                                    |
| `config/upgrades.lua`         | Upgrades and their prices                             |
| `config/nui.lua`              | Tablet prop, animation and disabled controls          |
| `config/cache.lua`            | How long data is cached                               |
| `config/constants.lua`        | Limits: payout schedule, clean-up, pagination         |

## Framework

`config/bridge/framework.lua`

The framework is **detected automatically**: ESX, then QBX, then QBCore. This file only tells the script how your framework is set up. You need to edit it when you renamed the framework resource, use a different second-job system, or changed your player table.

```lua
Config.Framework.ESX = {
    resourceName = 'es_extended',
    export = 'getSharedObject',

    jobTypeMapping = {
        job = 'job',
        secondjob = 'hiddenjob',
    },

    events = {
        jobChanged = 'esx:setJob',
        secondJobChanged = 'esx:setHiddenJob',
    },

    database = {
        playerTable = 'users',
        identifierColumn = 'identifier',
        accountsColumn = 'accounts',
        firstNameColumn = 'firstname',
        lastNameColumn = 'lastname',
        jobColumn = 'job',
        jobGradeColumn = 'job_grade',
        secondJobColumn = 'hiddenjob',
        secondJobGradeColumn = 'hiddenjob_grade',
    },
}
```

| Option           | Description                                                                                                      |
| ---------------- | ---------------------------------------------------------------------------------------------------------------- |
| `resourceName`   | Name of the framework resource.                                                                                  |
| `export`         | Export that returns the framework object (ESX and QBCore).                                                       |
| `jobTypeMapping` | Which player field holds the main job and the second job. ESX defaults to `hiddenjob`, QBCore and QBX to `gang`. |
| `events`         | Events fired when a player's job or second job changes.                                                          |
| `database`       | Player table and column names, used for offline employees.                                                       |

`Config.Framework.QBCore` and `Config.Framework.QBX` have the same shape, with `players`, `citizenid` and `gang` as defaults.

{% hint style="info" %}
Using another framework? Adapt `bridge/framework/custom/`.
{% endhint %}

## Banking

`config/bridge/banking.lua`

```lua
Config.Banking.System = 'auto'
```

| Value                | Society money is kept in                                          |
| -------------------- | ----------------------------------------------------------------- |
| `'auto'`             | The first system found, in the priority order below (recommended) |
| `'esx_addonaccount'` | ESX addon accounts                                                |
| `'okokBanking'`      | okokBanking                                                       |
| `'Renewed-Banking'`  | Renewed Banking                                                   |
| `'fd-banking'`       | fd-banking                                                        |
| `'qb-banking'`       | qb-banking                                                        |
| `'database'`         | The script's own `society_accounts` table                         |
| `'custom'`           | Your own system: fill in `bridge/banking/custom/server.lua`       |

`Config.Banking.AutoDetect` tunes the detection:

| Option          | Default  | Description                                                                        |
| --------------- | -------- | ---------------------------------------------------------------------------------- |
| `Enabled`       | `true`   | `false` uses `Config.Banking.System` as written.                                   |
| `Priority`      | see file | Order in which systems are tried. `database` is the fallback and always available. |
| `VerifyExports` | `true`   | Check that a found resource really answers before picking it.                      |
| `Verbose`       | `true`   | Print the detection steps to the console.                                          |

## Target

`config/bridge/target.lua`

```lua
Config.Target.System = 'none'
```

| Value         | Zones are opened with                |
| ------------- | ------------------------------------ |
| `'none'`      | A marker and a text prompt (default) |
| `'ox_target'` | ox\_target                           |
| `'qb-target'` | qb-target                            |
| `'qtarget'`   | qtarget                              |

`Config.Target.Distance` (default `2.5`) is the interaction distance with a target resource.

## Zones

`config/zones.lua`

```lua
Config.Zones = {
    {
        coords = vec3(440.967, -978.290, 29.758),
        job = 'police',
        requiredGrade = 0,
        type = 'job', -- 'job' or 'secondjob'
    }
}
```

| Field                        | Description                                                                                        |
| ---------------------------- | -------------------------------------------------------------------------------------------------- |
| `coords`                     | Where the zone is.                                                                                 |
| `job`                        | Job (or second job / gang) that can use it.                                                        |
| `requiredGrade`              | Lowest grade that can use it.                                                                      |
| `type`                       | `'job'` or `'secondjob'`.                                                                          |
| `radius`, `distance`, `icon` | Optional, with a target resource only: zone radius (default `1.5`), interaction distance and icon. |

`Config.MarkerSettings` sets the marker's type, size and colour when no target resource is used.

{% hint style="info" %}
`client/modules/zones.lua` is open, so you can change how zones behave. You can also skip zones entirely and open the tablet from your own script with the `openSocietyMenu` export.
{% endhint %}

## Permissions

`config/permissions.lua`

### Permission types

| Permission           | Allows                          |
| -------------------- | ------------------------------- |
| `view_balance`       | View the account balance        |
| `view_transactions`  | View the transaction history    |
| `view_banking_stats` | View financial statistics       |
| `withdraw_money`     | Withdraw money from the account |
| `manage_employees`   | Hire, fire and manage employees |
| `set_bonus`          | Set bonuses for employees       |
| `buy_upgrade`        | Purchase upgrades               |
| `manage_missions`    | Create and manage missions      |
| `manage_notes`       | Create, edit and delete notes   |
| `view_logs`          | View the action history         |

Labels and descriptions come from the locale files; icons are [Lucide](https://lucide.dev/icons/) names.

### Defaults per grade

`Config.Permissions.Default` applies to every society that has no entry of its own:

```lua
Config.Permissions.Default = {
    [0] = {},
    [1] = {'view_balance'},
    [2] = {'view_balance', 'view_transactions'},
    [3] = {'view_balance', 'view_transactions', 'manage_employees'},
    [4] = {'view_balance', 'view_transactions', 'manage_employees', 'withdraw_money', 'view_banking_stats'},
    [5] = {'view_balance', 'view_transactions', 'manage_employees', 'withdraw_money', 'view_banking_stats', 'set_bonus', 'buy_upgrade', 'manage_missions', 'manage_notes', 'view_logs'}
}
```

### Per society

`Config.Permissions.Societies` overrides the defaults for one society:

```lua
Config.Permissions.Societies = {
    ['mafia'] = {
        [0] = {},
        [1] = { 'view_balance' },
        [2] = { 'view_balance', 'view_transactions' },
    }
}
```

### Boss grades

```lua
Config.Permissions.BossGrades = {
    ['boss'] = true
}
```

Grade **names** that count as boss. Not used on QBCore, which has its own boss flag.

## Navigation

`config/navigation.lua` lists the tabs of the tablet: `dashboard`, `employees`, `banking`, `upgrades`, `missions`, `notes`, `history`. Remove an entry to hide a tab for everyone, or hide it for some societies with `disabled`:

```lua
{
    id = 'history',
    label = locale('ui_history'),
    path = '/history',
    icon = 'history',
    disabled = { 'mafia' } -- a job name, or a list of them
}
```

## Upgrades

`config/upgrades.lua`

```lua
Config.Upgrades = {
    armory = {
        label = locale('upgrade_armory_label'),
        description = locale('upgrade_armory_desc'),
        icon = "shield",
        category = "security",
        levels = {
            [1] = { cost = 550000, slots = 50 },
            [2] = { cost = 900000, slots = 65 },
        },
        baseSlots = 25,
        unlockLevel = 1
    },
}
```

| Field                  | Description                                                                                      |
| ---------------------- | ------------------------------------------------------------------------------------------------ |
| `label`, `description` | Texts, from the locale files.                                                                    |
| `icon`                 | Lucide icon name.                                                                                |
| `category`             | One of `Config.UpgradeCategories`.                                                               |
| `levels`               | Price of each level, with either `slots` (a capacity) or `benefit` (a text for one-off unlocks). |
| `baseSlots`            | Capacity without the upgrade.                                                                    |
| `unlockLevel`          | Organization level required to buy it.                                                           |

The script ships with `armory`, `storage`, `shop`, `safe`, `menu`, `dressing` and `garage`. The script stores the upgrade levels; what an upgrade **does** is up to your other resources, which read them through the [exports](/docs/scripts/society/exports.md), for example `getUpgradeSlots` for a stash size.

`Config.UpgradeCategories` groups upgrades in the UI: `security`, `storage`, `business`, `management`, `comfort`, `transport`.

## Tablet

`config/nui.lua` sets the tablet prop (`prop_cs_tablet`), the bone and offset it is attached to, the animation, and the controls disabled while the tablet is open.

## Cache and limits

`config/cache.lua` (`Config.Cache.Timeouts`) sets how long each kind of data is cached, in milliseconds. Lower values mean fresher data and more database queries.

`config/constants.lua` holds limits you rarely need to touch:

| Group                                   | What it sets                                                           |
| --------------------------------------- | ---------------------------------------------------------------------- |
| `Constants.Bonus`                       | Payout schedule: `PayoutCron = '0 12 * * 1'` is every Monday at 12:00. |
| `Constants.Database`                    | After how many days old history, notes and missions are cleaned up.    |
| `Constants.Banking`                     | Largest single transaction, smallest mission reward.                   |
| `Constants.Missions`, `Constants.Notes` | Minimum lengths and maximum counts.                                    |
| `Constants.Upgrades`                    | Maximum upgrade level and organization level.                          |
| `Constants.Pagination`                  | Items per page.                                                        |

## Debug

`config/main.lua`

```lua
Config.Debug = false
```
