> For the complete documentation index, see [llms.txt](https://atiysus-organization.gitbook.io/aty-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atiysus-organization.gitbook.io/aty-scripts/weapon-editor/reference/commands.md).

# Commands

## Commands

### Everyday commands

| Command             | Who      | What                                                                                                                                        |
| ------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `/gunsmith`         | Everyone | Open the workshop on the weapon in hand. **Disabled by default** — see `Config.Access.workshop.command`                                     |
| `/gunsmithadmin`    | `lab`    | Place, edit and remove workbenches                                                                                                          |
| `/gunsmithlab`      | `lab`    | Open the Balance Lab                                                                                                                        |
| `/gunsmithrange`    | `range`  | Open the Shooting Range                                                                                                                     |
| `/gunsmithshowcase` | `lab`    | The screenshot scene — floats your skinned weapons on an arc, blurs the background, hides the UI. Local only, changes nothing on the server |

Command names are configurable: `Config.Access.workshop.commandName`, `Config.Tables.adminCommand`, `Config.Showcase.command`.

Where your framework provides a command API, these are registered through it — so an unauthorised player does not see them in chat suggestions at all. The scope is checked a second time inside the handler regardless.

### Diagnostics

| Command                        | Who              | What                                                                                                                              |
| ------------------------------ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `/gunsmith:doctor`             | `lab`            | Full health report: bridge, framework, inventory, every SQL table, both companion resources, current balance version, issue count |
| `/gunsmith:whoami`             | **Everyone**     | Every scope, every group and ACE object tested, the result of each, and which path granted access                                 |
| `/gunsmithserial`              | `lab`            | Serial number diagnostics                                                                                                         |
| `/gunsmithverify`              | **Console only** | Database-level verification: duplicate instance records, unowned records, design base colours, workbench count                    |
| `/gunsmithslots <id> [weapon]` | **Console only** | How many copies of a weapon a player's inventory holds and which serial each carries                                              |

{% hint style="info" %}
`/gunsmith:whoami` is deliberately **not** permission-gated. Its entire purpose is answering "why don't I have permission", which a gated command could never do.
{% endhint %}

Start with `/gunsmith:doctor`. It is the one command worth running after any install or update.

### Support commands

The resource ships a set of read-only diagnostics used when a ticket is open. They print to the console. You will normally only be asked to run one.

#### Skin sync

| Command             | What                                           |
| ------------------- | ---------------------------------------------- |
| `/gunsmithsync`     | What the sync scanner currently sees           |
| `/gunsmithlook`     | The local player's own appearance state        |
| `/gunsmithpool`     | The texture pool and what is holding each slot |
| `/gunsmithsyncread` | Read the sync state off nearby players         |

#### Full-body sync (prop lane)

| Command               | What                                                                                                 |
| --------------------- | ---------------------------------------------------------------------------------------------------- |
| `/gunsmithpropverify` | Request every model the lane needs and report how many loaded. **Run this before enabling the lane** |
| `/gunsmithprop`       | Current prop-lane state                                                                              |

#### Camo lane

| Command                | What                                                              |
| ---------------------- | ----------------------------------------------------------------- |
| `/gunsmithcamoverify`  | Audit the camo slot names against the game's own component models |
| `/gunsmithcamoresolve` | Resolve a weapon's camo targets                                   |
| `/gunsmithcamo`        | Current camo state                                                |

#### Texture discovery

These are the tools for adding a weapon. They apply test textures **locally only** — nothing is saved, nothing reaches other players, and `off` clears them.

| Command                                  | What                                                                               |
| ---------------------------------------- | ---------------------------------------------------------------------------------- |
| `/gunsmithprobe verify`                  | Audit the whole catalogue against the game's real weapon models                    |
| `/gunsmithprobe scan WEAPON_X`           | Scan for texture names that exist on a weapon                                      |
| `/gunsmithtry WEAPON_X <dict> <texture>` | Paint one exact pair red. Red means the pair is correct                            |
| `/gunsmithhunt WEAPON_X [n\|off]`        | Colour-coded parallel search — several candidates at once, each a different colour |
| `/gunsmithmeleetest`                     | Dump what the catalogue holds for melee weapons                                    |
| `/gunsmithmeleeshow`                     | Walk the melee weapons one at a time, one mapping at a time                        |

#### Workbenches

| Command           | What                                     |
| ----------------- | ---------------------------------------- |
| `/gunsmithtables` | The workbench list as the client sees it |

### Exports

All server-side, safe to call from other resources.

| Export             | Signature                        |
| ------------------ | -------------------------------- |
| `createInstance`   | `(weapon, owner, opts)`          |
| `getInstance`      | `(serial)`                       |
| `transferInstance` | `(serial, newOwner)`             |
| `destroyInstance`  | `(serial, reason)`               |
| `applySkin`        | `(serial, skinId)`               |
| `setComponents`    | `(serial, componentList)`        |
| `setTint`          | `(serial, tintIndex)`            |
| `setLivery`        | `(serial, camoName, colorIndex)` |
| `createSkin`       | `(author, def)`                  |
| `setSkinStatus`    | `(skinId, status, reason)`       |
| `mintSkin`         | `(skinId, owner)`                |
| `getWeaponStats`   | `(weaponName)`                   |
| `setWeaponStats`   | `(weaponName, patch, actor)`     |
| `deploy`           | `(actor, note)`                  |
| `rollback`         | `(version, actor)`               |
| `resolveDamage`    | `(weaponHash, bone, dist)`       |
| `addKill`          | `(serial, victimType)`           |

```lua
local instance = exports.aty_gunsmith:getInstance(serial)
```

### Events

Server-side, fired for you to listen to.

| Event                          | Payload                     |
| ------------------------------ | --------------------------- |
| `aty_gunsmith:instanceCreated` | `{ serial, weapon, owner }` |
| `aty_gunsmith:skinApplied`     | `{ serial, skinId, lane }`  |
| `aty_gunsmith:skinModerated`   | moderation decision         |
| `aty_gunsmith:balanceDeployed` | `{ version, diff, actor }`  |
| `aty_gunsmith:pendingChanged`  | pending balance changes     |
| `aty_gunsmith:damageFlagged`   | damage anomaly details      |

```lua
AddEventHandler('aty_gunsmith:instanceCreated', function(data)
    print(data.serial, data.weapon, data.owner)
end)
```
