# GARAGES

1. Creating new Garage (Example)

````lua
Config.Garage.Zones = {
    ['Mission_Row'] = {
        zoneType = 'box', -- box / poly (if poly you need to create points, https://overextended.dev/ox_lib/Modules/Zones/Shared)
        garageType = 'cars', -- cars / planes / boats
        coords = vector3(437.02, -1022.42, 28.66), -- coords of box
        size = vector3(15.2, 25, 10), -- size of box
        rotation = 7.0, -- rotation
        jobs = {['police'] = 0}, -- which job and from which grade
        canInteract = function() -- you can add this if you want to check anything other than job
           if ESX.PlayerData.org == 'org1' then
              return true
           end
           return false
        end,
        spawns = {
            vector4(445.9929, -1026.2607, 28.6509, 189.3484), -- spawn point vec4
        },
        blip = {sprite = 473, display = 2, color = 38, scale = 0.75, name = 'Garage'}
    },
}
```
````

2. Generate VIN

If you dont have VIN on your server, there is export to generate it. Use this in your vehicle shop.

{% tabs %}
{% tab title="Server Side" %}
```lua
exports['piotreq_phone']:GenerateVIN()

-- USAGE EXAMPLE
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, plate, vehicle, stored, vin) VALUES (@owner, @plate, @vehicle, @stored, @vin)',
  {
      ['@owner'] = xPlayer.identifier,
      ['@plate'] = props.plate,
      ['@vehicle'] = json.encode(props),
      ['@stored'] = 0,
      ['@vin'] = exports['piotreq_phone']:GenerateVIN(),
  }, function(rowsChanged)
    cb('ok')
end)
```
{% endtab %}
{% endtabs %}

3. You can check if vehicle with vin already exist

{% tabs %}
{% tab title="Second Tab" %}
* vin `string`

<pre class="language-lua"><code class="lang-lua"><strong>exports['piotreq_phone']:VinExist(vin) -- return true | false
</strong></code></pre>
{% endtab %}
{% endtabs %}

4. **(NEW) You can set second owner of vehicle**

{% tabs %}
{% tab title="Server Side" %}
* plate `string`
* identifier `string`

```lua
exports['piotreq_phone']:SetSecondOwner(plate, identifier) -- true | false
```
{% endtab %}
{% endtabs %}

5. **(NEW) You can check if vehicle has second owner**

{% tabs %}
{% tab title="Server Side" %}
* plate `string`

```lua
exports['piotreq_phone']:hasSecondOwner(plate) -- identifier | false
```
{% endtab %}
{% endtabs %}
