# qb-taxijob

`qb-taxijob` provides vehicle rental, taxi duty, a NUI meter and NPC fares. This reference
follows the pinned implementation. The GitBook guide contains older meter and boss-menu
examples; compare your `config.lua` before copying them. No runtime test is claimed here.

## Installation and dependencies

Keep the folder name `qb-taxijob`. The manifest imports QBCore locale support and PolyZone
client files and serves `html/meter.html`. The client calls `qb-menu`, `LegacyFuel`, vehicle
key events and QBCore's vehicle-spawn callback. Target mode additionally uses `qb-target`.
The server uses `qb-inventory` for the optional reward and `qb-banking` for management payouts.
There is no standalone taxi SQL file to import.

```cfg
ensure qb-core
ensure PolyZone
ensure qb-menu
ensure qb-inventory
ensure qb-taxijob
```

Start the matching fuel/key providers first. If `Config.Management` is true, start banking
first and verify the `taxi` account integration. With target mode, start `qb-target` before taxi.

## Configuration examples

Edit the existing table after its initial declaration; preserve the NPC locations and zones:

```lua
Config.jobRequired = 'taxi'
Config.Management = false
Config.Meter.defaultPrice = 125.0
Config.Meter.startingPrice = 0
Config.Advanced.Bonus.Enabled = true
Config.Advanced.Bonus.Percentage = 10
```

`Config.Meter` controls the displayed distance fare. The NPC server payout does **not** trust
the submitted meter fare: it computes a random base payment itself. Do not promise that
changing `defaultPrice` will change NPC salary. Management routes the payment through
`qb-banking:AddMoney('taxi', ...)`; otherwise it credits the player's cash.

`Config.Rewards` names the inventory reward item. Ensure it exists in your shared items and
inventory provider. The configured health/crash settings control the client mission flow.
`NPCLocations` and `PZLocations` define pickup/drop positions; update both relevant representations
when moving a route. `Config.UseTarget` reads the `UseTarget` convar when the config loads.

## Public integration surface

This resource declares no exports or QBCore callbacks in the reviewed files. Client handlers
include `qb-taxi:client:TakeVehicle`, `qb-taxi:client:DoTaxiNpc`,
`qb-taxi:client:CancelTaxiNpc`, `qb-taxi:client:toggleMeter`, `qb-taxi:client:enableMeter`
and `qb-taxijob:client:requestcab`. Preserve those exact namespaces when integrating an existing
radial menu or phone; `qb-taxi` and `qb-taxijob` are not interchangeable prefixes.

The server registers `qb-taxi:server:NpcPay`. It checks the player's configured job and proximity
within 20 units of a configured dropoff, computes a payout and may grant the configured item.
It does not record a server-owned active passenger or a consumed trip completion. Do not expose
this handler as an API for arbitrary client rewards; proximity and a job alone do not prevent replay.

## Troubleshooting

- **No taxi menu:** check the exact job name, duty state, `qb-menu`, vehicle list and open spawn points.
- **Missing fuel or keys:** verify the `LegacyFuel` alias and `vehiclekeys:client:SetOwner` integration.
- **Meter mismatch:** distinguish the client display from the server's NPC payment calculation.
- **Management receives no funds:** verify the banking resource and job account, not an invented boss-menu export.
- **Reward fails:** verify `Config.Rewards` in shared items and the inventory `AddItem` result.
- **Interaction misses the destination:** compare `NPCLocations` and target/PolyZone coordinates.

## Update checklist

Test passenger pickup/drop, duty changes, full inventory, occupied spawn points, damaged vehicle,
crash cancellation, management and player payouts, missing players, reconnect/restart and
repeated payout requests. Inspect server balances and logs on an isolated FXServer/database.
This static review cannot establish those runtime outcomes.

## Sources

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