Commands#
Trucker Job registers no chat or console commands. Everything a driver does starts at the dispatcher and is played with a few keys, and everything another script needs is an export or an event further down this page.
Key | Where | What it does |
|---|---|---|
| Beside the dispatcher | Opens the job panel. With |
| The job panel | Closes it, or steps back out of the shop, the statistics or the guide. |
| At a pile of boxes, on foot | Opens the loading view on a hand-loaded run — at a dock to load, at the drop-off to unload. |
Mouse | The loading view | Point at a box, hold the left button to pick it up, release over the marker to drop it. |
| The loading view | Leaves it. |
| The drop-off · the bay · the depot | Delivers the trailer, drops the emptied trailer off, hands the truck back and gets paid. |
The interact key is Config.Keys.InteractKey — control 38, E by default. Any id from the FiveM controls list works.
Client Exports#
For opening the panel from your own scripts — an NPC manager, a radial menu, a phone app, a job centre.
Opening the job panel
-- client
exports['qs-truckjob']:openTruckerMenu()
-- server
TriggerClientEvent('qs-truck:openTruckerMenu', source)The panel holds the contracts, the shop, the statistics and the guide, so this is the one way in — there is no separate entry point for the shop or the leaderboard. The close-up camera on the dispatcher is only used when the player is standing within 6 metres of them; from anywhere else the panel simply opens.
Server Exports#
How another resource asks about drivers — a job centre that refuses a second job during a run, a scoreboard that counts truckers, a jail script that takes a driver off the road.
IsPlayerOnMission — is this player on a run?
local onRun = exports['qs-truckjob']:IsPlayerOnMission(source) -- true / falseRead from the server's own record of the run, so no client can talk it either way. isPlayerOnRoute(source) answers the same question and is kept for scripts that already call it.
IsRouteIllegal — is this player on a stolen-cargo run?
local illegal = exports['qs-truckjob']:IsRouteIllegal(source) -- true / falseTrue while the player is on a run that took the stolen-cargo offer. Read from the server's own record, like IsPlayerOnMission. Useful for a script that follows the server events and has to rebuild what it knows after its own resource restarts.
cancelRoute — end a player's run
local ended = exports['qs-truckjob']:cancelRoute(source)
-- true if the player had a run, false if they did notThe run is dropped without pay, and the player's client clears everything away: the truck, the trailer, any boxes, the blips, the tracker and the outfit. The right call for a jail, a hospital or an admin tool. On a stolen-cargo run it also fires qs-truck:illegalEnded with the reason cancelled.
getOnDutyCount · isPlayerOnDuty — drivers on duty
local count = exports['qs-truckjob']:getOnDutyCount() -- drivers working right now
local onDuty = exports['qs-truckjob']:isPlayerOnDuty(source) -- true / falseA headcount for scoreboards such as qs-scoreboard. A driver goes on duty when a run starts and off when it ends. The flag is reported by the player's own client and nothing in the job pays out from it — whenever the answer matters, use IsPlayerOnMission.
Server Events#
Four server events let your own resources follow a stolen-cargo run: a gang script that hands out a key when the offer is taken, a police script that opens a case when the trailer is handed over, a log of who ran what. Each one passes the driver's server id and a table of details.
Event | Fires when | Extra fields |
|---|---|---|
| The driver takes the stolen-cargo offer. | — |
| The driver turns the offer down. | — |
| The trailer is handed over at the drop-off. |
|
| The run closes, whichever way. Always the last event. |
|
Every event also carries identifier (the driver's identifier on ESX, citizenid on QBCore and Qbox), route (the contract's name), payment, experience and delivery (the drop-off, as x, y, z, w).
Field | Means |
|---|---|
| The police were alerted at the hand-over. A busted run pays no money and no experience, so |
|
|
| True only when the black money actually reached the driver. |
-- server side, in your own resource
AddEventHandler('qs-truck:illegalAccepted', function(src, data)
print(src, 'took a stolen-cargo run:', data.route, data.payment)
end)
AddEventHandler('qs-truck:illegalEnded', function(src, data)
if data.reason == 'finished' and data.paid then
-- delivered, and the black money arrived
end
end)illegalEnded fires after the payout, so anything you hand out there cannot take the room the black money needed. On dropped the player's inventory may already be unloaded, and a crash or a server restart fires nothing at all, so anything you give out on illegalAccepted should also be cleaned up the next time the player logs in. The same list is written up in config/config.lua, right under Config.DispatchExport.
Hooks in the Config#
Four values in config/config.lua are there for you to point at your own resources:
Hook | Runs | Use it for |
|---|---|---|
| On the driver's client, when a stolen-cargo run is reported. | Alerting the police through your dispatch script. |
| On the client, for every message, when | Your own notification resource. |
| On both sides, wherever money is written out. | How amounts look. Reads |
| On the client, when the truck spawns, if | Your fuel script's exports — anything with |
Examples for each are in Integrations.
About the Errors#
Every server answer that can refuse returns a translation key rather than a sentence — NOTIFY_NOT_ENOUGH_LEVEL, NOTIFY_TRAILER_NOT_AT_BAY, NOTIFY_CARGO_WRONG_DOCK — so the same refusal reads in the server's own language. Common Errors lists them with what each one means.



