# Installation

## 1. Before starting

Welcome to Dealership  installation guide, this resource will fulfill all the functions and options you need in a dealership script, including a unique vip system, do not forget that with great power comes great responsibility, therefore you must carefully follow all the steps that you will see in this installation guide.

{% hint style="info" %}
Please, before opening a ticket in our community, check all the steps of this installation, since the vast majority of tickets are due to ignoring certain steps in the guide. Each step is important and must be respected.
{% endhint %}

## 2. Asset download

To get started, you'll need to download your new resource previously purchased from [playooze-scripts.tebex.io/](https://playooze-scripts.tebex.io/). For that we must log in with our account at [`keymaster`](https://keymaster.fivem.net/asset-grants/) and look for the Asset grants section, there we will find our complete package.

{% hint style="info" %}
Updates will be announced via Announcements in our [`community`](https://discord.gg/MQPwEZnAnT), but remember to claim your roles by logging into our website to view your customer channel and get the other files download.
{% endhint %}

## 3. How does the system work?

Playooze dealership is a very advanced dealership wich allows us to access both normal and vip dealership exposing all the vehicles choosen.

You can also filter the locations so that only certain jobs can access and buy vehicles.

## 4. Dependencies

Dealership has not any dependency, only ESX or QBCore framework but if you wanna use the car pack that comes with the script, you need to follow the next step.

| Name            |                            |
| --------------- | -------------------------- |
| `Version 2802+` | `sv_enforceGameBuild 2802` |

## 5. Game version

{% hint style="info" %}
You can skip this step if you are not going to use the car pack that we offer
{% endhint %}

The GTA 5 cars displayed on the normal dealership depends on the version of your game (GameBuild) and the minimum mandatory version will be `2802`, we can add this version to our server.cfg as follows, please do not skip this step as it is completely vital.

```
// sv_enforceGameBuild 2802
```

## 6. Database installation

For this step we recommend you keep your vehicles table from sql.

The script works with any sql from the default dealerships that come with the TX Admin default base.

If you dont have any you can insert this ones

### ESX

```
// CREATE TABLE `owned_vehicles` (
	`owner` varchar(22) NOT NULL,
	`plate` varchar(12) NOT NULL,
	`vehicle` longtext,
	`type` VARCHAR(20) NOT NULL DEFAULT 'car',
	`job` VARCHAR(20) NOT NULL,
	`stored` TINYINT(1) NOT NULL DEFAULT '0',

	PRIMARY KEY (`plate`)
);
```

### QB Core

```
// CREATE TABLE IF NOT EXISTS `player_vehicles` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `license` varchar(50) DEFAULT NULL,
    `citizenid` varchar(50) DEFAULT NULL,
    `vehicle` varchar(50) DEFAULT NULL,
    `hash` varchar(50) DEFAULT NULL,
    `mods` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
    `plate` varchar(15) NOT NULL,
    `fakeplate` varchar(50) DEFAULT NULL,
    `garage` varchar(50) DEFAULT 'pillboxgarage',
    `fuel` int(11) DEFAULT 100,
    `engine` float DEFAULT 1000,
    `body` float DEFAULT 1000,
    `state` int(11) DEFAULT 1,
    `depotprice` int(11) NOT NULL DEFAULT 0,
    `drivingdistance` int(50) DEFAULT NULL,
    `status` text DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `plate` (`plate`),
    KEY `citizenid` (`citizenid`),
    KEY `license` (`license`)
) ENGINE=InnoDB AUTO_INCREMENT=1;

ALTER TABLE `player_vehicles`
ADD UNIQUE INDEX UK_playervehicles_plate (plate);

ALTER TABLE `player_vehicles`
ADD CONSTRAINT FK_playervehicles_players FOREIGN KEY (citizenid)
REFERENCES `players` (citizenid) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE `player_vehicles`
ADD COLUMN `balance` int(11) NOT NULL DEFAULT 0;
ALTER TABLE `player_vehicles`
ADD COLUMN `paymentamount` int(11) NOT NULL DEFAULT 0;
ALTER TABLE `player_vehicles`
ADD COLUMN `paymentsleft` int(11) NOT NULL DEFAULT 0;
ALTER TABLE `player_vehicles`
ADD COLUMN `financetime` int(11) NOT NULL DEFAULT 0;
```


---

# Agent Instructions: 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://playooze-scripts.gitbook.io/playooze-scripts/script-guides/playooze-dealership/installation.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.
