# 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.

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Returns
    </th>
  </tr>
</thead>

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

`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.

```lua [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:

```lua [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](/docs/base/jobs-base/features/job-bells).
