# qb-garages

`qb-garages` stores and retrieves owned vehicles through public, house, gang, job and depot garage
flows. The official resource also coordinates vehicle state, damage/fuel restoration and impound
behavior.

It does not ship a separate player-purchasable “garage ownership” economy. Do not add
`garage_ownership` tables or purchase APIs unless your chosen fork explicitly implements them.

## Current global config

The current upstream `config.lua` includes:

```lua
Config.AutoRespawn = true
Config.VisuallyDamageCars = true
Config.SharedGarages = false
Config.ClassSystem = false
Config.FuelResource = 'LegacyFuel'
Config.Warp = true
```

These flags control behavior such as restart recovery, visual damage, shared job/gang access,
class restrictions, fuel integration and spawn behavior.

Pin your local config to the resource revision you deploy because defaults can change.

## Vehicle classes

Current config groups GTA vehicle classes into categories such as:

- `car`
- `air`
- `sea`
- `rig`
- `all`

Garage entries reference the allowed category/classes. Use the current upstream mapping rather than
inventing custom `vehicleCategories` keys from a different garage fork.

## Garage entries

The current config shape includes fields such as:

```lua
Config.Garages = {
    motelgarage = {
        label = 'Motel Parking',
        takeVehicle = vector3(...),
        spawnPoint = {
            vector4(...)
        },
        showBlip = true,
        blipName = 'Public Parking',
        blipNumber = 357,
        blipColor = 3,
        type = 'public',
        category = Config.VehicleClass['car']
    }
}
```

Use the exact current config file for real coordinates and available fields.

## Garage types

The official project documents these concepts:

### Public garages

Store and retrieve vehicles owned by the player under the public-garage rules.

### House garages

`qb-houses` can add a garage to a house. Current housing code broadcasts house-garage config to
qb-garages. Real-estate workflows can use `/addgarage` according to the upstream implementation.

### Job and gang garages

The resource supports job/gang garage access. `Config.SharedGarages` affects whether these garages
are shared or personal under the official implementation.

### Depot / impound

Depot garages retrieve vehicles sent to impound. Police workflows can set depot behavior through
qb-policejob.

## Database

The upstream repository ships `player_vehicles.sql` and uses the QBCore vehicle ownership/state
schema.

Do not copy unrelated tables such as `garage_ownership` into production because an old guide used
them. Apply only schema files/migrations shipped by the revision you deploy.

Back up `player_vehicles` before schema or garage-resource migrations.

## Fuel integration

Current upstream config defaults:

```lua
Config.FuelResource = 'LegacyFuel'
```

The comment expects a fuel resource with compatible `GetFuel()` and `SetFuel()` exports. If you
use another fuel resource, verify its API rather than only changing the string.

## House integration

Current qb-houses server code builds house garage information and sends it through qb-garages
client events. Keep both resources at compatible revisions if you rely on house garages.

See [qb-houses](/docs/resources/qb-houses).

## Troubleshooting

| Symptom | Check |
| --- | --- |
| Vehicle is not listed | Ownership record, citizen ID, garage/state columns and current garage rules. |
| Vehicle goes to depot after restart | `Config.AutoRespawn` and the stored vehicle state. |
| Job/gang vehicle inaccessible | Garage type plus job/gang and `Config.SharedGarages` behavior. |
| Vehicle spawns with wrong fuel | `Config.FuelResource` and compatible exports. |
| House garage missing | qb-houses ↔ qb-garages revision compatibility and house garage data. |
| Config example does not work | Make sure it came from the official repository, not a different `qb-garages` fork. |

If you replace qb-garages instead of configuring it, compare
[garage scripts on RPScripts](https://rpscripts.net/product-category/garage-scripts/) by declared QBCore
version, vehicle table schema and fuel/house integration. RPScripts and qbcore.net are operated by the same owner.

## Sources

- [qb-garages repository](https://github.com/qbcore-fivem/qb-garages)
- [Current config.lua](https://github.com/qbcore-fivem/qb-garages/blob/main/config.lua)
- [Official qb-garages documentation](https://github.com/qbcore-framework/qb-docs/blob/main/qbcore-resources/qb-garages.md)
- [qb-houses integration source](https://github.com/qbcore-fivem/qb-houses/blob/main/server.lua)

Verified against current upstream source on **2026-09-27**.
