# Garages

{% hint style="warning" %}
My script don't rely on any garage script, it saves the vehicles directly into your Database using the **default ESX and QB/Qbox columns.**&#x20;
{% endhint %}

> I can't make my script *"compatible"* with all the Garages because there's more than 50 (no cap, I just search it on [Fivem releases](https://forum.cfx.re/search?q=garage%20%23releases%20tags%3Apaid%20in%3Atitle)).

So this is just a little "guide" to help you make the script "compatible" with your Garage script, of course all column names will vary from script to script.

{% hint style="danger" %}
If you have 0 clue on how database works please hire an experienced dev, use Fiverr or any other site where u can hire ppl.. I won't give you any support because this errors **are not from my script.**
{% endhint %}

## Read Me

* First thing you need to do, **BUY A VEHICLE in your test server** and verify your server console, if you don't have ANY error and you can save and retrieve your vehicle from your garage then you are OK, you don't need to do anything else.
* If you server console looks ***something like this***:

<figure><img src="/files/3l71hRwKrczVcf2WkglZ" alt=""><figcaption><p>This is just an EXAMPLE</p></figcaption></figure>

* Let's read what the error is telling us:

```markdown
Error: av_vehicleshop was unable to execute a query
Query: INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
-- A LOT OF INFO THAT WE DON'T CARE ABOUT ----
Unknown column 'garage' in 'field list'
```

* The script tried to save the vehicle into your player\_vehicles table (or owned\_vehicles if using ESX) BUT the column `garage` does not exist in your table... oh wait, why!? Ah yes, because I'm using a different Garage script that altered my table and created/modified the default fields, let's fix it!
* Go to your `Database > player_vehicles` (or owned\_vehicles if using ESX), check your columns names:

<figure><img src="/files/pVu7fXp9llHIJWf8ZZNF" alt=""><figcaption><p>I'm using heidi sql, your DB might look different if using phpmysql, etc</p></figcaption></figure>

* The error was about an unknown column named **'garage'.**... oh wait! there's no garage column BUT we have a column named **parking** that my Garage script uses to store the garage name where the vehicle is stored.
* What should we do now? We need to change the query in `av_vehicleshop/server/editable/buy.lua`
* Here you will find 2 queries, one for QB and one for ESX, modify the one that belongs to the Framework you are using, for this example I'm using QBCore so I will modify line 10 (for ESX is line 22):

<figure><img src="/files/1MUIAShaEkipj4ybd1Zn" alt=""><figcaption></figcaption></figure>

* Once we have identified what query we need to modify and what's the column giving us the "error" we need to replace it.

```lua
-- We modify the old query:
MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {

-- Replacing the garage field with parking:
MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, parking, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
```

* Save the changes, restart av\_vehicleshop and buy the vehicle again...
* Did u got another column error? Let's repeat the steps we made for garage/parking but with this new column giving the error.

{% hint style="danger" %}
My script only register the vehicle into Database using the default Framework table structure, whatever happens after you spawn a vehicle from the garage it doesn't have **anything to do with my script and is on you to solve it.**
{% endhint %}


---

# 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.av-scripts.com/guides/vehicleshop/garages.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.
