> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-police/cas-advanced-police-and-law-system.md).

# CAS Advanced Police & Law System

CAS Advanced Police & Law System + MDT for RedM, VORP and RSG: the game's own arrest, leg irons, public hanging, a records book (MDT), warrants into bounties, jail and a marshal's desk.

**A complete police and law system with an MDT for RedM, built on the game's own law: Rockstar's arrest, chain gang irons, the gallows and the cells' own doors. For VORP and RSG.**

[Get the script](https://codeaftersex.com/script/police) | [Support Discord](https://discord.gg/codeaftersex)

{% hint style="success" %}
Put the `cas-police` folder in your resources, `ensure cas-police` after oxmysql, your framework and your inventory, and run the items SQL on VORP. The script finds VORP or RSG by itself and makes its own database tables. Start with [Installation](/script-documentation/cas-police/install.md).
{% endhint %}

CAS Advanced Police & Law System (the `cas-police` resource) is a complete law enforcement job for RedM roleplay servers, with an MDT records book. It replaces the pile of separate scripts most servers bolt together for the law: duty, cuffs, drag, hogtie, search, the records book, warrants and bounties, the jail, the society and the boss menu. On top of that come the parts of the law the game itself has: the gallows, leg irons, the cells' own doors, a hogtied man thrown across a saddle, and law cars from the office garage.

A lawman goes on duty at his office, pins on his badge, arrests a suspect the way the game's own lawmen do, walks him in, writes him up in the records book and books him into jail. The record follows the offender around the county. An unserved warrant ages into a bounty, and bounty hunters claim it from their own board, bring the man in and are paid out of the office ledger.

Almost every value lives in the config, so the same script fits a small server with one statewide office and a large server with several regional offices.

## Highlights

* **The game's own arrest.** F6 plays Rockstar's paired arrest on both players at once, from behind, in front, left or right, with a handgun or a long gun. Nobody has to accept it, and the handcuffs lock on the wrists and follow the hands.
* **Leg irons.** Rockstar's own chain gang irons: bound ankles, a short chain between them, clinking steps, no running and no jumping. Sisika keeps its prisoners in irons by default.
* **The public hanging.** The gallows of Valentine, Rhodes, Saint Denis and Blackwater, run the way the game runs its own: the noose, the crowd told who hangs and why, the lever with the game's own animation, the trapdoor and the rope. Anyone may shoot the rope before the drop and set him loose.
* **A hogtied man across the saddle.** Hold R by a hogtied player with your horse beside you and he goes across the saddle with the game's own carry. R again takes him down.
* **The office garage.** Law cars are taken out at the office with a showroom view of each car, one per lawman, by rank, with a LAW plate and a full tank. Made for the Police Patrol Car Pack (four law cars) on All In One RedM Cars.
* **Real cell doors.** The 20 cell doors of the 8 sheriff offices use the game's own door system. They are locked from the start, a lawman opens them with his keys, and a cell locks itself when a prisoner is put in it.
* **The records book, drawn as an 1899 case file.** Reports with charges from a 65 charge penal code you can edit in the book, warrants, citizen files with a description and a photograph, patrol notes with map marks and bounty capture receipts.
* **Warrants that age into bounties.** An unserved warrant becomes a bounty after a set number of days. Bounty hunters claim it from their own board, bring the man in and are paid out of the office ledger. Public wanted notices post to Discord and are deleted when the warrant closes.
* **Jail with work details and escapes.** Several jails, a sentence clock that can keep running while the prisoner is offline, and work details (sweep, haul water, split firewood) that cut the sentence. Leave the yard and the guards open fire and alligators hunt the water.
* **The marshal's desk.** The boss menu of the built-in society: swear in, promote, set pay and dismiss, the office ledger, a pay roll paid per day on duty, and the office locker with a log of every hand.
* **Six languages.** English, Turkish, German, French, Spanish and Brazilian Portuguese, for every screen and every game text.

## At a glance

| Feature              | Details                                                                                                                     |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Version              | 1.0.0                                                                                                                       |
| Frameworks           | VORP Core and RSG Core, found by itself (`Config.Framework = 'auto'`)                                                       |
| Requirements         | oxmysql, and ox\_lib on RSG                                                                                                 |
| Inventory            | vorp\_inventory or CAS Advanced Inventory on VORP, rsg-inventory on RSG                                                     |
| Optional             | CAS Radial Menu, CAS Notification (VORP), All In One RedM Cars with the Police Patrol Car Pack, CAS Advanced Medical System |
| Replaces             | `vorp_police` on VORP, `rsg-lawman` and `rsg-prison` on RSG                                                                 |
| Database             | Its own `cas_police_` tables, made on first start. On VORP one items SQL to run.                                            |
| Items                | `handcuffs`, `lockpick` and `mdt_book` (the records book)                                                                   |
| Penal code           | 65 starter charges in six sections, editable inside the book                                                                |
| Jails                | Sisika and seven town jails                                                                                                 |
| Gallows              | Valentine, Rhodes, Saint Denis and Blackwater                                                                               |
| Languages            | English, Turkish, German, French, Spanish, Brazilian Portuguese                                                             |
| Open files in Escrow | `config/`, `locales/`, `server/bridge/` and `install/`                                                                      |

## Where to start

| You want to                                                              | Read                                                               |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------ |
| Install the script and replace the old law scripts                       | [Installation](/script-documentation/cas-police/install.md)        |
| Set up offices, ranks, jails, the garage, the gallows and the penal code | [Configuration](/script-documentation/cas-police/configuration.md) |
| See how the arrest, the book, the jail and the bounties play             | [Gameplay](/script-documentation/cas-police/gameplay.md)           |
| Look up a command and who may use it                                     | [Commands](/script-documentation/cas-police/commands.md)           |
| Hook another script into the law                                         | [Developers](/script-documentation/cas-police/developers.md)       |
| Fix a problem or find a quick answer                                     | [FAQ](/script-documentation/cas-police/faq.md)                     |

## What is in it

* **Offices.** One statewide office, or several regional offices, each with its own jobs, region, jail, ranks, duty stations, desk, locker and ledger.
* **The records book (MDT).** Reports with charges from your penal code, warrants, citizen files with a description and a photograph link, the penal code itself, patrol notes with map marks, and bounty capture receipts. Opened by a command, an item, or both.
* **Warrants that age into bounties.** A warrant nobody serves turns into a bounty on its own after a set number of days. Warrants and bounties can post to a public Discord channel as wanted notices, and the notice is deleted when the warrant closes.
* **The hunter's board.** Bounty hunters see warrants and bounties, claim one (one hunter to a bounty), capture the man, hand him to a lawman on duty and file the capture. The payout leaves that office's ledger and a receipt lands in the lawman's book.
* **The game's own arrest.** F6 plays Rockstar's arrest on both players: the lawman walks in on the suspect with his gun up, the suspect raises his hands and goes into irons. Nobody has to accept it. It comes from whichever side the lawman stands (behind, in front, left or right), with a handgun or a long gun, and starts at the moment of the move that fits how far apart the two stand. The handcuff prop sits on the wrists.
* **Drag.** Lead a cuffed prisoner by the arm at walking pace.
* **Leg irons.** Rockstar's own chain gang irons: hold G by a cuffed or hogtied man and he shuffles with his ankles bound and a short chain between them. He cannot run or jump. A jail can keep its prisoners in irons.
* **A hogtied man across the saddle.** Hold R next to a hogtied player with your horse beside you and he goes across the saddle with the game's own carry. R again takes him down.
* **The public hanging.** The gallows of Valentine, Rhodes, Saint Denis and Blackwater, run the way the game runs its own: the noose on a cuffed man, the crowd told who hangs and why, the lever with the game's own animation, the trapdoor, the rope. Anybody may shoot the rope before the drop and set him loose.
* **The office garage.** Law cars are taken out at the office with a showroom view of each car and put away again, one per lawman, by rank. Made for the Police Patrol Car Pack (four law cars) on All In One RedM Cars.
* **Real cell doors.** The cells use the jails' own doors. A lawman locks and unlocks them with his keys, and a cell shuts and locks when a prisoner is put in it.
* **Hogtie rules for every player.** A regular lasso and a reinforced lasso each have their own break free rules. A reinforced lasso can hold until the captor rides far enough away.
* **Search for everyone.** Anyone can search a cuffed, hogtied or downed player. The search opens the framework inventory. Money and the items you block always stay in his pocket.
* **Picking cuffs.** A friend can pick the cuffs from behind with a lockpick and a dial minigame.
* **The badge.** A badge prop pinned to the coat, moved on 6 axes (3 to move, 3 to turn) and saved for the next shift.
* **Jail with work details.** Several jails, cells, a sentence timer that can keep counting while the prisoner is away, and work details (sweep, haul water, split firewood) that cut the sentence.
* **Booking.** By command, by the booking sheet (it fills in the charges from the last report), or by a transport guard at a transport point.
* **Escapes.** Leave the yard and you have a few seconds to come back. Stay out and the guards open fire and alligators hunt the water. Die and you wake in your cell with time added. Get clear and you are free, with a fugitive warrant on your name.
* **Alerts and dispatch.** Any citizen can send for the law. Lawmen on duty get a card, a map blip and a GPS ride to the spot, plus a dispatch radio between them.
* **The marshal's desk.** The boss menu of the built-in society: the roll (swear in, promote, set pay, dismiss), the ledger (fines in, pay and bounties out, deposits and withdrawals), the pay roll paid per day on duty, and the office locker with a log of every hand.
* **Discord webhooks.** A master URL plus a URL and a switch for each action.
* **CAS Radial Menu.** When it runs, cas-police adds its own wheel by itself: duty, the records book, arrest, badge, radio and office for lawmen, the hunter's wheel for bounty hunters, search for everyone.
* **Exports and events** for other scripts.
* **A test kit for admins.** `/lawdummy` puts a test suspect, a test lawman and a test horse in the world, so one admin can try every two-person part alone: the arrest, the escort, the saddle, the irons, the gallows.
* **Six languages:** English, Turkish, German, French, Spanish and Brazilian Portuguese.

## Frameworks

| Framework | Notes                                                                               |
| --------- | ----------------------------------------------------------------------------------- |
| VORP Core | vorp\_core with vorp\_inventory, or the CAS Advanced Inventory that takes its place |
| RSG Core  | rsg-core with rsg-inventory                                                         |

The script finds the framework by itself (`Config.Framework = 'auto'`). You can force one with `'vorp'` or `'rsg'`.

## Requirements

* **oxmysql.** The script makes its own tables on first start. Nothing to import.
* **ox\_lib on RSG.** rsg-core needs it anyway. On RSG the messages show as ox\_lib notifications.
* **Optional:** CAS Radial Menu (cas-police adds its own wheel), on VORP CAS Notification (it draws the messages in its own look), All In One RedM Cars with the Police Patrol Car Pack (the cars of the office garage) and CAS Advanced Medical System (revives a prisoner who dies trying to escape).
* A VORP or RSG server as above.

## Quick install

1. Put the `cas-police` folder in your resources (keep the folder name `cas-police`).
2. In `server.cfg`, add `ensure cas-police` after oxmysql, your framework and your inventory.
3. Items: on VORP run `install/items_vorp.sql` on your database. On RSG the script adds its items by itself.
4. Copy the pictures from `install/images/` into your inventory's item image folder.
5. Stop the old law scripts (`vorp_police` on VORP, `rsg-lawman` and `rsg-prison` on RSG), give your staff the `caspolice.admin` ace, and start the server. The console shows:

```
[cas-police] running on VORP Core, 65 charges in the penal code.
```

Then go through `config/` (start with `config/offices.lua`) and set the offices, jobs and points for your map.

## The guide

| Page                                                               | What it covers                                                                                                 |
| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| [Installation](/script-documentation/cas-police/install.md)        | Folder, server.cfg, items, pictures, the database, replacing old scripts, admins, the first start              |
| [Configuration](/script-documentation/cas-police/configuration.md) | Every setting in `config/config.lua`, `offices.lua`, `jails.lua` and `penalcode.lua`, with copy-paste examples |
| [Gameplay](/script-documentation/cas-police/gameplay.md)           | How each feature plays for lawmen, citizens, prisoners and bounty hunters                                      |
| [Commands](/script-documentation/cas-police/commands.md)           | Every command, who may use it and its arguments                                                                |
| [Developers](/script-documentation/cas-police/developers.md)       | Exports, events, state bags and webhooks                                                                       |
| [FAQ](/script-documentation/cas-police/faq.md)                     | Common questions and fixes                                                                                     |

## More

* [Get CAS Advanced Police & Law System + MDT (Escrow or Open Source)](https://codeaftersex.com/script/police)
* [Support Discord](https://discord.gg/codeaftersex)
* [All CodeAfterSex scripts](https://codeaftersex.com/scripts)
