> 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/custom-weapons.md).

# Custom weapons

Custom weapons in CAS Weapon Studio for RedM. A base weapon with its own name, skin and damage tune, sold at gunsmiths in an open or a numbered limited run, and what the buyer gets on VORP, RSG and st

A custom gun is one of the game's weapons made your server's own: a name, a skin, a damage tune and a price. Players buy it at a gunsmith and get the real weapon.

{% hint style="info" %}
New weapon models are not possible on RedM. A custom gun is always one of the game's own weapons: the buyer gets that weapon. What is new is its name, its skin and its damage.
{% endhint %}

## What it is and what it is not

| A custom gun is                                           | A custom gun is not                       |
| --------------------------------------------------------- | ----------------------------------------- |
| One of the 73 weapons in the studio                       | A new weapon model                        |
| A name and a short description                            | A new entry in the game's weapon list     |
| One of your skins for that weapon (optional)              | A weapon with its own stats beyond damage |
| A damage tune, 75 % to 125 % of the game's own by default |                                           |
| A price and the gunsmith towns that sell it               |                                           |
| An open run, or a limited run of 1 to 9999 guns           |                                           |

Turn the whole feature off with `Config.Editions.enabled = false`. See [Configuration](/script-documentation/cas-weapon-studio/configuration.md#custom-weapons).

## The form

In the studio, open the Custom tab and press "New gun". Click a gun in the list to change it.

| Field                    | What it does                                                                                            |
| ------------------------ | ------------------------------------------------------------------------------------------------------- |
| Name                     | 1 to 40 letters                                                                                         |
| Description              | A line or two the buyer reads, up to 200 letters                                                        |
| Base weapon              | One of the 73 weapons                                                                                   |
| Skin                     | "No skin", or one of your saved designs for that weapon                                                 |
| Damage                   | A slider between `Config.Editions.minDamage` and `maxDamage`, shown in percent. 100 % is the game's own |
| Price                    | 0 to 100000 dollars                                                                                     |
| Sold at the gunsmiths of | The towns that sell it. With no town picked, the gun is not sold anywhere                               |
| Limited run              | Off: an open run. On: a number of guns from 1 to 9999                                                   |
| On sale                  | Off takes the gun out of the book without deleting it                                                   |

"Save the gun" stores it. It is in the book of its towns at once: a custom gun needs no restart. Only its skin does.

The list shows each gun with ON SALE or OFF, its base weapon, its price and how it sold: "3 sold" for an open run, "3 of 25 sold" for a limited run.

### The skin of a custom gun

* Any saved design for the base weapon can be picked, live or not.
* With a skin that is not live yet you read: "This skin is not live yet. It goes on the gun after the restart."
* The buyer owns the skin along with the gun. It is also in their "My skins", so they can take it off and put it on again.

{% hint style="warning" %}
A gun bought while its skin is not live yet arrives without the skin on. After the restart the skin is in the buyer's "My skins": they put it on there. Sell a gun after its skin is LIVE and the skin is on from the first moment.
{% endhint %}

### Changing a gun that was sold

* Once a gun was sold, its base weapon stays: "This gun was sold already, so its base weapon stays."
* A change to the damage counts for every buyer, old and new. Buyers who are online get it the next time their skins are refreshed, for example when they rejoin or use the book.
* A change to the name, description or price counts for new buyers only.
* Deleting a gun ("Delete", then "Sure?") takes it out of the book and ends its damage tune, again from each buyer's next refresh on. Buyers keep their weapon and the skin.

## Limited runs

|                   | Open run       | Limited run                                            |
| ----------------- | -------------- | ------------------------------------------------------ |
| How many          | No limit       | The number you set, 1 to 9999                          |
| The weapon's name | The gun's name | The gun's name and its number: "Marshal's Pride No. 7" |
| In the book       | No count       | "N left"                                               |
| When all are sold | Never          | SOLD OUT. Only players who own one still see it        |

The number is the order of sale: the first buyer gets No. 1.

A player may buy the same gun more than once, as long as guns are left.

## The damage tune

The tune is a share of the base weapon's damage: 0.75 is 75 %, 1.25 is 125 %. The book shows it as "+20 % damage" or "-10 % damage". At 100 % it shows nothing.

How it works:

* The tune belongs to the character and the weapon model, not to one single gun.
* While the buyer holds any weapon of that model, that weapon type deals the tuned damage for them.
* Other players' weapons of the same model are not changed.
* A character who owns two custom guns of the same weapon model gets one tune for that model, not both.
* Taking a gun off sale does not end the tune for players who bought it.
* It ends when the gun is deleted in the studio, or when `Config.Editions.enabled` is `false`.

{% hint style="info" %}
Because the tune follows the weapon model, a buyer of a tuned Cattleman has the tune on every Cattleman they carry. Keep this in mind when you set the damage and the price.
{% endhint %}

## What the buyer gets

The player buys in the skin book at a gunsmith of a town that sells the gun. See [The skin book](/script-documentation/cas-weapon-studio/skin-book.md#custom-guns).

On every framework:

* The price is paid first. If the weapon cannot be handed over, the money comes back: "The gunsmith could not hand the weapon over. You have your money back."
* The skin (when the gun has one) becomes the buyer's and is put on that weapon model. It takes the place of a skin that was on it.
* The damage tune starts for that weapon model.

|                      | VORP                                                                   | RSG                                               | Standalone                                             |
| -------------------- | ---------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------ |
| The weapon           | A weapon in `vorp_inventory`, made with `createWeapon`                 | The weapon item, added with `AddItem`             | The weapon is given to the player's ped with 30 rounds |
| Name and description | The gun's name and description are on the weapon                       | Sent as the item's `label` and `description` info | Not carried                                            |
| Carry limit          | Checked before paying: "You cannot carry another weapon of that kind." | Not checked by the script                         | Not checked                                            |
| Price                | Dollars                                                                | Cash                                              | Nothing is charged                                     |

On RSG the item name is the weapon's name in lower case, for example `weapon_revolver_cattleman`. Whether your inventory shows the `label` and `description` from the item info depends on that inventory.

{% hint style="warning" %}
Handing the weapon over on RSG and on standalone servers is code only, not verified in game. On any framework, buy a gun once on a test server before you put it on sale.
{% endhint %}

## Messages you may see

| Message                                                                | Meaning                                                        |
| ---------------------------------------------------------------------- | -------------------------------------------------------------- |
| Give the gun a name (1 to 40 letters).                                 | The name is empty or too long                                  |
| Pick a base weapon.                                                    | No base weapon chosen                                          |
| That skin is not made for this weapon.                                 | The skin belongs to another weapon                             |
| A limited run takes 1 to 9999 guns.                                    | The run size is out of range                                   |
| This gun was sold already. Its base weapon stays.                      | The base weapon of a sold gun cannot change                    |
| Custom weapons are turned off on this server.                          | `Config.Editions.enabled` is `false`                           |
| This gun is sold out.                                                  | The limited run is finished                                    |
| You cannot carry another weapon of that kind.                          | VORP: the inventory refused another weapon                     |
| The gunsmith could not hand the weapon over. You have your money back. | The framework did not give the weapon. The player was refunded |
