Exports
Server exports available from wasabi_multijob.
All exports accept a player source (server ID). Passing an invalid source returns nil or false.
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 a player. If it was the active job, the player is moved to Config.fallbackJob.
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
jobName | string | Job name to remove |
notify | boolean? | Notify the player (default: true) |
Returns: boolean, string|nil
local success, msg = exports.wasabi_multijob:RemoveJob(source, 'mechanic', false)
Possible error messages:
"Player not found""No such 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).