# Sell horses and wagons on RedM

A horse and a wagon on sale in the store, delivered on their own to the character's stable on VORP or RSG.

Source: https://fivedash.fivex.gg/docs/en/tutorials/redm-store-horses

In this tutorial you get a RedM server ready for the store, add a horse and a wagon with in-game delivery and follow the delivery to the character's stable. It works with **VORP** and **RSG**; where the two differ, pick your tab. It's for whoever runs the server and the store.

## What you need

* A Brazilian organization with the **Store** module in its plan (Plus, Pro or Ultra).
* A RedM server with `set gamename rdr3` in `server.cfg` and `oxmysql` started before `fivedash`.
* **VORP** (`vorp_core`) or **RSG** (`rsg-core`).
* The `fivedash` resource on version **0.10.0** or newer. With `AutoUpdate = true` (the default), it updates itself and the new version takes effect on the next restart.
* A payment provider connected in the store. See [Sell a VIP with Pix and automatic delivery](https://fivedash.fivex.gg/docs/en/tutorials/sell-vip-with-pix).

## 1. Set the server to RedM

In the onboarding (**Server** step) or in **Add server**, choose **RedM** under **Game**. For a server you already have, change it in **Manage servers**. Products already there don't change on their own: edit their deliveries.

Install the resource (see [Connect your city to FiveDash](https://fivedash.fivex.gg/docs/en/tutorials/connect-your-city)) and keep this order in `server.cfg`:

### VORP

```bash
set gamename rdr3
ensure oxmysql
ensure vorp_core
ensure vorp_inventory
ensure fivedash
```

### RSG

```bash
set gamename rdr3
ensure oxmysql
ensure rsg-core
ensure rsg-inventory
ensure fivedash
```

In **Server → Overview**, the **Game connection** card should show **Connected**, with **VORP** or **RSG** under **Framework**.

## 2. Check the stable and wagon scripts

The store writes the horse and the wagon into the city's stable script table. One of these scripts must be running:

### VORP

| Delivery  | Script                          | Where FiveDash writes        |
| --------- | ------------------------------- | ---------------------------- |
| **Horse** | `vorp_stables` or `bcc-stables` | `stables` or `player_horses` |
| **Wagon** | `vorp_stables` or `bcc-wagons`  | `stables` or `player_wagons` |

### RSG

| Delivery  | Script                                        | Where FiveDash writes                     |
| --------- | --------------------------------------------- | ----------------------------------------- |
| **Horse** | `rsg-stables` (on older cities, `rsg-horses`) | `rsg_stables_horses` (or `player_horses`) |
| **Wagon** | `rsg-wagons`                                  | `player_wagons`                           |

With none of them, the **Game connection** card warns "No known stable or wagon script: horses or wagons don't arrive through the store.". If the script starts after `fivedash`, the resource detects again by itself. To see what was found, run `fivedash detect` in the console.

## 3. Open the store and choose who gets it

If the store isn't open yet, run its setup in **Store** (the four steps are in [Store overview](https://fivedash.fivex.gg/docs/en/store/overview)). On the **In-game delivery** step, answer **How does the buyer say who gets it?**:

| Option              | VORP                                                                | RSG                                                                   |
| ------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------- |
| **City ID**         | **Char ID** (`charidentifier` in the `characters` table)            | **Citizen ID**                                                        |
| **Discord account** | The newest character of the Steam that has joined with that Discord | The newest character of the license that has joined with that Discord |

Before payment, checkout asks the city whether the ID exists and shows the character's name.

## 4. Add the horse

In **Store → Categories**, click **New category**, enter the **Name** (e.g. Horses) and click **Create category**. Then, in **Store → Products**, open the category and click **Add product**:

1. In **Details**, enter the product's **Name** and, in **Price**, the amount.
2. In **In-game delivery**, click **Add delivery** and pick **Horse**.
3. In **Horse model**, type the model (e.g. `A_C_Horse_Arabian_White`). It must exist in the city's stable script.
4. Keep the **Status** on **On sale** and click **Save**.

### VORP

VORP doesn't check the model: copy the exact name from the stable's config (`vorp_stables` or `bcc-stables`).

### RSG

FiveDash writes the horse with the breed's numbers from `rsg-stables/shared/config.lua`, in the stable the character already uses or the first on the list.

## 5. Add the wagon

Make a new product the same way. In **In-game delivery**, click **Add delivery**, pick **Wagon** and type the **Wagon model** (e.g. `supplywagon`). It must exist in the city's wagon script.

### VORP

The wagon goes into `stables` (`vorp_stables`) or `player_wagons` (`bcc-wagons`), for the script that is running.

### RSG

The model must exist in `rsg-wagons/shared/config.lua`.

> To sell several models in one product, add the **Player's choice** delivery and pick **Horses** or **Wagons** under **What the player chooses**. To add the options all at once, paste a list, one per line, as `Name; value`.

The same editor has **Weapon** (**Weapon name**, e.g. `WEAPON_REVOLVER_CATTLEMAN`) and **Gold** (**Amount**). Unlike horses and wagons, these two wait for the player to join the city.

## 6. Test and follow the delivery

Buy the horse on the store website, as in [Test a purchase](https://fivedash.fivex.gg/docs/en/tutorials/sell-vip-with-pix). Horses and wagons are delivered right away, with the player online or offline. With more than one unit, one arrives per unit.

In **Store → Orders**, the order moves to **Delivered**. In the game, the horse shows up in the character's stable.

> If the player was on the server when they bought it, the horse or wagon shows up in the stable after they join again, when the stable script keeps its list in memory.

If the delivery stays on **Failed**, open the order and read the reason:

| Reason                                                  | What to do                                                        |
| ------------------------------------------------------- | ----------------------------------------------------------------- |
| The FiveDash resource on the server is from before RedM | Restart the server so it updates and click **Resend to the city** |
| The ID doesn't exist in the city                        | Fix it in **Game ID** and click **Resend to the city**            |

Only the deliveries that failed go back to the queue: what already arrived isn't delivered again.

## Next steps

[RedM](https://fivedash.fivex.gg/docs/en/getting-started/redm)

Everything that changes on a RedM server.

[Products](https://fivedash.fivex.gg/docs/en/store/products)

The horse, wagon, weapon and gold fields.

[In-game delivery](https://fivedash.fivex.gg/docs/en/store/in-game-delivery)

What waits for the player and what arrives right away.

[Frameworks](https://fivedash.fivex.gg/docs/en/developers/frameworks)

VORP and RSG in detail.
