# Vehicle Properties

## Introduction

With the release of [t1ger-tuning-system](https://docs.t1ger.net/resources/t1ger-tuning-system "mention"), we needed to introduce our own `vehicleprops.lua` with get and set methods to fully ensure vehicle mods being applied and saved correctly.&#x20;

{% hint style="success" %}
You can easily add your 3rd-party custom edits from your current vehicle properties into our `vehicleprops.lua`.
{% endhint %}

## Setup

This guide will help you setup vehicle properties inside your framework functions.

{% hint style="info" %}
Please note. If you have 3rd-party resources that calls vehicle properties but not using ESX/QB framework functions, then you need to manually replace these with our exports.&#x20;
{% endhint %}

<details>

<summary>ESX</summary>

1. Navigate to `es_extended/client/functions.lua`
2. Find this function:

{% code fullWidth="false" %}

```lua
function ESX.Game.GetVehicleProperties(vehicle)
```

{% endcode %}

3. Take a backup of the whole function (in-case you have some custom edits, you want to transfer).
4. Replace the whole function with this code:

<pre class="language-lua"><code class="lang-lua"><strong>function ESX.Game.GetVehicleProperties(vehicle)
</strong>    return exports['t1ger_lib']:GetVehicleProperties(vehicle)
end
</code></pre>

5. Now find this function:

```lua
function ESX.Game.SetVehicleProperties(vehicle, props)
```

6. As we did in 3., take a backup of the whole function.&#x20;
7. Replace the whole function with this code:

<pre class="language-lua"><code class="lang-lua"><strong>function ESX.Game.SetVehicleProperties(vehicle, props)
</strong>    exports['t1ger_lib']:SetVehicleProperties(vehicle, props)
end
</code></pre>

8. If done correct, it should look like this (please ensure):\
   ![screenshot from es\_extened/client/functions.lua showing the updated changes.](https://2167335559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiDWIMbFBeXle-trOlk%2Fuploads%2F3qsldQ4XtiPFlpGo89KP%2Fimage.png?alt=media\&token=4a288139-ad52-4cc2-8e9e-9265205490b2)
9. Restart the server and you are all set!

</details>

<details>

<summary>QB Core</summary>

1. Navigate to `qb-core/client/functions.lua`
2. Find this function:

{% code fullWidth="false" %}

```lua
function QBCore.Functions.GetVehicleProperties(vehicle)
```

{% endcode %}

3. Take a backup of the whole function (in-case you have some custom edits, you want to transfer).
4. Replace the whole function with this code:

<pre class="language-lua"><code class="lang-lua"><strong>function QBCore.Functions.GetVehicleProperties(vehicle)
</strong>    return exports['t1ger_lib']:GetVehicleProperties(vehicle)
end
</code></pre>

5. Now find this function:

```lua
function QBCore.Functions.SetVehicleProperties(vehicle, props)
```

6. As we did in 3., take a backup of the whole function.&#x20;
7. Replace the whole function with this code:

<pre class="language-lua"><code class="lang-lua"><strong>function QBCore.Functions.SetVehicleProperties(vehicle, props)
</strong>    exports['t1ger_lib']:SetVehicleProperties(vehicle, props)
end
</code></pre>

8. If done correct, it should look like this (please ensure):\
   ![screenshot from qb-core/client/functions.lua showing the updated changes.](https://2167335559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MiDWIMbFBeXle-trOlk%2Fuploads%2FwTPbPBsmB7Bin5rijoLH%2Fimage.png?alt=media\&token=e5cac4a4-8700-44a6-bb48-d0f84a4de77a)
9. Restart the server and you are all set!

</details>

## Functions

The `GetVehicleProperties()` and `SetVehicleProperties()` functions can be found and altered inside `t1ger_lib/vehicleprops.lua`

### GetVehicleProperties

```lua
exports['t1ger_lib']:GetVehicleProperties(vehicle)
-- returns the given vehicle's properties
```

**Parameters:**

* vehicle: entity(vehicle)

### SetVehicleProperties

```lua
exports['t1ger_lib']:SetVehicleProperties(vehicle, props)
-- sets the given vehicle's properties
```

**Parameters:**

* vehicle: entity(vehicle)
* props: table(props)
