Browse docs

Business

Read business state, submit authorized employee announcements or publish from trusted server integrations.

Server only · sky_jobs_base. The global feature and the registered job's relevant businessSettings capabilities must be enabled.

Authorized employee APIs

Use the authenticated server-handler source, not a player ID supplied by a client payload.

ExportReturns
GetBusinessContext(source){ success = true, data = context } or { success = false, error }
GetBusinessHistory(source, { job, before? }){ success = true, data = { entries, nextCursor? } } or { success = false, error }
SubmitBusinessAnnouncement(source, { job, kind, message? }){ success = true, data = context } or { success = false, error, retryAfter? }

context contains job, label, color, imageUrl, optional open, canChangeStatus, canAnnounce, cooldown and maxLength = 240. Submission checks the current job, configured feature, duty, permissions, validation and employee cooldown.

kind is open, closed, announcement, promotion or event. Opening/closing text can be omitted; the other kinds require text. Text is limited to 240 Unicode characters and 960 bytes. The server derives the image and recipients.

inside an existing authorized server callback
local context = exports["sky_jobs_base"]:GetBusinessContext(sourceId)
if not context.success then
    return context
end

return exports["sky_jobs_base"]:SubmitBusinessAnnouncement(sourceId, {
    job = context.data.job,
    kind = "promotion",
    message = "Two loaves for the price of one."
})

The callback's sourceId must be the authenticated caller. Do not accept another player's ID as an input to this example.

History entries contain id, timestamp (epoch milliseconds), name, action and content. Each page has up to 25 entries. Pass nextCursor unchanged as before for the next page, together with the same current job.

Access errors include disabled, not_authorized, off_duty and context_changed. Submission can also return invalid_payload, invalid_kind, invalid_message, cooldown, busy, unchanged or failed. Cooldown responses include retryAfter in seconds.

Trusted server integrations

These exports are for server-controlled automation. They do not authorize an employee through actorId and do not apply the employee publishing cooldown. For a player action, use SubmitBusinessAnnouncement above.

ExportReturns / behavior
GetBusinessState(job){ open, openColor, closedColor, openSprite, closedSprite, closedAlpha }, or nil when unavailable
SetBusinessOpen(job, open, message?, announce?, actorId?)true or false, reason; changes persisted opening state, blips and history
BroadcastBusinessAnnouncement(job, kind, message?, actorId?)true or false, reason; notice/history only, without an opening-state change

announce defaults to true; false makes a status change silent. An unchanged status returns false, "unchanged". Optional actorId supplies trusted history/admin context, not a permission check. Broadcast additionally supports zone_created and zone_removed for server-controlled zone notifications.

server automation in a yielding thread or callback
local changed, reason = exports["sky_jobs_base"]:SetBusinessOpen(
    "bakery", true, "Fresh bread is ready!"
)

local sent, sendReason = exports["sky_jobs_base"]:BroadcastBusinessAnnouncement(
    "police", "announcement", "Road closed at Legion Square."
)

Replace the example jobs with enabled jobs registered on your server. Global/job enablement, input validation, storage and busy-state checks still apply. See the feature/setup guide.