# qb-mechanicjob: repairs, tuning and vehicle wear

`qb-mechanicjob` offers mechanic job locations and configurable vehicle painting, tuning, nitrous, repairs, distance and component wear. This guide reflects [upstream commit 9dded68](https://github.com/qbcore-fivem/qb-mechanicjob/tree/9dded685057f3516f4904628a208fee24d92f105). It is **not** a separate paid-service-order, towing dispatch and invoice management system.

## Installation and required integrations

The [manifest](https://github.com/qbcore-fivem/qb-mechanicjob/blob/9dded685057f3516f4904628a208fee24d92f105/fxmanifest.lua) loads `config/*.lua`, `client/*.lua`, `server/main.lua`, NUI assets and vehicle modification meta files, plus `oxmysql`. Ensure `qb-core`, the installed `qb-inventory`, vehicle definitions and fuel provider are compatible.

1. Deploy the complete resource and set up jobs/grades in QBCore shared jobs.
2. Keep custom `Config.Shops` settings, relevant shared items and shop vehicle lists.
3. Check `Config.FuelResource` points to the **actual compatible client fuel export**.
4. Test the job's duty, repairs, nitrous, painting and inventory deduction on a disposable test server.

The upstream repository tree contains **no** standalone mechanic billing SQL schema. Previously documented `mechanic_orders`, `mechanic_parts` and `mechanic_invoices` tables do not belong to this implementation.

## Configuration layout

The current [`config/config.lua`](https://github.com/qbcore-fivem/qb-mechanicjob/blob/9dded685057f3516f4904628a208fee24d92f105/config/config.lua) uses:

| Setting | Purpose |
| --- | --- |
| `Config.RequireJob` | Whether parts require a mechanic job |
| `Config.FuelResource` | Fuel export resource name (default `LegacyFuel`) |
| `Config.PaintTime` | Painting duration in seconds |
| `Config.NitrousBoost` / `NitrousUsage` | Nitrous behavior |
| `Config.UseDistance` / `UseDistanceDamage` | Vehicle distance tracking/damage |
| `Config.UseWearableParts` / `WearableParts` | Components and required repair items |
| `Config.DamageThreshold` / `WarningThreshold` | Component status boundaries |
| `Config.MinimalMetersForDamage` | Distance/damage ranges |
| `Config.Shops` | Real mechanic work locations, duties, stashes and vehicles |

~~~lua filename="config/config.lua"
-- Modify existing source configuration:
Config.RequireJob = true
Config.FuelResource = 'LegacyFuel'
Config.UseWearableParts = true
Config.UseDistance = true
~~~

The reviewed config does not define root `Config.ModificationCosts`, `Config.RepairCost` or a generic `Config.TowSpawns`. Shop positions and vehicles are nested under `Config.Shops`.

## Client events and server callbacks

[`client/repair.lua`](https://github.com/qbcore-fivem/qb-mechanicjob/blob/9dded685057f3516f4904628a208fee24d92f105/client/repair.lua) registers actual events such as `qb-mechanicjob:client:PartsMenu`, `repairVehicle`, `repairVehicleFull`, `repairTire` and `cleanVehicle`.

The [server](https://github.com/qbcore-fivem/qb-mechanicjob/blob/9dded685057f3516f4904628a208fee24d92f105/server/main.lua) registers QBCore callbacks:

- `qb-mechanicjob:server:getVehicleStatus`
- `qb-mechanicjob:server:checkTune`
- `qb-mechanicjob:server:getnitrousVehicles`
- `qb-mechanicjob:server:hasPermission`

Internal server events include `qb-mechanicjob:server:repairVehicleComponent`, `updateVehicleComponents`, `updateDrivingDistance`, `SaveVehicleProps`, `syncNitrous`, `sprayVehicle` and `removeItem`.

**There are no public `qb-mechanicjob` exports for `RepairVehicle`, `ModifyVehicle` or `CreateServiceOrder` in the reviewed server.** Do not copy those from an unrelated mechanic fork. Inventory item use, valid vehicle ownership, nearby shop/work permissions and payment rules must be validated server-side before applying state changes.

## Troubleshooting

| Symptom | Check |
| --- | --- |
| Mechanic options missing | `Config.RequireJob`, active job and `Config.Shops` |
| Parts menu opens but repair fails | Shared item names, inventory quantity and server callback |
| Nitrous no longer syncs | `syncNitrous` server event and vehicle/network ownership |
| Wear resets after reboot | Distance/component state persistence and vehicle plate |
| Fuel changes fail after an update | `Config.FuelResource` and client fuel exports |
| `No such export RepairVehicle` | This upstream source registers a client event, not that export |

## Update checklist

1. Record deployed mechanic, inventory, core, fuel and garage versions.
2. Preserve existing `Config.Shops` and wearable-parts modifications.
3. Test a mechanic and non-mechanic player using repair/tuning requests.
4. Test unauthorized/replayed requests and persistence across reconnect before production.

## Sources

[Repository](https://github.com/qbcore-fivem/qb-mechanicjob/tree/9dded685057f3516f4904628a208fee24d92f105) · [Configuration](https://github.com/qbcore-fivem/qb-mechanicjob/blob/9dded685057f3516f4904628a208fee24d92f105/config/config.lua) · [Server callbacks/events](https://github.com/qbcore-fivem/qb-mechanicjob/blob/9dded685057f3516f4904628a208fee24d92f105/server/main.lua) · [Client repair](https://github.com/qbcore-fivem/qb-mechanicjob/blob/9dded685057f3516f4904628a208fee24d92f105/client/repair.lua)
