> For the complete documentation index, see [llms.txt](https://lscripts.gitbook.io/lscripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lscripts.gitbook.io/lscripts/scripts/l-vehicleshop/selling.md).

# Selling

### Back to the dealership

Selling does not happen in the panel. The owner drives the car onto a dealership's `sell` point and presses E, and a window shows the car and the payout before anything happens. The car has to be registered on that character, and the plate is read off the vehicle itself.

```lua
Config.SellBack = {
    enabled = true,
    percent = 50,
    account = 'bank',
    ownShopOnly = true,
    radius  = 5.0,
    blip    = { enabled = false, sprite = 524, color = 3, scale = 0.7, label = 'Sell vehicle' },
}
```

| Setting       | What it does                                    |
| ------------- | ----------------------------------------------- |
| `enabled`     | Turns selling off everywhere                    |
| `percent`     | What comes back, 50 is half the shop price      |
| `account`     | Where the money goes, cash or bank              |
| `ownShopOnly` | A dealership only buys the cars it sells itself |
| `radius`      | How close the car has to be to the spot         |
| `blip`        | An own map blip per sell spot, off by default   |

The payout is resolvable on three levels and the closest one wins: `sellPercent` on a vehicle beats `sellPercent` on the dealership, which beats `Config.SellBack.percent`. A single dealership stops buying with `sell = false`, a single lot with `sell = false` on its point.

{% hint style="info" %}
The sell spot gets no map blip by default, because it usually sits at a dealership that is already on the map. Turn the blip on if yours are somewhere else.
{% endhint %}

### Between two players

Players sell their own cars to each other with a contract item. The seller sits in the car and uses the item. The game takes the nearest player as the buyer and asks the seller for a price. The buyer then sees the same sheet, with the car, the plate, the seller and the amount, and confirms or declines. Only then does the money change hands and the car move over.

```lua
Config.Contract = {
    enabled  = true,
    item     = 'vehicle_contract',
    consume  = true,
    distance = 5.0,
    account  = 'bank',
    minPrice = 1,
    maxPrice = 10000000,
    timeout  = 60,
}
```

| Setting                | What it does                                          |
| ---------------------- | ----------------------------------------------------- |
| `item`                 | The item name, has to match the one in your inventory |
| `consume`              | Uses the contract up on a finished sale               |
| `distance`             | How close the buyer has to stand, in metres           |
| `account`              | What the buyer pays from and the seller is paid to    |
| `minPrice`, `maxPrice` | The range the seller may type                         |
| `timeout`              | Seconds an offer stays open before it expires         |

If either player walks away, disconnects or dies while the sheet is open, the contract is dropped and the other one is told why.

{% hint style="info" %}
The server checks everything again at the moment the buyer confirms: both players still close together, the seller still owning the car, the contract still in their pocket and the buyer able to pay. Nothing the panel sends is taken at face value.
{% endhint %}
