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

# Configuration

***

### <mark style="color:green;">1.  Core Settings</mark>

| Variable               | Type     | Default  | Accepted values              | Purpose                                                                              |
| ---------------------- | -------- | -------- | ---------------------------- | ------------------------------------------------------------------------------------ |
| **`Config.Framework`** | `string` | `"auto"` | `"auto"`, `"esx"`, `"qb"`    | Tells the script which framework to use. `"auto"` auto‑detects ESX or QB at runtime. |
| **`Config.Language`**  | `string` | `"en"`   | `en`, `de`, `fr`, `es`, `pt` | Selects the active locale from **`Config.Locales`**.                                 |
| **`Config.Locales`**   | `table`  | `{}`     | locale tables                | Holds translation tables. *(See Section 2).*                                         |

#### How it works

* On startup, `getFramework()` checks `Config.Framework`.
* If set to `auto`, it searches for `qb-core` first, then `es_extended`.
* If neither is found, the resource continues in **stand‑alone** mode.

***

### <mark style="color:green;">2.  Localization</mark>

The script ships with five ready‑made dictionaries (`en`, `de`, `fr`, `es`, `pt`).

```lua
Config.Language = "en"
```

Switch languages globally by changing `Config.Language`.

***

### <mark style="color:green;">3.  Command & Permissions</mark>

| Variable                   | Type     | Default                            | Description                                       |
| -------------------------- | -------- | ---------------------------------- | ------------------------------------------------- |
| **`Config.WarnCommand`**   | `string` | `"warn"`                           | Chat command players with permission use (/warn). |
| **`Config.AllowedGroups`** | `table`  | `{ "god", "superadmin", "admin" }` | Ace/Framework groups that may issue warnings.     |

> **Usage pattern:** `/warn <ID> "<Title>" "<Message>"`\
> Example: `/warn 23 "THIS IS A WARNING" "Please stop glitching through walls."`

***

### <mark style="color:green;">4.  Behaviour Settings</mark>

| Variable                           | Type     | Default | Purpose                                                              |
| ---------------------------------- | -------- | ------- | -------------------------------------------------------------------- |
| **`Config.TimeToClose`**           | `number` | `20`    | Seconds before the warning UI auto‑closes.                           |
| **`Config.EnableGodmodeInWarn`**   | `bool`   | `true`  | Make the warned player invincible while the overlay is active.       |
| **`Config.DisableMovementInWarn`** | `bool`   | `true`  | Freezes player inputs during the warning.                            |
| **`Config.DisableWeaponsInWarn`**  | `bool`   | `true`  | Removes weapon control so the player can’t shoot while being warned. |

***

### <mark style="color:green;">5.  Hooks / Callbacks</mark>

| Function                         | Side   | When called                    | Typical use‑cases                                 |
| -------------------------------- | ------ | ------------------------------ | ------------------------------------------------- |
| **`Config.OnWarn(source)`**      | client | As soon as the overlay appears | Play a sound, log to Discord, etc.                |
| **`Config.OnWarnClose(source)`** | client | Right after the overlay closes | Re‑enable custom controls, send another log, etc. |

Both callbacks are **optional**—leave them empty if not needed.

***

### <mark style="color:green;">6.  Notification Wrapper</mark>

```lua
Config.Notify = function(type, message)
    lib.notify({
        title       = Config.Locales[Config.Language]["title"],
        description = message,
        type        = type,        -- "success", "error", "info"
        position    = "center-right"
    })
end
```

Feel free to replace **`lib.notify`** with your preferred notification system; keep the function signature so internal calls remain intact.

***

### <mark style="color:green;">7.  Quick‑Start Checklist</mark>

1. Copy the resource folder **unchanged** (must remain `stg-warnsystem`).
2. Add `ensure stg-warnsystem` to your `server.cfg`.
3. Edit **`config.lua`** to fit your server (language, groups, behaviour).
4. Reload the script or restart the server.

***

For more help, contact support via [discord.gg/stg](https://discord.gg/stg).

***

> 🛒 **Note:** You can find this script on our Tebex store: [STG Tebex](https://www.stgscripts.com/category/scripts)
