> For the complete documentation index, see [llms.txt](https://zloma-scripts.gitbook.io/zloma-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zloma-scripts.gitbook.io/zloma-scripts/zloma_garages-paid/installation.md).

# Installation

## Requirements

| Resource    | Version | Link                                                 |
| ----------- | ------- | ---------------------------------------------------- |
| ox\_lib     | Latest  | [GitHub](https://github.com/overextended/ox_lib)     |
| oxmysql     | Latest  | [GitHub](https://github.com/overextended/oxmysql)    |
| zloma\_core | 1.0.0+  | [GitHub](https://github.com/ZlomaScripts/zloma_core) |

**Optional:**

| Resource      | Purpose                                 |
| ------------- | --------------------------------------- |
| zloma\_stance | Vehicle stance/fitment data persistence |

***

## Step 1 — Place the Resource

```
resources/
  [zloma]/
    zloma_core/
    zloma_garages/
```

***

## Step 2 — Database Setup

zloma\_garages uses an **automatic schema manager** — no manual SQL required.

On first start, it will:

* Create `zloma_garages`, `zloma_impounds`, `zloma_vehicle_grades`, `zloma_shared_access`, `zloma_vehicle_nicknames`, and `zloma_fake_plate_tracking` tables
* Add required columns to your framework's vehicle table (`owned_vehicles` for ESX, `player_vehicles` for QBCore/QBox)

{% hint style="info" %}
The schema manager only adds columns that don't already exist. It's safe to restart without worrying about duplicates.
{% endhint %}

### Columns Added to Vehicle Table

| Column                 | Type                     | Purpose                               |
| ---------------------- | ------------------------ | ------------------------------------- |
| `garage_id`            | INT                      | Which garage the vehicle is stored in |
| `vehicle_type`         | ENUM('car','air','boat') | Vehicle type classification           |
| `mileage`              | FLOAT                    | Tracked vehicle mileage               |
| `is_org_vehicle`       | TINYINT(1)               | Organization vehicle flag             |
| `org_name`             | VARCHAR(50)              | Organization name                     |
| `org_garage`           | VARCHAR(50)              | Organization garage name              |
| `last_used_by`         | VARCHAR(60)              | Last player who used the vehicle      |
| `original_owner`       | VARCHAR(60)              | Original owner (before org transfer)  |
| `impounded_org`        | TINYINT(1)               | Impounded from organization           |
| `last_location`        | JSON                     | Last known world position             |
| `pd_impounded`         | TINYINT(1)               | Police impound flag                   |
| `pd_impound_time`      | INT(11)                  | Police impound timestamp              |
| `pd_impound_duration`  | INT(11)                  | Impound duration (minutes)            |
| `pd_impound_base_fee`  | INT(11)                  | Base release fee                      |
| `pd_impound_early_fee` | INT(11)                  | Early release fee                     |
| `pd_impound_reason`    | VARCHAR(200)             | Impound reason text                   |
| `pd_impounded_by`      | VARCHAR(60)              | Impounding officer identifier         |
| `pd_impound_count`     | INT                      | Total times police impounded          |
| `impound_reason`       | VARCHAR(200)             | General impound reason                |
| `impound_time`         | TIMESTAMP                | General impound timestamp             |

***

## Step 3 — Server Config

Add to your `server.cfg` (order matters):

```cfg
ensure ox_lib
ensure oxmysql
ensure zloma_core
ensure zloma_garages
```

{% hint style="warning" %}
`zloma_core` must start **before** `zloma_garages`.
{% endhint %}

***

## Step 4 — Configure

Edit `config.lua` to match your server setup. See [Configuration](/zloma-scripts/zloma_garages-paid/configuration.md) for all options.

{% hint style="warning" %}
`Config.VehicleTracking.orphanRecovery` is enabled by default for first startup recovery.

After the first successful startup, you must change it back to `false`.

Do not leave `orphanRecovery` enabled after initial setup.
{% endhint %}

{% hint style="warning" %}
If you enable `Config.PersistentVehicles.enabled = true`, every external script that deletes owned vehicles should also load `@zloma_garages/zlDeleteHelper.lua` in its `shared_scripts` section.

Do this for garage cleanup scripts, impound scripts, parking scripts, and any resource that can delete player-owned vehicles.
{% endhint %}

Key things to set:

* `Config.PoliceJobs` — your police job names
* `Config.AdminGroups` — groups that can use `/zlomagarages`
* `Config.Language` — `'en'` or `'hr'`
* `Config.VehicleTracking.orphanRecovery` — leave enabled only for first startup, then set to `false`
* `Config.PersistentVehicles.enabled` — optional anti-cull session persistence for spawned garage vehicles

If you use persistent vehicles, add this to external resources that delete owned vehicles:

```lua
shared_scripts {
  '@ox_lib/init.lua',
  '@zloma_garages/zlDeleteHelper.lua'
}
```

***

## Step 5 — Customize (Optional)

Two files are open for customization:

| File                   | Side   | Purpose                                              |
| ---------------------- | ------ | ---------------------------------------------------- |
| `cl_customization.lua` | Client | Spawn hooks, repair logic, damage check              |
| `sv_customization.lua` | Server | Webhooks, access control, fee calculation, multi-job |

See [Customization](/zloma-scripts/zloma_garages-paid/customization.md) for details.

***

## Step 6 — Create Garages

1. Join your server as admin
2. Run `/zlomagarages` to open the admin panel
3. Click **Create New Garage** and follow the wizard
4. Set location, spawn points, ped/prop, type, and blip
5. Save — the garage is live immediately

***

## Vehicle Stored States

Understanding the `stored` column values:

| Value | State          | Description                            |
| ----- | -------------- | -------------------------------------- |
| `0`   | OUT            | Vehicle is spawned in the world        |
| `1`   | IN GARAGE      | Vehicle is stored in a garage          |
| `2`   | IMPOUNDED      | Vehicle is in personal impound         |
| `3`   | POLICE IMPOUND | Vehicle is police impounded            |
| `4`   | ON SALE        | Vehicle is listed for sale (protected) |

***

## Post-Install Reminder

Once the resource has started successfully for the first time and orphaned vehicles are recovered, go back to `config.lua` and set `Config.VehicleTracking.orphanRecovery = false`.

If you enabled `Config.PersistentVehicles.enabled`, also verify that every external resource which deletes owned vehicles includes `@zloma_garages/zlDeleteHelper.lua` in `shared_scripts`.


---

# 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:

```
GET https://zloma-scripts.gitbook.io/zloma-scripts/zloma_garages-paid/installation.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.
