# Import Vehicles

{% hint style="success" %}
To start importing vehicles place yourself in an open zone because the script will start spawning vehicles in order to retrieve their specs.
{% endhint %}

## Addon Vehicles

> If you're importing addon vehicles, make sure FiveM knows how they're named. To do this, go to `client/editable/vehnames.lua` and add each vehicle's spawn name and label to the `myAddonVehicles` table.

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FqpmCOXHLM73irpdZrDaQ%2Fimage.png?alt=media&#x26;token=78058a2a-a8ed-49c1-a5a1-0093502c45f9" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
If you skip this step, all your addon vehicles names will be saved as **"NULL"**.
{% endhint %}

## Import Panel

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FPHV4yMXWXE4b9JWHuORy%2Fimage.png?alt=media&#x26;token=81e18465-b5ca-42a2-a3f6-8e9a93935669" alt=""><figcaption></figcaption></figure>

* **Model Name:** Use this field to specify the exact vehicle model to import when adding new vehicles to your server.
* **Import All Vehicles:** Imports all vehicles from your server. This process may take a few minutes, depending on your PC's performance.

{% hint style="warning" %}
If you want to import your vehicles from your Framework set **Config.UseFrameworkVehicles = true** in `config/_config.lua` / This option **only works with QBCore and Qbox**.
{% endhint %}

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FjgQOr8TfueaABKjUCa8N%2Fimage.png?alt=media&#x26;token=9ca76391-8575-4be6-8eee-c28a144511f8" alt=""><figcaption><p>Process starting..</p></figcaption></figure>

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FROUYbWiDTlV6pjHRRjuG%2Fimage.png?alt=media&#x26;token=7b1ad9a7-1271-4d57-8788-39ae8fc52799" alt=""><figcaption><p>Process ended.</p></figcaption></figure>

## Missing Assets

```lua
"[ERROR] "..vehmodel.." asset couldn't be loaded, is either corrupted or it doesn't exist in qb/shared/vehicles.lua"
```

> **This print can mean the following:**
>
> * You have some addon vehicles folder where one of the **vehicles.meta** file have registered vehicles that does **NOT exist in your server**, meaning the **.yft files are missing**.
> * If importing a single vehicle, you entered one that does not exist in your server files.
>
> **Solution:**
>
> * You can either ignore the warning and continue, or edit your `vehicles.meta` file to find and remove the missing vehicle entry.

## Custom Imports

{% hint style="info" %}
This import functions can be found in **client/editable/\_framework.lua**
{% endhint %}

> The following functions allow you to import vehicle lists from any external script or database table:

#### getFrameworkVehicles()

> This function retrieves all vehicles from your Framework. To import from a custom script or database, you must generate and return a table where each vehicle adheres to the following structure:
>
> * **model:**`hash` The vehicle model hash
> * **name:**`string` Vehicle model name
> * **class?:**`string` Vehicle class
> * **brand?:**`string` Vehicle brand name
> * **category?:**`string` Vehicle category (suv, sports, super....)
> * **price?:**`number` Vehicle base price

#### getVehicleInfo()

> This function retrieves data for a single vehicle from the Framework. For custom integrations, you must return a single table (not an array) matching the structure below:
>
> * **model:**`hash` The vehicle model hash
> * **name:**`string` Vehicle model name
> * **class?:**`string` Vehicle class
> * **brand?:**`string` Vehicle brand name
> * **category?:**`string` Vehicle category (suv, sports, super....)
> * **price?:**`number` Vehicle base price
