# Player Interactions

> Reference for Player Interactions in sky_jobs_base.

[All client exports](/docs/base/jobs-base/client-exports)

## Player Interactions

For identity and license views, see the [document exports](/docs/base/jobs-base/client-exports/documents).

The client exports below open or execute the shared handcuff, ziptie, leg-restraint, escort, vehicle, head-bag, and player-search flows.

<callout color="warning" icon="i-lucide-shield-check">

Calling a client export does not grant access. The player's current job must be registered through the server export `registerInteractionJobs`, and the server validates the whitelist, duty state, target, distance, restraint state, and required items again when the action is executed. `sky_policejob` and `sky_crimesystem` register their configured jobs automatically.

</callout>

The old `civilianUse` and `skipAccess` options are no longer supported. Do not pass them. For another job resource, register its jobs on the server before exposing any of these client actions.

### `hasInteractionAccess(permission)`

Returns `boolean, string?` for the local player's current server-authoritative whitelist and duty access. Permission names are `cuffs`, `zipties`, `legRestraints`, `escort`, `vehicle`, `headBag`, and `search`.

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

### Handcuffs and zipties

#### `getCuffAvailability(action, options)`

Checks whether an action is currently available without executing it.

- `action` (`string`) - `cuff`, `uncuff`, `ziptie`, `unziptie`, or `cut_ziptie`.
- `options.targetId` (`number?`) - server ID of a specific target. The nearest player is used when omitted.
- `options.displayOnly` (`boolean?`) - use `true` while building a menu. Missing cuff, ziptie, or cutter items and the ziptie hands-up execution requirement do not hide the action in this mode. Call the real action export without `displayOnly`; it validates these requirements and returns the failure reason for the user-facing message.
- Returns `boolean, table?` - availability and context or failure information.

```lua
local available, context = exports["sky_jobs_base"]:getCuffAvailability("ziptie", {
    targetId = targetId,
    displayOnly = true
})
```

#### `requestCuff(cuffType, options)` and `requestUncuff(cuffType, options)`

Runs the validated cuff flow for the nearest player or `options.targetId`.

- `cuffType` (`string`) - `cuffs` or `zipties`.
- Returns `boolean, string?` - whether the request started and an optional failure reason.

```lua
exports["sky_jobs_base"]:requestCuff("zipties", {
    targetId = targetId
})
```

#### Nearest-player cuff exports

<table>
<thead>
  <tr>
    <th>
      Export
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        cuffPlayer(cuffType, options?)
      </code>
    </td>
    
    <td>
      Applies <code>
        cuffs
      </code>
      
       or <code>
        zipties
      </code>
      
       to the nearest valid player.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        uncuffPlayer(options?)
      </code>
    </td>
    
    <td>
      Removes the nearest player's current restraints.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cutZipties(options?)
      </code>
    </td>
    
    <td>
      Cuts the nearest player's zipties with the configured cutter.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        isPlayerCuffed(serverId?)
      </code>
    </td>
    
    <td>
      Returns whether the selected target or local player is currently cuffed.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useHandcuffsItem()
      </code>
    </td>
    
    <td>
      Starts the handcuff item flow.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useZiptiesItem()
      </code>
    </td>
    
    <td>
      Starts the ziptie item flow.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        getCuffConfig()
      </code>
    </td>
    
    <td>
      Returns a read-only snapshot of <code>
        Config.PoliceCuffs
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

`useCuffPlayer`, `useUncuffPlayer`, and `useCutZipties` are compatibility aliases. They use the same job whitelist and do not bypass access checks.

#### Escape minigame

Escape opportunities are configured through `Config.PoliceCuffs.escape` in `sky_jobs_base/config/config.lua`. The server rolls the chance when restraints are applied and owns every minigame round. There is no public client export or event for forcing an escape opportunity or declaring success.

### Leg restraints

<table>
<thead>
  <tr>
    <th>
      Export
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        getLegRestraintsAvailability(action, options?)
      </code>
    </td>
    
    <td>
      Checks <code>
        apply
      </code>
      
       or <code>
        remove
      </code>
      
       for <code>
        options.targetId
      </code>
      
       or the nearest player.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        applyLegRestraints(options?)
      </code>
    </td>
    
    <td>
      Applies leg restraints to the selected valid target.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        removeLegRestraints(options?)
      </code>
    </td>
    
    <td>
      Removes leg restraints from the selected valid target.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        isLegRestrained()
      </code>
    </td>
    
    <td>
      Returns whether the local player currently has leg restraints.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        getLegRestraintsConfig()
      </code>
    </td>
    
    <td>
      Returns a read-only snapshot of <code>
        Config.LegRestraints
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

