Browse docs

Job Bells

Register and ring bells through the server-side Sky_Jobs library owner.

Server library API. Import Sky_Jobs through your resource's existing Jobs Base loader and call these methods after Jobs Base is ready. They are library methods, not standalone Cfx exports.

MethodReturns
Sky_Jobs.Bells.Register(key, job, definitions)A set { [runtimeId] = true, ... } of registered IDs
Sky_Jobs.Bells.Remove(key)No return value
Sky_Jobs.Bells.GetAll()Copies of normalized definitions keyed by runtime ID, including their job
Sky_Jobs.Bells.Ring(playerId, runtimeId)true or false, reason

key and job are non-empty strings of up to 64 bytes. A registration supports up to 32 sequential definitions. Invalid registration raises an error; it does not silently remove the existing registration.

server.lua
local ids = Sky_Jobs.Bells.Register("reception", "police", {
    {
        id = "desk",
        label = "Police reception",
        sound = "R1",
        active = true,
        positioned = true,
        x = 441.0, y = -982.0, z = 30.7,
        heading = 0.0,
        propModel = "sky_job_deskbell",
        spawnProp = true,
        recipients = "both",
        volume = 0.5
    }
})

Runtime IDs are scoped to the invoking resource, registration key, job and bell ID. Re-registering your own key replaces that registration. Resource-stop cleanup removes registrations owned by the stopping resource. GetAll() also includes inactive/unpositioned definitions and does not expose internal owner/cooldown state.

To ring, select a returned runtime ID and use an authenticated, nearby player server ID:

inside your existing server interaction handler
local success, reason = Sky_Jobs.Bells.Ring(sourceId, runtimeId)

Ring checks the current player, active/positioned bell, actual distance, available sound and player/bell/job cooldowns. Errors include disabled, invalid_bell, unavailable, player_missing, too_far, cooldown and sound_missing.

Do not accept arbitrary recipient, sound-file or position data from a client. Configure those in the registered definitions. See Job Bells setup.