> 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/getting-started/installation.md).

# Installation

## Installation

Follow these steps in order. There is no SQL to import and no config to edit before the first start.

**1. Extract**

Place both resources in your server's resources folder:

```
resources/[aty]/aty_gunsmith
resources/[aty]/aty_gunsmith_assets
```

Keep the folder names exactly as they are — NUI paths and the art pool are resolved by resource name.

**2. Check the dependencies**

| Dependency                             | Required         | Notes                                                                                                                |
| -------------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------- |
| `aty_lib`                              | **Yes**          | Declared in `fxmanifest.lua`. Provides identifiers, inventory, callbacks, SQL, notifications and zones               |
| `qb-core` / `es_extended` / `qbx_core` | **One of them**  | Detected through `aty_lib`. Qbox works through its qb-core compatibility layer                                       |
| `oxmysql` or `mysql-async`             | **One of them**  | Reached through `aty_lib`, never called directly                                                                     |
| `aty_gunsmith_assets`                  | In practice, yes | Not a hard dependency — the script starts without it, but you lose the art pool and full-body skin sync              |
| `ox_target` / `qb-target`              | Optional         | Only when `Config.Access.workshop.target = true`, which is the default. Falls back to a marker if neither is running |

**3. Start order**

`aty_lib` must come first.

```cfg
ensure aty_lib
ensure aty_gunsmith_assets
ensure aty_gunsmith
```

**4. Database**

Nothing to do. On first start the resource creates its own tables with `CREATE TABLE IF NOT EXISTS`:

```
aty_gunsmith_instances    one physical weapon in an inventory
aty_gunsmith_skins        a design record
aty_gunsmith_balance      one row per balance deploy
aty_gunsmith_range        shooting range sessions
aty_gunsmith_tables       workbenches
aty_gunsmith_audit        the audit trail
```

It also runs guarded column migrations, so upgrading from an older version needs no action.

{% hint style="info" %}
If your database user has no `CREATE` grant, import `sql/install.sql` by hand instead. It mirrors the same schema exactly.
{% endhint %}

**5. Grant yourself the lab scope**

You need it to place the first workbench. On QBCore:

```
/setperm <id> admin
```

On ESX, set the player's group to `admin`. Standalone, or as a fallback on either:

```cfg
add_ace group.admin gunsmith.balance allow
```

Full detail, including what to do when a grant is ignored, is on Permissions.

**6. Place a workbench**

```
/gunsmithadmin
```

By default there is **no `/gunsmith` command and no fixed workshop zone** — the way into the workshop is a workbench you build in game. See Workbenches.

### Verifying the install

Run the built-in diagnostic from the server console or in game with the lab scope:

```
/gunsmith:doctor
```

It reports the bridge, the detected framework and inventory, every SQL table, the two companion resources and the current balance version, and finishes with an issue count.

| Check                   | Expected                           |
| ----------------------- | ---------------------------------- |
| `/gunsmith:doctor`      | 0 issues                           |
| `/gunsmithadmin`        | Workbench management opens         |
| Studio pattern gallery  | Artwork visible, not an empty list |
| Studio template gallery | 56 templates                       |

An empty art gallery means `aty_gunsmith_assets` did not start.

### Updating

Replace both folders and restart. Weapons, designs, workbenches and balance versions live in the database, so an update never costs you any of them.

```
refresh
restart aty_gunsmith_assets
restart aty_gunsmith
```

{% hint style="warning" %}
`refresh` first, always. Newly streamed assets are not picked up by `restart` alone, and the file list changes on every version update. Skipping it is the usual cause of "the update did nothing".
{% endhint %}

Keep the two resources on matching versions. `aty_gunsmith_assets` carries the weapon model copies that full-body sync needs; an old copy of it and a new script is a supported-weapon list that points at files which are not there.
