# QB-Garages

{% hint style="info" %}
File: gp\_visum/configs/config.lua

Replace the addVehicleToOwner function in line 239
{% endhint %}

{% code title="gp\_visum/configs/config.lua" lineNumbers="true" %}

```lua
-- (Server)
-- Simple function to add the visum vehicle to a player
Config.addVehicleToOwner = function(src, plate, visumVehicleData)
    local player = QBCore.Functions.GetPlayer(src)
    MySQL.Async.execute('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, garage, state) VALUES (@license, @citizenid, @vehicle, @hash, @mods, @plate, @garage, @state)',
    {
        ['@license'] = player.PlayerData.license,
        ['@citizenid'] = player.PlayerData.citizenid,
        ['@vehicle'] = visumVehicleData.vehicleModel,
        ['@hash'] = GetHashKey(visumVehicleData.vehicleModel),
        ['@mods'] = json.encode({model = GetHashKey(visumVehicleData.vehicleModel), plate = plate}),
        ['@plate'] = plate,
        ['@garage'] = "pillboxgarage",
        ['@state'] = "0",
    }, function(rowsChanged)
        Config.debug("Added vehicle to player " .. visum.getPlayerName(src) .. " with plate " .. plate)
        -- Add key to the user with the given plate and source
        Config.addVehicleKeys(src, plate, visumVehicleData.vehicleName)
    end)
end
```

{% endcode %}


---

# 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.gpscripts.dev/visumsystem/code-snippets/qb-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.
