> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-gunsmith/configuration/general.md).

# General Settings

CAS Gunsmith general settings in config.lua — language, currency, XP per rank, the Gun Oil item, limits, job access, rank and grade locks, RSG options.

All settings are in `config.lua`. Prices, locks and service fees are defined only there. The interface receives these values from the server every time the bench opens, so no change is needed in the interface. Restart the resource after changing a setting.

```lua
Config.Debug = false
Config.Locale = 'en'
Config.Currency = 0
Config.XpPerRank = 1000
Config.GunOilItem = 'gun_oil'
Config.PresetLimit = 30
Config.MaxAmmoBoxes = 20
```

| Setting        | Default     | Description                                                                                                                                                                                                                                             |
| -------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Debug`        | `false`     | When `true`, detailed logs are written to the console and the developer tools are on: `/gstp` teleports you to a gunsmith, `gsfx` tunes the bench look live. Keep it `false` on a live server, because every player can use these tools while it is on. |
| `Locale`       | `'en'`      | Language of every text: notifications, prompt, blip and the interface. `'en'` and `'tr'` are included. See [Localization](/script-documentation/cas-gunsmith/configuration/localization.md).                                                            |
| `Currency`     | `0`         | VORP only: the currency used for payment. `0` is cash dollars, `1` is gold. On RSG see `Config.Rsg.money`.                                                                                                                                              |
| `XpPerRank`    | `1000`      | Rank calculation: character XP (on RSG, the rep in `Config.Rsg.rankRep`) is divided by this value.                                                                                                                                                      |
| `GunOilItem`   | `'gun_oil'` | Name of the item used for cleaning. Must match the name in your items table exactly.                                                                                                                                                                    |
| `PresetLimit`  | `30`        | Number of presets a character can save.                                                                                                                                                                                                                 |
| `MaxAmmoBoxes` | `20`        | Maximum boxes of one ammo type in a single order.                                                                                                                                                                                                       |

## RSG Core

These settings are only read on RSG Core.

```lua
Config.Rsg = {
  money = 'cash',
  rankRep = nil,
  ammoBoxes = { AMMO_REVOLVER = { item = 'ammo_box_revolver', rounds = 12 }, ... },
}
```

| Setting     | Default            | Description                                                                                                                                                                                   |
| ----------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `money`     | `'cash'`           | The RSG money type the gunsmith charges.                                                                                                                                                      |
| `rankRep`   | `nil`              | RSG has no character XP. Name a rep here (read with `Player.Functions.GetRep`) to use it as XP for rank locks. With `nil`, rank locks are off on RSG and the interface hides the rank.        |
| `ammoBoxes` | every rsg-ammo box | The `rsg-ammo` box item sold for each ammo type and the rounds it holds. On RSG these round counts replace the box sizes in `Config.Ammo`. An ammo type without an entry here cannot be sold. |

## Access and locks

`Config.Access` decides who may use the bench and what unlocks the locked options.

```lua
Config.Access = {
  mode = 'xp',
  jobs = { 'gunsmith' },
  minGrade = 0,
  onDuty = false,
}
```

| Setting    | Default          | Description                                                                                                                                                                      |
| ---------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode`     | `'xp'`           | `'xp'`: every player can use the bench, and locks follow the character's rank. `'job'`: only the jobs below can use the bench, and locks follow the job grade.                   |
| `jobs`     | `{ 'gunsmith' }` | Job names allowed at the bench in `'job'` mode. A shop can list its own `jobs` instead (see [Shops and Interaction](/script-documentation/cas-gunsmith/configuration/shops.md)). |
| `minGrade` | `0`              | Lowest job grade that may use the bench in `'job'` mode.                                                                                                                         |
| `onDuty`   | `false`          | RSG only: the player must be on duty. VORP has no duty state, so it is ignored there.                                                                                            |

A player who may not use the bench gets a notification: "Only a gunsmith can work this bench.", "Your grade is too low for this bench." or "Go on duty to work the bench." (`msg.wrongJob`, `msg.lowGrade` and `msg.offDuty` in the language file) The job is checked again at payment, so losing the job while the bench is open stops the next order.

### Locks

Parts, finishes, engravings, carvings and ammo types can have a lock:

```lua
lock = { rank = 30, grade = 2 }
```

* In `'xp'` mode, `rank` counts. Rank is the character's XP divided by `XpPerRank`; with the default setting, rank 30 needs 30000 XP. The option shows as **Rank 30**. On RSG, rank locks only apply when `Config.Rsg.rankRep` is set.
* In `'job'` mode, `grade` counts. The option shows as, for example, **Gunsmith grade 2**, and the top of the interface shows the player's grade. A lock without `grade` is free in this mode.

A locked option cannot be selected. An option that is already fitted on the weapon or was bought before can still be used, even if it is locked. To remove a lock, delete the `lock` line.

Default locks:

| Option                         | Rank | Grade |
| ------------------------------ | ---- | ----- |
| Mother of Pearl Grips          | 15   | 1     |
| Bocote wood tone, Exotic Stock | 20   | 1     |
| Ornamental engraving           | 25   | 2     |
| Gold finish                    | 30   | 2     |
| Buck / Bear carving            | 35   | 2     |
| Long Scope                     | 40   | 3     |
| Explosive Ammo, Explosive Slug | 50   | 3     |
