qb-busjob
qb-busjob is a small, self-contained job. A player with the bus job takes a bus, drives to
scripted stops, and NPCs board and pay. There is no shift state, no deposit, and no database table.
Compare with qb-taxijob, which has a meter and per-fare pricing, and qb-truckerjob, which runs delivery missions.
The manifest at the commit linked above declares version 1.2.0.
Dependencies and start order
From the manifest: @qb-core/shared/locale.lua plus locales as shared scripts, and the PolyZone
client files client.lua, BoxZone.lua, EntityZone.lua, CircleZone.lua, ComboZone.lua.
Start order: qb-core, PolyZone, then qb-busjob. The server script uses
exports['qb-core']:GetPlayer and Player.AddMoney, so qb-core is required even though the
manifest does not declare it.
Configuration
config.lua is loaded as a shared script.
| Key | Meaning |
|---|---|
Config.AllowedVehicles | Bus models the job accepts |
Config.Location | vector4(462.22, -641.15, 28.45, 175.0), the depot |
Config.NPCLocations | The route stops, under a Locations sub-table |
Config.NpcSkins | Ped models used for passengers |
There is no configurable pay value. The payout is hardcoded in server/main.lua.
Payout
One server event does all the work.
RegisterNetEvent('qb-busjob:server:NpcPay', function()It takes no arguments, which is the point: nothing about the payment is supplied by the client. On the server it:
- Resolves the player from
source. - Requires
Player.PlayerData.job.name == 'bus', otherwiseDropPlayer. - Enforces a 10 second per-source cooldown, otherwise
DropPlayer. - Requires the player’s server-side coordinates to be within 20 units of a configured stop,
otherwise
DropPlayer. - Pays
math.random(15, 25)cash, with a bonus ofmath.random(10, 20)on a random roll.
A playerDropped handler clears the cooldown entry so the table does not grow.
This is a good template for a job payout event. The amount is decided on the server, the position is read on the server, and there is a rate limit. Contrast with qb-hotdogjob, where the price arrives from the client.
The bonus roll is math.random(1, 5) compared against two other math.random(1, 5) draws, so the
bonus fires more often than a single one-in-five chance. Adjust in server/main.lua if you want a
predictable rate.
Setup
- Add a
busjob to your shared jobs list. - Make sure every model in
Config.AllowedVehiclesandConfig.NpcSkinsis streamable. - Set the depot and route coordinates for your map.
- Start
qb-coreandPolyZonebefore this resource.
Troubleshooting
| Symptom | Likely cause |
|---|---|
| Player is dropped on every pickup | The job name is not exactly bus, or the stop coordinates in Config.NPCLocations.Locations are more than 20 units from where the player actually stops |
| Passengers never spawn | A ped model in Config.NpcSkins failed to load |
| No payment, no drop | The 10 second cooldown is still active from the previous stop |
| Zones never trigger | PolyZone is not started before this resource |
Proposed manual smoke test
Not yet executed. On staging:
- Take the job, confirm payment on a normal stop.
- Trigger two stops inside 10 seconds and confirm the drop.
- Take a bus without the
busjob and confirm the drop. - Disconnect mid route and reconnect, confirm the cooldown table cleared.