> ## Documentation Index
> Fetch the complete documentation index at: https://rust-co.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Enforcer

> The police van: siren, four prisoner seats and the API for police jobs.

The RCO Enforcer is a black police van with a prisoner box at the back. It is sold at the RCO Vehicles dealer like every RCO vehicle (see [Overview](https://rust-co.mintlify.site/rco-vehicles/overview.md)).

## Seats

Six seats: the driver, one passenger up front and four prisoners in the box, on two benches facing each other.

Behind the van there is one prompt for the box. Each player who presses it gets the next free seat, from the cab towards the doors, and climbs in through the double rear doors. A seat that is taken is never offered.

## Siren

The driver presses **G** to switch the siren on and **G** again to switch it off. It takes the horn's key: the Enforcer has no horn. The rotor spins and the red lamp lights up, and everyone nearby hears it. The siren switches off when the driver gets out.

In the Enforcer's `config/config.lua`:

| Setting | What it does | Default |
| - | - | - |
| `Config.Sound.Volume` | Volume of the whole van (0 to 1) | `0.5` |
| `Config.Sound.Effects.siren` | Volume of the siren (0 to 1) | `0.5` |
| `Config.Sound.SirenRange` | How far the siren is heard, in metres | `160.0` |

## API for police jobs

Your police job can put a player in the box: handcuffed, he can't walk, so the Enforcer's own animation takes him from behind the van to his seat. The exports run on the **prisoner's client**. Your job decides on its server who may arrest whom (job, distance, handcuffs); the Enforcer trusts that check.

| Export (client) | What it does | Returns |
| - | - | - |
| `PutInBack(vehicle, held)` | Puts this player in the next free prisoner seat. `vehicle` is the Enforcer's entity or network id; leave it out to use the Enforcer whose rear is within 6 m. `held` (default `true`): he can't get out on his own. | The seat (`1` to `4`), or `false` if the Enforcer is full, too far or overturned |
| `TakeOutOfBack()` | Releases this player; he gets out through the rear doors. | `true` if he was in a prisoner seat |
| `IsHeldInBack()` | Whether this player is held in the box. | `true` / `false` |

```lua theme={"dark"}
-- officer's client: the Enforcer he chose
TriggerServerEvent('myjob:server:putInEnforcer', targetId, NetworkGetNetworkIdFromEntity(enforcer))

-- server (your police job): check the officer, the distance and the handcuffs, then
RegisterNetEvent('myjob:server:putInEnforcer', function(targetId, netId)
    TriggerClientEvent('myjob:client:putInEnforcer', targetId, netId)
end)

-- prisoner's client
RegisterNetEvent('myjob:client:putInEnforcer', function(netId)
    local seat = exports['rco-enforcer']:PutInBack(netId) -- without a network id: the Enforcer whose rear is within 6 m
    if not seat then
        -- no seat: the Enforcer is full or too far
    end
end)

RegisterNetEvent('myjob:client:takeOutOfEnforcer', function()
    exports['rco-enforcer']:TakeOutOfBack()
end)
```

> [!NOTE]
>
> `PutInBack` stops the player's current animation (the handcuff pose) so the climb-in plays. Put the handcuff pose back afterwards if your job uses one. The Enforcer's lock doesn't stop the export. A prisoner still leaves the box if he dies or the Enforcer is put away.

> [!TIP]
>
> In the **RCO Cars** bundle every car lives in one resource: call `exports['rco-cars']:PutInBack(...)` instead.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.