Trucker JobNew

Trucker Job: Exports & Events

Commands, the keybind, the player load events the Trucker Job listens to and the hype-core bridges it relies on.

v1.0.0Escrow protectedQBox · QBCore · ESX

No exports in v1.0.0

hype-truckerjob does not register any exports of its own yet. Everything runs through the tablet, the admin panel and the commands below. Integration with your framework, target, fuel and vehicle keys goes through hype-core.

NameTypeSidePurpose
/cancelrouteCommandClientCancels the active route
/truckeradminCommandServerOpens the admin panel
+toggleinfopanelKeybindClientShows or hides the route panel (B)
hype-core:server:player-loadedEventServerLoads a character's driver data and businesses
hype-core:client:player-loadedEventClientRefreshes the tablet data, NPCs and blips

Commands

/cancelroute

Cancels the player's active route after a confirmation dialog. There is no pay, the job counts as failed, the route vehicles are removed and CancelRoute.penalty is taken from the business cash. The tablet has the same button.

/cancelroute

The name comes from Config.CancelRoute.command. Set it to false to keep only the tablet button, or set CancelRoute.enable = false to turn cancelling off.

/truckeradmin

Opens the admin panel. Players run it in chat or the F8 console; the server console is ignored.

/truckeradmin

The name comes from Config.AdminMenu.command; false registers no command. From the panel, staff can:

ActionWhat it does
Mark rent as paidCloses every unpaid invoice of a business
Extend rentMoves the next rent date by 1 to 365 days
Set cashSets the business cash to an exact amount
Edit businessChanges the name and the full blip (sprite, color and scale)
Reset businessRemoves the owner and puts the business back on sale
Fire employeeRemoves an employee from a business
Cancel routeFails a player's active route
TeleportMoves the admin to a point picked on the panel map

Every action is printed to the server console and, with Config.Discord, sent to the admin log.

+toggleinfopanel

Shows or hides the on screen route panel while a route is active. It is a key mapping with B as the default, so every player can change it in Settings → Key Bindings → FiveM under Toggle Trucker Job Info Panel.

Events

The script uses hype-core's player load events to know when a character is ready. The framework bridges in hype-core trigger them from the QBox, QBCore and ESX load events, so nothing is needed in most cases.

hype-core:server:player-loaded

Loads the character's driver XP (and creates their hype_truckerjob_personel row), marks them online in every business they work for and refreshes the employee lists. Trigger it yourself if your multicharacter resource loads characters without the usual framework events.

server.lua
TriggerEvent('hype-core:server:player-loaded', source)

Prop

Type

hype-core:client:player-loaded

On the client, the script sends the player data, config and translations to the tablet again and rebuilds the business NPCs, blips and target options.

client.lua
TriggerEvent('hype-core:client:player-loaded')

Internal events

Events named hype-truckerjob:server:* and hype-truckerjob:client:* are internal. The server checks every route step, position and payment, so triggering them by hand does nothing useful and can fail an active route.

hype-core bridges

hype-truckerjob calls nothing from your framework directly. Every outside call goes through hype-core, so a change in your setup is made once in hype-core for every HypeScripts resource.

Needhype-core callConfigured by
Character id and nameGetPlayerIdentifier, GetCharacterName, GetPlayersFramework, detected automatically
MoneyGetPlayerMoney, AddPlayerMoney, RemovePlayerMoneyFramework
Driver licenseGetPlayerLicenseFramework, esx_license on ESX
Dead checkGetIsPlayerDeadFramework
NPC interactionGetModules("Target")ox_target, or qb-target when ox_target is missing
Truck fuelGetFuel, SetFuelFuel in hype-core's config
Vehicle keysGiveKeys, RemoveKeysVehicleKeys in hype-core's config
Blips and NPCsCreateBlip, UpdateBlip, RemoveBlip, CreateFreezedPed, RemovePed-
Profile photoGetDiscordAvatarDiscord bot settings of hype-core

Notifications, text UI, progress bars and dialogs use ox_lib directly. When a player has no Discord avatar and MugShotBase64 is running, a headshot of their ped is used as the tablet profile photo.

hype-core/config/config.lua
Fuel = 'ox_fuel',
VehicleKeys = 'qbx_vehiclekeys',

On this page