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

# Installation

Install CAS Gunsmith on your RedM server — VORP and RSG Core requirements, server.cfg order, the optional Gun Oil item, RSG notes and the first checks.

The script runs on **VORP** and on **RSG Core**. The framework is detected when the resource starts; there is nothing to switch in the config.

## Requirements

### VORP

| Resource         | Purpose                                                                                                                                                                                           |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `vorp_core`      | Character, money and XP data.                                                                                                                                                                     |
| `vorp_inventory` | Weapons, weapon components, ammo and the Gun Oil item. Must be a recent version that includes the weapon component exports (`getWeaponComponents`, `addWeaponComponents`, `subWeaponComponents`). |

Weapon items in the inventory must be named after the in-game weapon name, for example `WEAPON_REVOLVER_CATTLEMAN`. This is the VORP default.

### RSG Core

| Resource        | Purpose                                                              |
| --------------- | -------------------------------------------------------------------- |
| `rsg-core`      | Character and money.                                                 |
| `rsg-inventory` | Weapon items, their parts and the ammo boxes.                        |
| `rsg-weapons`   | Drawing weapons; the gunsmith fits its parts when a weapon is drawn. |
| `rsg-ammo`      | Opens the ammo boxes the gunsmith sells.                             |
| `ox_lib`        | Notifications.                                                       |

Weapon items use RSG's lowercase names, for example `weapon_revolver_cattleman`. This is the RSG default.

There are no other dependencies. No SQL setup is required on either framework.

## Steps

1. Copy the resource folder into your server's `resources` directory.
2. Start it in `server.cfg` after the framework resources:

```cfg
# VORP
ensure vorp_core
ensure vorp_inventory
ensure rsm_gunsmith

# RSG Core
ensure rsg-core
ensure rsg-inventory
ensure rsg-weapons
ensure rsg-ammo
ensure rsm_gunsmith
```

3. Optional: add the Gun Oil item (see below).
4. Check the shop coordinates in `config.lua` against your map. Details: [Shops and Interaction](/script-documentation/cas-gunsmith/configuration/shops.md).
5. On RSG, check `Config.Rsg` (money type, rank locks, ammo boxes). Details: [General Settings](/script-documentation/cas-gunsmith/configuration/general.md).
6. Restart the server.

{% hint style="warning" %}
Do not rename the folder after installation. Weapon records and presets are stored under the resource name. If the name changes, that data is no longer visible.
{% endhint %}

## Gun Oil item

Players can clean their weapon for free with their own Gun Oil. For this, the item must exist with exactly the same name as `Config.GunOilItem`. The default name is `gun_oil`. If you do not want this feature, you do not need to add the item. Players then pay the shop price for cleaning.

**VORP**, in the `items` table:

```sql
INSERT INTO `items` (`item`, `label`, `limit`, `can_remove`, `type`, `usable`, `desc`)
VALUES ('gun_oil', 'Gun Oil', 10, 1, 'item_standard', 0, 'Keeps a weapon clean and oiled.');
```

Columns can differ between VORP versions. Use an existing row in your table as a reference. To give the item an inventory image, add `vorp_inventory/html/img/items/gun_oil.png`.

**RSG Core**, in `rsg-core/shared/items.lua`:

```lua
gun_oil = { name = 'gun_oil', label = 'Gun Oil', weight = 100, type = 'item', image = 'gun_oil.png', unique = false, useable = false, shouldClose = true, description = 'Keeps a weapon clean and oiled.' },
```

For an image, add `gun_oil.png` to `rsg-inventory/html/images/`.

## RSG notes

* **Parts** are saved on the weapon item itself, in `info.componentshash`, the same place `rsg-weaponcomp` uses. They travel with the weapon when it changes hands.
* **Ammo** is sold as `rsg-ammo` boxes; the player opens them from the inventory. The box for each ammo type is set in `Config.Rsg.ammoBoxes`.
* **Varmint ammo:** `rsg-ammo` expects an `ammo_box_varmint` item, but the default `rsg-core` item list does not include it. Add it next to the other ammo boxes in `rsg-core/shared/items.lua`, or varmint ammo bought at the gunsmith is refunded:

```lua
ammo_box_varmint = { name = 'ammo_box_varmint', label = 'Ammo Box Varmint', weight = 100, type = 'item', image = 'ammo_box_varmint.png', unique = false, useable = true, shouldClose = true, description = 'Varmint Ammo Box' },
```

* **Repairs** set the weapon's `info.quality` back to 100, so `rsg-weapons` does not put the old wear back.
* **Rank locks** are off on RSG unless `Config.Rsg.rankRep` names a rep to use as XP.

## First check

* A gunsmith blip appears on the map for every shop.
* The **Use the Bench** prompt appears near the bench. Holding E opens the bench.
* A player with no configured weapon in their inventory gets the notification "You carry nothing the gunsmith can work on."
* The server console shows no `Neither vorp_core nor rsg-core is running` line.
