Browse docs

Server exports

Read job data, manage employees and connect company payments from another server script.

All calls on this page run in a server script and use exports["sky_jobs_base"]. playerId means the online player's numeric server ID. jobName means the technical job name, such as sunrise_cafe.

Job and duty

ExportArgumentsReturns
getPlayerJobInfo(playerId)Player server ID{ job, grade, gradeLabel, onDuty }, or nil if unavailable
isPlayerOnDuty(playerId)Player server IDboolean; false when off duty or not loaded
getOnDutyPlayers(jobName)Technical job nameArray of on-duty player server IDs
setPlayerDuty(playerId, onDuty)Player server ID and true / falseWhether the resulting duty state matches the request

For example, restrict an external activity to on-duty cafe employees:

server.lua
local job = exports["sky_jobs_base"]:getPlayerJobInfo(playerId)
if not job or job.job ~= "sunrise_cafe" or not job.onDuty then
    return
end

-- Continue your cafe-only action here.

Set duty from your own authorised clock-in or clock-out workflow:

server.lua
local changed = exports["sky_jobs_base"]:setPlayerDuty(playerId, true) -- On duty
-- Pass false to clock out.
if not changed then
    print("The requested duty state could not be applied")
end

Use the authenticated player's server ID. See Duty for the complete reference.

Employees

ExportArgumentsReturns
setJobMember(jobName, playerOrIdentifier, grade?)Job, online server ID or offline character identifier, optional gradesuccess, error?
removeJobMember(jobName, playerOrIdentifier)Job and online server ID or offline character identifiersuccess, error?
getJobMembers(jobName)Technical job nameArray of employee records

setJobMember hires a player or changes an existing employee's grade. If the grade is omitted, it uses the job's lowest grade. Preserve actual grade numbers, including gaps.

server.lua
-- Run after your hiring system has authorised the application.
local success, errorMessage = exports["sky_jobs_base"]:setJobMember("sunrise_cafe", playerId)
if not success then
    print(("Hiring failed: %s"):format(errorMessage))
end

See Players & members for employee record fields and offline examples.

Company accounts

ExportArgumentsReturns
getJobMoney(jobName)Technical job nameCurrent balance; 0 for an invalid job
addJobMoney(jobName, amount)Job and positive whole amountSuccess as boolean
removeJobMoney(jobName, amount)Job and positive whole amountSuccess as boolean

For example, credit the company after a sale confirmed by your server script:

server.lua
local credited = exports["sky_jobs_base"]:addJobMoney("sunrise_cafe", 250)

Check the result before confirming the transaction to the player. Calculate prices and rewards on the server. See Society money for details.

Billing

Use CreateInvoice(request) to issue an invoice from your own service workflow. It returns { success = true, data = invoice } or { success = false, error = code }.

The Billing reference covers the full request, player/company recipients, payment modes, employee shares and the sky_jobs_base:billing:changed server event. Successful invoice creation does not mean the invoice was paid; check its payment status.

Salary

ExportReturns
pausePlayerSalary(playerId)boolean
resumePlayerSalary(playerId)boolean
isPlayerSalaryPaused(playerId)boolean
getGradeSalary(jobName, grade)Salary amount, interval in minutes

The pause state lasts until resumed or the player disconnects. See Salary.

Business and announcements

ExportUse
GetBusinessState(jobName)Read opening state and configured blip values; nil if unavailable
GetBusinessContext(playerId)Read the employee's authorised Business context
GetBusinessHistory(playerId, request)Read announcement history for the employee's current job
SubmitBusinessAnnouncement(playerId, request)Publish as an employee, with duty, permission and cooldown checks
SetBusinessOpen(jobName, open, message?, announce?, actorId?)Change opening state from trusted server automation; true or false, reason
BroadcastBusinessAnnouncement(jobName, kind, message?, actorId?)Publish from trusted server automation; true or false, reason

For player actions use SubmitBusinessAnnouncement with the authenticated handler's player ID. actorId on the automation exports only supplies history context. See Business for request fields and error codes.

Storage

ExportReturns
GetStorageItemCount(stationId, jobName, grade, itemName)Item count; 0 if missing
RemoveStorageItem(stationId, jobName, grade, itemName, amount)boolean
AddStorageItem(stationId, jobName, grade, itemName, amount, metadata?)success, reason?
AddStorageItems(stationId, jobName, grade, items)success, reason?

Use the storage point's actual ID and authorise the supplied job/grade in your server script. These calls operate on shared station storage. See Storage for capacity, metadata and batch examples.

Vehicles and deliveries

Use registerExternalVehicle(plate, jobName, model, netId?, ownerSource?, trunkCapacity?) after your external garage spawns a job vehicle, and unregisterExternalVehicle(plate) when it is removed. See External garage integration for the complete spawn/cleanup example and accepted values.

For delivery scripts, use the Wholesale orders exports to read, accept, reject and complete orders. Completing an order and depositing stock are separate operations; persist which delivery you completed before allowing it to run again.

Permissions and events

hasJobPermission(playerId, permission, jobName?) checks a registered employee permission. Use the exact permission keys from Permissions.

React to job, duty, employee and invoice changes with Events. These notifications let your integration update when something changes, without repeatedly polling exports.

More server integrations