```lua
local available = exports["sky_jobs_base"]:getLegRestraintsAvailability("apply", {
    targetId = targetId
})

if available then
    exports["sky_jobs_base"]:applyLegRestraints({
        targetId = targetId
    })
end
```

The acting job needs the `legRestraints` permission. The server also validates the target, distance, vehicle state, item requirement, current restraint state, and `Config.LegRestraints.requireCuffed`.

### Escort and vehicle actions

#### `getEscortAvailability(action, options)`

- `action` (`string`) - `escort`, `place_in_vehicle`, or `take_out_vehicle`.
- `options.targetId` (`number?`) - specific target for the escort action.
- Returns `boolean, table?`.

```lua
local available = exports["sky_jobs_base"]:getEscortAvailability("escort", {
    targetId = targetId
})
```

#### Escort exports

<table>
<thead>
  <tr>
    <th>
      Export
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        escortToggle()
      </code>
    </td>
    
    <td>
      Starts or stops escorting the nearest cuffed player.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        escortToggleTarget(targetId, options?)
      </code>
    </td>
    
    <td>
      Starts or stops escorting a specific cuffed player.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        escortPutInVehicle()
      </code>
    </td>
    
    <td>
      Places the currently escorted player in the nearest valid vehicle.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        escortTakeOutVehicle()
      </code>
    </td>
    
    <td>
      Removes a cuffed player from the nearest vehicle.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        escortPlaceInVehicle(options?)
      </code>
    </td>
    
    <td>
      Availability-driven variant used by menu integrations.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        escortRemoveFromVehicle(options?)
      </code>
    </td>
    
    <td>
      Availability-driven removal variant.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        getEscortConfig()
      </code>
    </td>
    
    <td>
      Returns a read-only snapshot of <code>
        Config.PoliceEscort
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

The `escort` and `vehicle` permissions are separate. A job can be allowed to escort players without being allowed to place them in or remove them from vehicles.

### Head bag

<table>
<thead>
  <tr>
    <th>
      Export
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        getHeadBagAvailability(action, options?)
      </code>
    </td>
    
    <td>
      Checks <code>
        apply
      </code>
      
       or <code>
        remove
      </code>
      
       for <code>
        options.targetId
      </code>
      
       or the nearest player.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        applyHeadBag(options?)
      </code>
    </td>
    
    <td>
      Applies a head bag to the selected valid target.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        removeHeadBag(options?)
      </code>
    </td>
    
    <td>
      Removes the selected target's head bag.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useHeadBag(options?)
      </code>
    </td>
    
    <td>
      Toggles a head bag on the nearest player or <code>
        options.targetId
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useHeadBagTarget(options?)
      </code>
    </td>
    
    <td>
      Compatibility alias for <code>
        useHeadBag
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        isHeadBagged()
      </code>
    </td>
    
    <td>
      Returns whether the local player is currently hooded.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        getHeadBagConfig()
      </code>
    </td>
    
    <td>
      Returns a read-only snapshot of <code>
        Config.HeadBag
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

```lua
exports["sky_jobs_base"]:applyHeadBag({
    targetId = targetId
})
```

Applying or removing a head bag from another player requires the `headBag` whitelist permission. A hooded player may still use the configured self-remove flow.

### Player search

<table>
<thead>
  <tr>
    <th>
      Export
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        getPlayerSearchAvailability(options?)
      </code>
    </td>
    
    <td>
      Checks the nearest target.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        getTargetPlayerSearchAvailability(targetId, options?)
      </code>
    </td>
    
    <td>
      Checks a specific target.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        getPlayerSearchConfig()
      </code>
    </td>
    
    <td>
      Returns a read-only snapshot of <code>
        Config.PlayerSearch
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        startPlayerSearch(context?)
      </code>
    </td>
    
    <td>
      Starts the search UI for <code>
        context.targetId
      </code>
      
       or the nearest target.
    </td>
  </tr>
</tbody>
</table>

```lua
local available = exports["sky_jobs_base"]:getTargetPlayerSearchAvailability(targetId)

if available then
    exports["sky_jobs_base"]:startPlayerSearch({
        targetId = targetId
    })
end
```

The target must be nearby and restrained. Inventory reads and every item transfer are validated again on the server.

<br />
