# Server-side

{% hint style="warning" %}
IMPORTANT: This Exports work only above Version 2.5.0 of OP Garages Script&#x20;
{% endhint %}

## addTempPrivateGarage

***

```lua
exports['op-garages']:addTempPrivateGarage(Label, Type, Coords, Radius, PrivatePlayersList)
```

* Label: `string`
* Type: `car | air | sea`
* Coords: `table`
  * CenterOfZone: `vec4`
  * AccessPoint: `vec4` (Only whe Type: sea | air)
* Radius: `number`
* PrivatePlayersList: `object`
  * id: `string` (Player CitizenID or Char)
  * name: `string`(Player Name and Lastname, you can leave it "")

This export return created garage id.

## Example Usage:

```lua
local Coords = {
    CenterOfZone = vec4(-1796.2642, 398.0186, 110.9659, 161.2089),
    AccessPoint = vec4(0.0, 0.0, 0.0, 0.0) -- Leave 0.0 if it's 'car' garage.
}
local PrivatePlayersList = {
    {
        id = "char1:7e0ec7b80d186fd8c29f6631e4377e75812fe8fd",
        name = ""
    }
}
local garageId = exports['op-garages']:addTempPrivateGarage("Bagieta Garage", "car", Coords, 15, PrivatePlayersList)
```

## removeTempPrivateGarage

***

* Index: `number`

## Example Usage:

```lua
exports['op-garages']:removeTempPrivateGarage(garageId)
```

## addTempGangGarage

***

```lua
exports['op-garages']:addTempGangGarage(Label, Type, Coords, Radius, GangName, GangGrade, Mode, zPoints, onespawn)
```

* Label: `string`
* Type: `car | air | sea`
* Coords: `table`
  * CenterOfZone: `vec4`
  * AccessPoint: `vec4` (Only whe Type: sea | air)
* Radius: `number`
* GangName: `string`
* GangGrade: `number`
* Mode: `string: owned | spawner`
* zPoints: `table | nil`
* onespawn: `vec4 | nil`

This export return created garage id.

## Example Usage:

```lua
local Coords = {
    CenterOfZone = vec4(-1796.2642, 398.0186, 110.9659, 161.2089),
    AccessPoint = vec4(0.0, 0.0, 0.0, 0.0) -- Leave 0.0 if it's 'car' garage.
}

local zPoints = {
    minZ = 15.0,
    maxZ = 25.0
}
-- You can leave zPoints nil or false if you don't want to use it!

local garageId = exports['op-garages']:addTempGangGarage("Ballas Garage", "car", Coords, 15, "ballas", 0, "owned", zPoints, nil)
```

## removeTempGangGarage

***

* Index: `number`

## Example Usage:

```lua
exports['op-garages']:removeTempGangGarage(garageId)
```

## getAllGarages

***

Get List of all Available garages.

## Example Returned Data:

```json
"35": {
    "onespawn": {
        "x": -35.35721588134765,
        "y": -1456.6011962890626,
        "z": 30.27030754089355,
        "w": 109.94937133789063
    },
    "Type": "car",
    "Index": 35,
    "AccessPoint": {
        "x": 0.0,
        "y": 0.0,
        "z": 0.0,
        "w": 0.0
    },
    "zPoints": {
        "minZ": 0,
        "maxZ": 0
    },
    "PrivatePlayersList": [],
    "Gang": {
        "name": "ballas",
        "grade": 0,
        "type": "owned"
    },
    "Job": {
        "name": "police",
        "grade": 0,
        "type": "owned"
    },
    "Radius": "20",
    "IsPrivate": false,
    "blipDisabled": false,
    "Label": "Test Garage",
    "CenterOfZone": {
        "x": -35.35721588134765,
        "y": -1456.6011962890626,
        "z": 30.27030754089355,
        "w": 109.94937133789063
    }
}
```

## getGarageByIndex

***

Get garage data by index

## Example Usage:

```lua
exports['op-garages']:getGarageByIndex("35")
```

## Example returned Data:

```json
"35": {
    "onespawn": {
        "x": -35.35721588134765,
        "y": -1456.6011962890626,
        "z": 30.27030754089355,
        "w": 109.94937133789063
    },
    "Type": "car",
    "Index": 35,
    "AccessPoint": {
        "x": 0.0,
        "y": 0.0,
        "z": 0.0,
        "w": 0.0
    },
    "zPoints": {
        "minZ": 0,
        "maxZ": 0
    },
    "PrivatePlayersList": [],
    "Gang": {
        "name": "ballas",
        "grade": 0,
        "type": "owned"
    },
    "Job": {
        "name": "police",
        "grade": 0,
        "type": "owned"
    },
    "Radius": "20",
    "IsPrivate": false,
    "blipDisabled": false,
    "Label": "Test Garage",
    "CenterOfZone": {
        "x": -35.35721588134765,
        "y": -1456.6011962890626,
        "z": 30.27030754089355,
        "w": 109.94937133789063
    }
}
```

## getAllImpounds

***

Get List of all Available Impounds.

## Example Returned Data:

```json
"1": {
    "blipDisabled": 0,
    "Index": 1,
    "Type": "car",
    "Label": "LS Police",
    "Coords": {
        "x": 403.6280212402344,
        "y": -1624.9676513671876,
        "z": 28.29195404052734,
        "w": 190.83750915527345
    },
    "AllowedJobs": [
        "mechanic"
    ]
}
```

## getImpoundByIndex

***

Get Impound data by index

## Example Usage:

```lua
exports['op-garages']:getImpoundByIndex("1")
```

## Example returned Data:

```json
"1": {
    "blipDisabled": 0,
    "Index": 1,
    "Type": "car",
    "Label": "LS Police",
    "Coords": {
        "x": 403.6280212402344,
        "y": -1624.9676513671876,
        "z": 28.29195404052734,
        "w": 190.83750915527345
    },
    "AllowedJobs": [
        "mechanic"
    ]
}
```

## getVehiclesLabels

***

Get Vehicles Custom Labels added through Garage Admin

## Example returned Data:

```json
{
    "rebla": {
        "label": "Rebla GTS",
        "model": "rebla"
    }
}
```

## getVehicleLabelByModel

***

Get Vehicle Custom Label added through Garage Admin by Model

## Example Usage:

```lua
exports['op-garages']:getVehicleLabelByModel("rebla")
```

## Example returned Data:

```json
{
    "rebla": {
        "label": "Rebla GTS",
        "model": "rebla"
    }
}
```
