# Test Drives

Let a buyer try the vehicle before they commit. The car spawns at a fixed safe location, runs for a configurable time, and disappears at the end — teleporting the player back to where they started.

## How a player starts one

::::steps
### Open the listing in the tablet

Go to **Market** → click the vehicle you want to test.


### Click "Test drive"

If `Config.TestDrive.Enabled = false` or the auction has ended, the button is hidden.


### Pay the fee (if any)

`Config.TestDrive.price` is deducted from the player's bank.

:::hint{type="warning"}
The fee is **non-refundable**, even if the player cancels immediately.
:::


### Drive

The player is teleported into a fresh copy of the vehicle at `Config.TestDrive.coords`. The timer starts:

* Default `Config.TestDrive.secondslimit` = `20` seconds.
* Press `Config.TestDrive.cancelKey` (default **X**, code `73`) to end early.


### Auto-return

When the timer hits zero (or the player cancels), the test vehicle is deleted and the player is teleported back to their original position.
::::

## Per-zone configuration

Override the global test-drive settings for a specific zone by adding `testDrive` to the zone:

```lua title="shared/config.lua"
{
    id = "zone3",
    -- ... other zone fields ...
    testDrive = {
        coords = vec3(1180, 2640, 37.8),
        heading = 90.0,
        secondslimit = 60,
        price = 1000,
        cancelKey = 73,
    },
},
```


## Edge cases

| Situation                           | Behavior                                                                                      |
| ----------------------------------- | --------------------------------------------------------------------------------------------- |
| Player disconnects mid-test         | Vehicle entity is auto-cleaned by FiveM; player is teleported back on reconnect (best effort) |
| Resource is restarted mid-test      | `abortMarketTestDriveOnStop` kicks in: vehicle deleted, player teleported back                |
| Player tries to start a second test | `test_drive_busy` notification, ignored                                                       |
| Auction listing, auction ended      | `test_drive_auction_ended` notification, ignored                                              |
| Vehicle has no resolvable model     | `test_drive_no_model` notification, no spawn                                                  |

## Related pages

- [Exchange Zones](/free/carmarket/features/exchange-zones) — A player can own an entire zone and run it like a small business: set listing fees, take commission on every sale, cap how many listings can run concurrently.
- [Auctions](/free/carmarket/features/auctions) — Time-boxed bidding with a clear winner and a buy-out finalization step.
- [Overview](/free/carmarket/features/overview) — What players can actually do with Koja-Carmarket, from their POV.
- [Parking Slots](/free/carmarket/features/parking-slots) — Before a player can list a car, they need at least one parking slot in the zone they want to list in.
- [Listings](/free/carmarket/features/listings) — The simplest flow: a player lists a vehicle from their garage at a fixed price; another player walks up to the market zone, opens the tablet, and buys it.
- [Features](/free/carmarket/features) — back to the section overview
