# qb-truckerjob

`qb-truckerjob` rents delivery vehicles, selects stores supplied by `qb-shops`, and pays a
trucker salary. This guide reviews the pinned source, not an in-game acceptance result.
The official GitBook guide describes older `Config.BailPrice`, `Config.Vehicles` and
`Config.Locations` keys; this commit uses the `TruckerJob*` keys below.

## Installation and dependencies

Place the upstream repository in a folder named `qb-truckerjob`. It imports QBCore locale
support and PolyZone files. The client also calls `qb-menu`, the `LegacyFuel` export,
vehicle-key events and the shops restock/list events. The server reward path uses the
`AddItem` player method supplied by `qb-inventory` or a compatible inventory provider. `qb-target` is used when `UseTarget`
is enabled. These integrations must match your installed commits; the manifest does not
list all of them as formal dependencies. No standalone SQL schema is shipped here.

```cfg
ensure qb-core
ensure PolyZone
ensure qb-menu
ensure qb-inventory
ensure qb-shops
ensure qb-truckerjob
```

Start your fuel and vehicle-key providers first as well. With target interactions, start
`qb-target` and set the shared `UseTarget` convar before starting this resource.
Use the [Config Validator](/tools/config-validator) to check the actual server.cfg.

## Verified configuration

Modify the existing `config.lua`, keeping its location and vehicle tables intact:

```lua
Config.TruckerJobTruckDeposit = 125
Config.TruckerJobMaxDrops = 20
Config.TruckerJobDropPrice = 500
Config.TruckerJobBonus = 20
Config.TruckerJobPaymentTax = 15
```

The deposit checks cash first, then bank. A recorded deposit is refunded to cash.
The salary handler caps the requested drop count at `TruckerJobMaxDrops`, adds the configured
percentage bonus from five drops onward, applies the configured tax and credits bank money.
This describes the implementation, not an expected earnings guarantee.

`Config.TruckerJobVehicles` entries use `label`, optional `jobrep`, `cargodoors` and `trunkpos`.
Cargo-door entries use zero-based keys in the shipped examples. Match the model's actual door
indices and stand within `trunkpos` of the rear interaction point. Store names and coordinates
arrive through `qb-truckerjob:client:SetShopList`, which sets `TruckerJobLocations["stores"]`.
A missing shop list can prevent route selection; do not invent store data for another shops fork.

## Exports and events

This commit declares no resource exports or QBCore callbacks. Its server network handlers are:

| Handler | Purpose and boundary |
| --- | --- |
| `qb-trucker:server:DoBail` | Takes/refunds the recorded deposit; requests vehicle spawn |
| `qb-trucker:server:01101110` | Pays bank salary from the supplied drop count after a trucker-job check |
| `qb-trucker:server:nano` | Random cryptostick reward using the legacy player item method |

Client handlers include `qb-trucker:client:SpawnVehicle`, `qb-trucker:client:TakeOutVehicle`,
`qb-truckerjob:client:Vehicle`, `qb-truckerjob:client:PaySlip` and the shop-list handler above.
These are implementation hooks, not trusted payment APIs for other resources.

## Server authority and troubleshooting

The salary handler limits a numeric count but does not establish a server-owned delivery
ledger or consume a completion token. A job check and count cap do not prevent repeated
payout requests. The reward handler lacks equivalent route/job authority, and the deposit
handler does not independently validate a completed vehicle return. Harden those boundaries
in your installed server implementation before exposing rewards to real players.

- **No stores/route:** verify `qb-shops:server:SetShopList` and the receiving shop-list event
  exist in your shops commit and the returned list has names and coordinates.
- **Cargo cannot be unloaded:** inspect `cargodoors`, vehicle model, rear position and open doors.
- **No vehicle menu/fuel/keys:** check the exact `qb-menu`, `LegacyFuel` and vehicle-key providers.
- **Item reward errors:** compare the legacy `AddItem` and `inventory:client:ItemBox` usage with
  your [Inventory API](/docs/resources/qb-inventory); event namespaces vary by generation.
- **No payslip:** confirm job name `trucker`, a completed route and the server handler's bank result.

## Update checklist

On an isolated server, test cash/bank deposit selection, insufficient funds, cancellation,
vehicle return, five-drop bonus, maximum drops, resource restart, disconnect, inventory-full
rewards and duplicate payout attempts. Record resource commits and before/after balances.
Static parsing and mocks do not establish FXServer/MySQL acceptance.

## Sources

- [Pinned resource source](https://github.com/qbcore-fivem/qb-truckerjob/tree/f99446762ec7f081a900556209294cbfbfda9746)
- [Manifest](https://github.com/qbcore-fivem/qb-truckerjob/blob/f99446762ec7f081a900556209294cbfbfda9746/fxmanifest.lua)
- [Configuration](https://github.com/qbcore-fivem/qb-truckerjob/blob/f99446762ec7f081a900556209294cbfbfda9746/config.lua)
- [Official documentation repository](https://github.com/qbcore-framework/qb-docs/tree/930c12ec4f60dfbba60253571f1a58980129516d/qbcore-resources)
- [Resource dependency checklist](/docs/migration/tools/compatibility-checker)
