Commands#
Job Management registers its commands and keys from Config.Interactions in config/config.lua. Rename any of them there, or set it to nil to turn it off.
Command / key | Who | Description |
|---|---|---|
| Every player | Opens the job menu. With |
Documentation
Commands, keys and exports of Job Management + Multijob: open the job menu from your scripts, pay workers through the job treasury with AddJobMoney, and fire players online or offline.
Job Management registers its commands and keys from Config.Interactions in config/config.lua. Rename any of them there, or set it to nil to turn it off.
Command / key | Who | Description |
|---|---|---|
| Every player | Opens the job menu. With |
| Admins | Opens the admin panel. Anyone else sees No permission. |
| The boss, ranks with Open Menu, admins | Opens the boss menu of the active job. |
| Admins | Opens the admin panel with a key — 167 for F6. |
| The job's boss | Opens the boss menu of the active job from anywhere, without visiting the zone. |
Keys are GTA control ids, read directly — they are not listed in the game's key-binding settings, so players cannot rebind them.
Config.Interactions = {
jobCommand = "jobs", -- /jobs instead of /job
jobKey = nil, -- no key for the job menu
adminCommand = "jobadmin",
adminKey = nil,
bossCommand = "bossmenu",
bossKey = 167, -- F6
}For opening the job menu from your own scripts — a radial menu, a phone app, a tablet prop, a HUD button.
exports['qs-job-management']:requestJobs()Opens the job menu exactly as /job does, with the player's jobs, levels and treasury cuts. It skips the Config.UseByLicense check, so gate it yourself if you restrict the multijob by license.
-- An ox_lib radial menu entry
lib.addRadialItem({
id = 'jobs',
icon = 'briefcase',
label = 'My jobs',
onSelect = function()
exports['qs-job-management']:requestJobs()
end,
})How another resource drives Job Management — a job script paying its workers through the treasury, a court or ban script taking a job away.
exports['qs-job-management']:AddJobMoney(source, amount, jobName)Parameter | Type | Description |
|---|---|---|
| number | The worker's server id. |
| number | The full payout, before the cut. Rounded down to whole dollars; 0 or less is ignored. |
| string | The job the money belongs to — the same name as in |
The worker receives the payout minus the job's cut, in cash. The cut, minus the government tax, goes into the job's treasury, and the job's statistics and the worker's earnings are updated. Nothing is returned.
Guard the call so your resource still pays when Job Management is not running:
local payout = 450
if GetResourceState('qs-job-management') == 'started' then
exports['qs-job-management']:AddJobMoney(source, payout, 'miner')
else
-- your usual payout
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addMoney(payout)
endDo not also pay the worker yourself —
AddJobMoneyalready hands them their share.
local ok = exports['qs-job-management']:FirePlayerFromJob(source, jobName)Parameter | Type | Description |
|---|---|---|
| number | The player's server id. |
exports['qs-job-management']:FirePlayerFromJobOffline(identifier, jobName)Parameter | Type | Description |
|---|---|---|
| string | The ESX |
The job list lives in the qs_job_management table, so any server script can read it — to show a character's jobs on an MDT, or to check whether someone works for a company before letting them in:
local rows = MySQL.query.await(
'SELECT job, grade, badges FROM qs_job_management WHERE identifier = ?',
{ identifier } -- ESX identifier, or QBCore/Qbox citizenid
)
for _, row in ipairs(rows) do
local badges = json.decode(row.badges or '[]') -- a list of badge names
print(row.job, row.grade, #badges)
endRead it rather than write to it: the resource keeps the list in step with the framework, the limits and the logs on its own.
jobName
string |
The job to remove. |
Removes the job from the player's list and, if it was their active job, sets them to unemployed. Returns true, or false when the player is not loaded. It is silent: no notice to the player, no HR log entry.
-- A court script stripping a convicted officer of their badge
exports['qs-job-management']:FirePlayerFromJob(targetSrc, 'police')citizenid
| string | The job to remove. |
Removes the job from the list, and resets the character's saved framework job to unemployed — in users on ESX, in players on QBCore and Qbox — whatever job it was. Always returns true.
-- A ban routine clearing a character's police job
exports['qs-job-management']:FirePlayerFromJobOffline(citizenid, 'police')