Browse docs

Player Interaction Whitelist

Reference for Player Interaction Whitelist in sky_jobs_base.

All server exports

Player Interaction Whitelist

Shared player interactions are job-whitelisted. Register the jobs owned by your resource before using any player-interaction client or server export. Registration authorizes existing jobs only; it does not create framework jobs or Sky Jobs groups.

sky_policejob automatically registers its configured Police jobs with the police policy from Config.JobPlayerInteractions. sky_crimesystem does the same for its Crime jobs and the crime policy. Both refresh their registration after Job Configurator updates.

registerInteractionJobs(groupKey, jobs, permissions?)

  • groupKey (string) - unique key owned by the calling resource.
  • jobs (string[] | table[]) - job names or job definitions containing a name.
  • permissions (table?) - required for custom groups. It may be omitted when groupKey already has a policy in Config.JobPlayerInteractions.groups.
  • Returns boolean, string?.

Supported permission fields:

FieldPurpose
requireOnDutyRequires the current player to be on duty for every enabled action.
cuffsApply and remove handcuffs.
ziptiesApply, remove, and cut zipties.
legRestraintsApply and remove leg restraints.
escortStart and stop escorting a restrained player.
vehiclePlace escorted players in vehicles or remove restrained players from vehicles.
headBagApply and remove head bags.
searchOpen and transfer items through player search.
local registered, reason = exports["sky_jobs_base"]:registerInteractionJobs(
    "security",
    {
        "security",
        { name = "security_night" }
    },
    {
        requireOnDuty = true,
        cuffs = true,
        zipties = false,
        legRestraints = true,
        escort = true,
        vehicle = true,
        headBag = false,
        search = true
    }
)

if not registered then
    print(("Unable to register security interactions: %s"):format(reason))
end
Call this export from a server script during resource startup, after the final job list is known. Call it again when your resource changes that list at runtime. Group keys are resource-owned, registrations are removed when the owner resource stops, and another resource cannot overwrite the same key.

Registering jobs only grants the selected interaction capabilities to players whose current job matches the registration. It does not execute an action, bypass item requirements, or trust client input.

unregisterInteractionJobs(groupKey)

Removes a group registered by the calling resource.

exports["sky_jobs_base"]:unregisterInteractionJobs("security")

The export returns false, "not_owner" if another resource owns the group.

hasInteractionAccess(sourceId, permission)

Checks the same server-authoritative job and duty policy used by the interaction actions.

local allowed, reason = exports["sky_jobs_base"]:hasInteractionAccess(source, "search")

Possible failure reasons include not_authorized, not_on_duty, and invalid_permission.