# okokGarage

[**YouTube Video**](https://www.youtube.com/watch?v=yEq9wxSNGj0)

## **Installation Guide**

#### Execute the following SQL code in your database:

```sql
CREATE TABLE `okokgarage_pgarages` (
    `garagename` VARCHAR(250) NULL DEFAULT NULL,
    `coords` VARCHAR(250) NULL DEFAULT NULL,
    `type` VARCHAR(50) NULL DEFAULT NULL,
    `owners` VARCHAR(250) NULL DEFAULT NULL
);

CREATE TABLE `okokgarage_companies` (
    `company_name` VARCHAR(50) NOT NULL,
    `owner` VARCHAR(255) NULL DEFAULT NULL,
    `owner_name` VARCHAR(50) NULL DEFAULT NULL,
    `money` INT(11) NULL DEFAULT NULL,
    `employees` LONGTEXT NULL DEFAULT NULL,
    `total_sales` INT(11) NULL DEFAULT NULL,
    `sales_history` LONGTEXT NULL DEFAULT NULL,
    CONSTRAINT `employees` CHECK (json_valid(`employees`))
);

CREATE TABLE `okokgarage_sharedgarages` (
    `owner` VARCHAR(255) NULL DEFAULT NULL,
    `ownername` VARCHAR(50) NULL DEFAULT NULL,
    `sharedwith` LONGTEXT NULL DEFAULT NULL
);
```

**ESX**

```sql
ALTER TABLE `owned_vehicles`
    ADD COLUMN `parking` VARCHAR(60) NULL DEFAULT NULL,
    ADD COLUMN `doorcondition` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `windowcondition` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `tyrecondition` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `favourite` TINYINT(1) NULL DEFAULT 0,
    ADD COLUMN `impoundTime` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `location` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `reason` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `sharedwith` LONGTEXT NULL DEFAULT '[]',
    ADD COLUMN `vehiclename` varchar(23) NULL DEFAULT NULL
;
```

**QBCore**

```sql
ALTER TABLE `player_vehicles`
    ADD COLUMN `parking` VARCHAR(60) NULL DEFAULT NULL,
    ADD COLUMN `doorcondition` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `windowcondition` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `tyrecondition` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `favourite` TINYINT(1) NULL DEFAULT 0,
    ADD COLUMN `impoundTime` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `location` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `reason` VARCHAR(255) NULL DEFAULT NULL,
    ADD COLUMN `sharedwith` LONGTEXT NULL DEFAULT '[]',
    ADD COLUMN `vehiclename` varchar(23) NULL DEFAULT NULL
;
```

### Vehicle Keys

{% tabs %}
{% tab title="Client" %}

```lua
TriggerServerEvent("okokGarage:GiveKeys", plate)
TriggerServerEvent("okokGarage:RemoveKeys", plate, source)
```

{% endtab %}

{% tab title="Server" %}

```lua
TriggerEvent("okokGarage:GiveKeys", plate)
TriggerEvent("okokGarage:RemoveKeys", plate, source)
```

{% endtab %}
{% endtabs %}

### Stolen Vehicle

Once triggered, the only way for a player to recover their vehicle is to go to the police station and pay to get the vehicle back in their garage.

```lua
TriggerServerEvent("okokGarage:setVehicleStolen", plate)
```

### Adding vehicle images

To add images to the vehicles, simply drop them in the **web/img/vehicles** folder with the **same id** as the vehicle (the images should be in the **PNG** format).

### Set the Discord Webhook URL (to enable logs)

Navigate to the `sv_utils.lua` file and paste the webhook URL in the line 3.

[How to create a Discord Webhook URL](https://ahsda89sgdh18923asd.gitbook.io/main/others/discord-webhook)

### Server artifacts

Make sure your server artifacts version is above the **5181**.

* Windows: <https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/>
* Linux: <https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/>


---

# 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://docs.okokscripts.io/scripts/okokgarage.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.
