> For the complete documentation index, see [llms.txt](https://zloma-scripts.gitbook.io/zloma-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zloma-scripts.gitbook.io/zloma-scripts/zloma_vehicleshop-paid/features/customer-flow.md).

# Customer Flow

## Salon Browsing

Players approach a salon, enter its private showroom instance, and browse only the vehicles/categories configured for that dealership.

Each salon can define:

* Its own category list
* Its own active vehicle stock
* Required job and minimum job grade
* Trade-in availability
* Test drive coordinates
* Camera and showroom positioning

***

## Vehicle Preview

The preview system spawns a real vehicle entity in the showroom so the customer can inspect it visually.

Supported preview actions:

* Select a category
* Cycle between vehicles
* Change primary and secondary colors
* Rotate the showroom camera
* Read detailed vehicle info through NUI callbacks

***

## Tuning Preview

If `Config.TuningPreview.enabled` is on, the customer can preview GTA V modification categories on the showroom vehicle.

This system is designed for visual evaluation only. It does not automatically apply the selected setup to the purchased owned vehicle.

***

## Test Drives

The test drive system gives players a temporary vehicle for a limited time.

Behavior:

* Starts through a server callback with validation
* Moves the player into an isolated routing bucket
* Tracks whether a player already has an active test drive
* Returns the player and cleans up when the timer ends or the drive is cancelled

Use this when you want realistic previews without risking normal showroom vehicles or shared world state.

***

## Trade-In

The trade-in flow lets the customer exchange one owned vehicle toward the next purchase.

Core behavior:

* Loads eligible owned vehicles from the database
* Calculates the offer value from configured percentage rules
* Deducts the trade-in value from the final purchase price
* Removes/updates the traded vehicle record and creates the new owned vehicle entry

Trade-in can be globally disabled or tuned with percentage bounds in `config.lua`.

***

## Purchase Flow

On successful purchase the system:

1. Validates the selected salon and vehicle.
2. Checks player funds through `zloma_core`.
3. Generates a plate using `Config.PlatePrefix` rules.
4. Inserts the new owned vehicle data.
5. Optionally triggers Discord logging.
6. Runs open customization hooks from `sv_customization.lua` and `cl_customization.lua`.

The result is a normal framework-owned vehicle record ready for garage or key integrations routed through `zloma_core`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zloma-scripts.gitbook.io/zloma-scripts/zloma_vehicleshop-paid/features/customer-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
