Exports
Server exports available from wasabi_multijob.
Read, duty, add, and active-job exports accept a player source (server ID). RemoveJob and SetJobGrade also accept an offline framework identifier.
GetPlayerJobs
Returns all jobs a player currently has.
Returns: table<string, number>|nil — { jobName = grade }, or nil if the player is not found.
local jobs = exports.wasabi_multijob:GetPlayerJobs(source)
-- { ["police"] = 2, ["ambulance"] = 1 }
if jobs then
for jobName, grade in pairs(jobs) do
print(jobName, grade)
end
end
GetPlayerActiveJob
Returns the player's currently active job name.
Returns: string|nil
local activeJob = exports.wasabi_multijob:GetPlayerActiveJob(source)
if activeJob then
print('Active job: ' .. activeJob)
end
HasJob
Checks whether a player has a specific job.
Returns: boolean
if exports.wasabi_multijob:HasJob(source, 'police') then
print('Player is a cop')
end
GetJobGrade
Returns the grade level a player holds for a specific job.
Returns: number|nil
local grade = exports.wasabi_multijob:GetJobGrade(source, 'police')
if grade then
print('Police grade: ' .. grade)
end
AddJob
Adds a job to a player.
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
jobName | string | Job name |
grade | number | Grade level (default: 0) |
notify | boolean? | Notify the player (default: true) |
Returns: boolean, string|nil
local success, msg = exports.wasabi_multijob:AddJob(source, 'mechanic', 2, true)
if success then
print('Added: ' .. msg)
else
print('Error: ' .. msg)
end
Possible error messages:
"Player not found""Job is blacklisted""Job limit reached""Already has job"
RemoveJob
Removes a job from an online or offline player. If it was the active job for an online player, they are moved to Config.fallbackJob. Offline removal clears the saved active job so the framework's dismissal state remains authoritative when they reconnect.
| Parameter | Type | Description |
|---|---|---|
targetOrIdentifier | number|string | Online player server ID or framework identifier (citizenid on QB/QBX, identifier on ESX) |
jobName | string | Job name to remove |
notify | boolean? | Notify an online player (default: true) |
Returns: boolean, string|nil
local success, msg = exports.wasabi_multijob:RemoveJob(source, 'mechanic', false)
For an offline player, pass the framework identifier and disable notification:
local success, msg = exports.wasabi_multijob:RemoveJob(identifier, 'mechanic', false)
Possible error messages:
"Player not found""No such job""Invalid player target""Invalid job name"
SetJobGrade
Changes the grade of an existing saved job for an online or offline player. This does not consume another job slot and works when the player already has the maximum configured number of jobs.
| Parameter | Type | Description |
|---|---|---|
targetOrIdentifier | number|string | Online player server ID or framework identifier (citizenid on QB/QBX, identifier on ESX) |
jobName | string | Existing saved job to update |
grade | number | Valid whole-number framework grade |
Returns: boolean, string|nil
local success, msg = exports.wasabi_multijob:SetJobGrade(source, 'police', 2)
For a secondary or offline job, pass the stable framework identifier:
local success, msg = exports.wasabi_multijob:SetJobGrade(identifier, 'police', 2)
If the updated job is active, MultiJob also updates the authoritative framework job. Other saved jobs and the active-job selection are preserved, and online menus refresh immediately.
Possible error messages:
"Player not found""No such job""Job not found""Job grade not found""Invalid player target","Invalid job name", or"Invalid job grade""Failed to update job grade""Failed to update active framework job"
SetActiveJob
Sets a player's active job. The player must already have the job.
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
jobName | string | Job to set active |
notify | boolean? | Notify the player (default: true) |
Returns: boolean, string|nil
local success, msg = exports.wasabi_multijob:SetActiveJob(source, 'police', true)
if not success then
print('Failed: ' .. msg)
end
Possible error messages:
"Player not found""You don't have this job""You are already working as [jobName]"
GetPlayerDuty
Returns whether a player is currently on duty.
Returns: boolean|nil — true (on duty), false (off duty), nil (player not found).
local onDuty = exports.wasabi_multijob:GetPlayerDuty(source)
if onDuty == nil then
print('Player not found')
elseif onDuty then
print('On duty')
else
print('Off duty')
end
SetPlayerDuty
Sets duty status for the player's currently active job.
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
onDuty | boolean | true = on duty, false = off duty |
notify | boolean? | Notify the player (default: true) |
Returns: boolean
exports.wasabi_multijob:SetPlayerDuty(source, true)
exports.wasabi_multijob:SetPlayerDuty(source, false, false) -- silent clock-out
Usage examples
Give a player a job and set it active
local success = exports.wasabi_multijob:AddJob(source, 'mechanic', 1, true)
if success then
exports.wasabi_multijob:SetActiveJob(source, 'mechanic', false)
end
Check active job and duty status
local activeJob = exports.wasabi_multijob:GetPlayerActiveJob(source)
local onDuty = exports.wasabi_multijob:GetPlayerDuty(source)
if activeJob then
print(string.format('Active job: %s | On duty: %s', activeJob, tostring(onDuty)))
end
Config.defaultJobs entries cannot be removed through the UI, but can be removed via the RemoveJob export. Job grades are zero-indexed (grade 0 is the lowest). Online and offline job changes are saved automatically.