> For the complete documentation index, see [llms.txt](https://docs.kojascripts.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kojascripts.eu/free/carmarket/configuration/test-drive.md).

# Test Drive

Buyers can take a listed vehicle for a spin **before** committing to a purchase. The vehicle spawns at a fixed safe spot with a configurable time limit; canceling early teleports the player back to where they were.

***

## Settings

{% code title="shared/config.lua" %}

```lua
Config.TestDrive = {
    Enabled = true,
    coords = vec3(-1015.0851, -3328.7476, 13.9444),
    heading = 59.8811,
    secondslimit = 20,
    price = 0,
    cancelKey = 73,
}
```

{% endcode %}

| Field          | Default     | Purpose                                       |
| -------------- | ----------- | --------------------------------------------- |
| `Enabled`      | `true`      | Master toggle for the feature                 |
| `coords`       | `vec3(...)` | World position where the test vehicle spawns  |
| `heading`      | `59.88`     | Spawn heading                                 |
| `secondslimit` | `20`        | Duration in seconds (test ends automatically) |
| `price`        | `0`         | Bank fee charged when the test starts         |
| `cancelKey`    | `73` (X)    | Key code to cancel early                      |

***

## Cancel key reference

| Code | Key |
| ---- | --- |
| `73` | X   |
| `47` | G   |
| `38` | E   |

Any FiveM control ID works. See the [FiveM controls reference](https://docs.fivem.net/docs/game-references/controls/).

***

## Per-zone overrides

Add a `testDrive` table to any zone in `Config.Zones` to override the defaults for that zone:

{% code title="shared/config.lua" %}

```lua
{
    id = "zone3",
    -- ... other zone fields ...
    testDrive = {
        coords = vec3(1180.0, 2640.0, 37.8),
        heading = 90.0,
        secondslimit = 30,
        price = 500,
        cancelKey = 47,
    },
},
```

{% endcode %}

Any field omitted from the override falls back to the global `Config.TestDrive`.

***

## Disabling test drives

```lua
Config.TestDrive = { Enabled = false }
```

The "Test drive" button is hidden from the tablet UI and any direct calls return a `disabled` error.

{% hint style="warning" %}
Test drives are **not** available for auctions that have ended. The server checks this before spawning.
{% endhint %}
