> For the complete documentation index, see [llms.txt](https://documentation.rcore.cz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.rcore.cz/paid-resources/rcore_police/api/client.md).

# Client

Client-side events and exports exposed by `rcore_police`. Call them from other resources running in the same client.

## 🚔 Actions

<details>

<summary>Job Menu</summary>

Open job menu (F6) via event.

```lua
TriggerEvent("rcore_police:client:api:openJobMenu")
```

</details>

<details>

<summary>Cuff</summary>

Cuffs the closest player to the initiator.

```lua
TriggerEvent("rcore_police:client:api:Cuff")
```

</details>

<details>

<summary>Escort</summary>

Escort the closest player to the initiator.

```lua
TriggerEvent("rcore_police:client:api:Escort")
```

</details>

<details>

<summary>Licenses</summary>

Allows to show Licenses of closest player to the initiator.

```lua
TriggerEvent("rcore_police:client:api:Licenses")
```

</details>

<details>

<summary>InVehicle</summary>

Allows to put closest player to closest vehicle seat.

```lua
TriggerEvent("rcore_police:client:api:InVehicle")
```

</details>

<details>

<summary>FromVehicle</summary>

Allows to get closest player from closest vehicle seat.

```lua
TriggerEvent("rcore_police:client:api:FromVehicle")
```

</details>

<details>

<summary>Search</summary>

Allows to search closest player if supported inventory is running.

```lua
TriggerEvent("rcore_police:client:api:Search")
```

</details>

<details>

<summary>Jail</summary>

Allows to open Jail dialog for closest player if supported jail is running.

```lua
TriggerEvent("rcore_police:client:api:Jail")
```

</details>

<details>

<summary>Emergency</summary>

Allows to call panic button.

```lua
TriggerEvent("rcore_police:client:api:Emergency")
```

</details>

<details>

<summary>Fine</summary>

Allows to Fine closest player to you.

```lua
TriggerEvent("rcore_police:client:api:Fine")
```

</details>

<details>

<summary>Impound</summary>

Allows to Impound closest vehicle to you.

```lua
TriggerEvent("rcore_police:client:api:Impound")
```

</details>

<details>

<summary>UnlockVehicle</summary>

Allows to unlock closest vehicle to you.

```lua
TriggerEvent("rcore_police:client:api:UnlockVehicle")
```

</details>

<details>

<summary>VehicleInfo</summary>

Allows to get VehicleInfo of closest vehicle to you.

```lua
TriggerEvent("rcore_police:client:api:VehicleInfo")
```

</details>

<details>

<summary>Radar</summary>

Allows to get in editor mode and place speed camera.

```lua
TriggerEvent("rcore_police:client:api:Radar")
```

</details>

## 🪝 Hooks

<details>

<summary>rcore_police:tackle:registerHook</summary>

Registers a **custom hook** to define logic that affects tackling behavior in the `rcore_police` system.

```lua
---@param hookName string
---@param callback fun(ctx: table, callback: fun(allow: boolean))

local function PreventTackleInWater(ctx, callback)
    -- Example condition: could check if the initiator is swimming
    callback(true) -- allow tackle
end

TriggerEvent("rcore_police:tackle:registerHook", "PreventInWater", PreventTackleInWater)
```

</details>

## 🔍 Player State

<details>

<summary>IsPlayerCuffed</summary>

Checks if a player is cuffed. Call without a `playerId` to check the initiator.

```lua
---@param playerId? number - ID of player to check, defaults to the initiator
---@return boolean isCuffed

local isCuffed = exports['rcore_police']:IsPlayerCuffed()

if isCuffed then
    print('Player is cuffed')
else
    print('Player is not cuffed or an error occurred:', statusOrErr)
end
```

Check any player on client:

```lua
---@param playerId number - ID of player which you want to get state of cuffed
---@return boolean isCuffed

local isCuffed = exports['rcore_police']:IsPlayerCuffed(playerId)
```

</details>

<details>

<summary>IsPlayerEscorted</summary>

Checks if a player is escorted. Call without a `playerId` to check the initiator.

```lua
---@param playerId? number - ID of player to check, defaults to the initiator
---@return boolean isEscorted

local isEscorted = exports['rcore_police']:IsPlayerEscorted()

if isEscorted then
    print('Player is escorted')
else
    print('Player is not escorted')
end
```

</details>

<details>

<summary>IsPlayerHeadBagged</summary>

Checks if a player has a paper bag on their head. Call without a `playerId` to check the initiator.

```lua
---@param playerId? number - ID of player to check, defaults to the initiator
---@return boolean isHeadBagged

local isHeadBagged = exports['rcore_police']:IsPlayerHeadBagged()
```

</details>

<details>

<summary>IsPlayerDead</summary>

{% hint style="warning" %}
**Experimental:** This export is **experimental** and is not guaranteed to work. It is used internally by rcore\_police and **no support is provided** for external usage.
{% endhint %}

```lua
---@param playerId? number - if not provided it checks the player which invokes the export (yourself)
---@return boolean retval

local retval = exports["rcore_police"]:IsPlayerDead(targetId)
```

</details>

<details>

<summary>IsPlayerHandsup</summary>

```lua
---@param playerId? number - if not provided it checks the player which invokes the export (yourself)
---@return boolean retval

local retval = exports["rcore_police"]:IsPlayerHandsup(targetId)
```

</details>

## 👮 General

<details>

<summary>GetPoliceOnline</summary>

Returns the number of police officers currently online.

```lua
---@return number policeOnline - defaults to 0 when none are online

local policeOnline = exports['rcore_police']:GetPoliceOnline()
```

</details>

<details>

<summary>OpenInvoiceMenu</summary>

```lua
---@return boolean retval - whether the menu was opened

local retval = exports["rcore_police"]:OpenInvoiceMenu()
```

</details>

## 🔧 Wheel Clamp

<details>

<summary>PlaceWheelClamp</summary>

Places a wheel clamp on the closest vehicle wheel bone.

```lua
exports["rcore_police"]:PlaceWheelClamp()
```

</details>

<details>

<summary>RemoveWheelClamp</summary>

Removes a wheel clamp from the closest vehicle wheel bone.

```lua
exports["rcore_police"]:RemoveWheelClamp()
```

</details>

<details>

<summary>DoesVehicleHaveWheelClamp</summary>

Checks if a vehicle has a wheel clamp. By default checks the closest vehicle; an `entityId` can be passed optionally. Useful for disabling interaction with vehicles when clamped.

```lua
---@param vehicleId? number - fully optional, checks closest vehicle near the player if omitted
---@return boolean retval     -- true if the vehicle has a wheel clamp, false otherwise
---@return string statusCode  -- status/result message

local vehicleId = yourVehicleId
local retval, statusCode = exports["rcore_police"]:DoesVehicleHaveWheelClamp(vehicleId)

if retval then
    print("Vehicle is clamped: " .. statusCode)
else
    print("Vehicle is free: " .. statusCode)
end
```

</details>
