> For the complete documentation index, see [llms.txt](https://docs.vames-store.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vames-store.com/assets/vms_cityhall/guides/add-vin-generation.md).

# Add VIN Generation

To enable the automatic generation of Vehicle Identification Numbers (VINs) for vehicles in your vehicleshop, some modifications to the vehicleshop system are required.

***

## ESX Vehicleshop

### Modified esx\_vehicleshop

{% file src="/files/d6PKbgAyIBMlJPm4prXe" %}

### List of modifications in esx\_vehicleshop

<figure><img src="/files/z0s3jzUNdDME6knV7d2p" alt=""><figcaption><p>esx_vehicleshop/server/server.lua - <code>esx_vehicleshop:setVehicleOwnedPlayerId</code></p></figcaption></figure>

<figure><img src="/files/39eXubbm4uv8kBQ9w8bD" alt=""><figcaption><p>esx_vehicleshop/server/server.lua - <code>esx_vehicleshop:buyVehicle</code></p></figcaption></figure>

***

## QB Vehicleshop

### Modified qb-vehicleshop

{% file src="/files/WNxfxoEzrLSHdXKSfZ86" %}

### List of modifications in qb-vehicleshop

<figure><img src="/files/XSqSzfiBt8OyA1Xgnubn" alt=""><figcaption><p>qb-vehicleshop/server.lua - <code>qb-vehicleshop:server:buyShowroomVehicle</code></p></figcaption></figure>

<figure><img src="/files/v3KtnUX0yh9sE3u61iDa" alt=""><figcaption><p>qb-vehicleshop/server.lua - <code>qb-vehicleshop:server:financeVehicle</code></p></figcaption></figure>

<figure><img src="/files/ZrX6ojwRoNWDgWIQHDPN" alt=""><figcaption><p>qb-vehicleshop/server.lua - <code>qb-vehicleshop:server:sellShowroomVehicle</code></p></figcaption></figure>

<figure><img src="/files/hMcoY52XjNKczFJwWAP3" alt=""><figcaption><p>qb-vehicleshop/server.lua - <code>qb-vehicleshop:server:sellfinanceVehicle</code></p></figcaption></figure>

***

## Custom Vehicleshop

{% hint style="warning" %}
If your vehicleshop does not have an open file that allows you to make changes to the parameters entered into the database when buying a vehicle, and you do not have any available function that is executed on the server side after the purchase, it means that you do not have the ability to enter the generation of the VIN number.

In this case, it is recommended to contact the author of your vehicleshop with a request to allow the introduction of a new parameter or an update that will introduce compatibility.
{% endhint %}

If you have access to the file where the sql execute is located, make modifications based on esx\_vehicleshop or qb-vehicleshop.

However, if you do not have this option, but you have access to the function that is run after the purchase of the vehicle, you can enter an execute query that updates the VIN number for the vehicle, remember that you must have a reference to the database, for example, the license plate parameter

<details>

<summary>Custom locked vehicleshop</summary>

**Remember that this function must be after server-side.**

```lua
function YOUR_EXAMPLE_FUNCTION(plate)
    local vin = exports['vms_cityhall']:GenerateVIN()
    MySQL.Async.execute('UPDATE owned_vehicles SET vin = @vin WHERE plate = @plate', {
        ['@vin'] = vin,
        ['@plate'] = plate
    })
end
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.vames-store.com/assets/vms_cityhall/guides/add-vin-generation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
