> 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-weapon-studio/commands.md).

# Commands

CAS Weapon Studio commands for RedM. The staff studio command, the players' skin book command, the Config.Debug test commands, the server console commands and the server.cfg convars.

## Staff

| Command         | What it does                                                                          |
| --------------- | ------------------------------------------------------------------------------------- |
| `/weaponstudio` | Opens the studio. Needs the ACE `cas.weaponstudio` or a group in `Config.AdminGroups` |

* The name is `Config.Command`.
* A player without permission reads "You may not open the Weapon Studio."
* Typed in the server console it only answers "open it in game".

## Players

| Command        | What it does                                                                                                        |
| -------------- | ------------------------------------------------------------------------------------------------------------------- |
| `/weaponskins` | Opens the skin book. At a gunsmith it sells that town's skins and custom guns. Anywhere else it opens on "My skins" |

* The name is `Config.BookCommand`. Set it to `""` to turn the command off and use counters only.
* With `Config.ApplyAnywhere = false` the command only works at a gunsmith.
* Counters (`Config.Counters`) open the same book with a prompt, no command needed.

See [The skin book](/script-documentation/cas-weapon-studio/skin-book.md).

## Test commands

Only with `Config.Debug = true`. Keep it `false` on a live server.

### In game

`/ws_test` puts a slot's skin on the weapon in your hand without the book, on your screen only. It checks the files themselves.

| Command                      | What it does                                                                                                                                 |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `/ws_test on <slot>`         | Shows slot `<slot>` (a number, 1 to 60) on the weapon in your hand                                                                           |
| `/ws_test on <slot> <count>` | The same, with `<count>` kill notches                                                                                                        |
| `/ws_test notch <count>`     | Shows `<count>` kill notches and no skin. Without a number: 7                                                                                |
| `/ws_test off`               | Takes it off. The weapon shows what it really carries again                                                                                  |
| `/ws_test info`              | Prints your state bag and every weapon you carry: attach point, model, the studio's weapon key, whether it is visible and its gunsmith parts |

The lines are printed in your client console (F8) and in the server console.

`/ws_test on` answers "not shown" when no known weapon is in your hand or the slot's files are not in your game yet (not live on this client).

### Server console or staff

| Command                         | What it does                                                                                                     |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `ws_give <playerId> <designId>` | Gives a design to a player's character as a gift. It shows in their book once the design is live                 |
| `ws_wear <playerId> <designId>` | Gives the design and puts it on the player's weapon model. Fails with `not_live` when the design is not live yet |

* `<playerId>` is the server id of an online player with a character.
* `<designId>` is the `id` column of the `cas_weaponskin_designs` table. The server console also prints it on every export: `built design 7 as cas_ws_s003 (metal brushed, wood oiled), live after the next restart`.
* Both work from the server console, and in game for staff (as `/ws_give`, `/ws_wear`).
* The result is printed in the server console.

## server.cfg convars

Not commands, but set the same way, in `server.cfg`:

| Convar             | Example                              | What it does                                                            |
| ------------------ | ------------------------------------ | ----------------------------------------------------------------------- |
| `ws_restart_times` | `set ws_restart_times "06:00,18:00"` | Your restart times, shown in the studio. Replaces `Config.RestartTimes` |
| `ws_ai_provider`   | `set ws_ai_provider "fal"`           | `fal`, `google` or `openai`                                             |
| `ws_ai_key`        | `set ws_ai_key "YOUR_KEY"`           | Your key at that provider                                               |
| `ws_ai_model`      | `set ws_ai_model ""`                 | Optional: a model other than the default                                |

The Clothing Studio's `cs_ai_provider`, `cs_ai_key` and `cs_ai_model` are used when the `ws_ai_*` ones are not set.

## Permission

```cfg
add_ace group.admin cas.weaponstudio allow
```

The ACE `cas.weaponstudio` opens the studio and every staff action in it. See [Installation](/script-documentation/cas-weapon-studio/installation.md#who-may-open-the-studio).

## Server console lines

| Line                                                                                     | Meaning                                                                                                         |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `framework: vorp`                                                                        | The framework the script found: `vorp`, `rsg` or `standalone`                                                   |
| `3 live skin(s)`                                                                         | How many skins this server start serves                                                                         |
| `3 live skin(s), 1 update(s) took over`                                                  | An update to a live skin went live with this start                                                              |
| `... 1 MISSING their files (export them again)`                                          | A live skin's files are gone. See [Troubleshooting](/script-documentation/cas-weapon-studio/troubleshooting.md) |
| `ready: 73 weapons, 57 free skin slots of 60, AI off`                                    | The studio is ready                                                                                             |
| `built design 7 as cas_ws_s003 (metal brushed, wood oiled), live after the next restart` | An export finished                                                                                              |
| `2 slot(s) are streamed by another resource and stay unused`                             | Another resource streams a texture with a slot's name                                                           |
| `could not start: ...`                                                                   | The studio could not start. Most often the database was not reached: check oxmysql                              |

Every line starts with `[cas-weaponstudio]`.
