> For the complete documentation index, see [llms.txt](https://botiv.gitbook.io/rdr2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://botiv.gitbook.io/rdr2/medical-and-law-records.md).

# Medical & Law Records

## 💬 How to Open the Menu (Medical & Law)

You can trigger the UI in several ways. Use the correct event/command depending on the script.

### 1. 📋 By Command

Set the command in `config.lua`:

**bt\_medicalfiles**

```lua
Config.Command = "openmedic"
-- /openmedic 2  => opens records_id = 2
```

Players type `/openmedic` in chat.

**bt\_lawrecords**

```lua
Config.Command = "openlaw"
-- /openlaw 2  => opens records_id = 2
```

Players type `/openlaw` in chat.

Set to `""` to disable the command.

***

### 2. 🟦 From Client Event

Trigger on the client to open the UI locally:

**bt\_medicalfiles**

```lua
TriggerEvent("bt_medical:showUI")
TriggerEvent("bt_medical:showUI", 2) -- records_id = 2
```

**bt\_lawrecords**

```lua
TriggerEvent("bt_lawrecords:showUI")
TriggerEvent("bt_lawrecords:showUI", 2) -- records_id = 2
```

***

### 3. 🟧 From Server Event

Ask the server to tell a specific client to open the UI:

**bt\_medicalfiles**

```lua
TriggerClientEvent("bt_medical:showUI", source)
TriggerClientEvent("bt_medical:showUI", source, 2) -- records_id = 2
```

**bt\_lawrecords**

```lua
TriggerClientEvent("bt_lawrecords:showUI", source)
TriggerClientEvent("bt_lawrecords:showUI", source, 2) -- records_id = 2
```

***

### 4. 📍 By Proximity (Prompt Zones)

Define coordinates where a prompt will appear:

```lua
Config.FilesRecordsCoords = {
  -- {x = -740.61, y = -1275.86, z = 43.58, distance = 2.0, id = 0}
}
```

When a player enters the range, a prompt appears.\
Holding the interaction key (default: `U`) opens the menu.

**New:** `id` groups records. Zones with the same `id` share the same records.

***

## ⚙️ Configuration Example (config.lua)

**bt\_medicalfiles**

```lua
Config = {}

Config.DEBUG = false
Config.Lang = "en"                  -- fr, en, pt, de, it, es

Config.Txt = {
    OpenPrompt = "Open",
    PromptGroup = "Medical Records"
}

Config.OpenKey = keys["U"]
Config.Command = "openmedic"

Config.FilesRecordsCoords = {
    -- {x = -740.61, y = -1275.86, z = 43.58, distance = 2.0, id = 0},
}

Config.WhitelistJobs = {}
```

**bt\_lawrecords**

```lua
Config = {}

Config.DEBUG = false
Config.Lang = "en"                  -- fr, en, pt, de, it, es

Config.Txt = {
    OpenPrompt = "Open",
    PromptGroup = "Law Records"
}

Config.OpenKey = keys["U"]
Config.Command = "openlaw"

Config.FilesRecordsCoords = {
    -- {x = -278.19, y = 803.16, z = 118.38, distance = 1.5, id = 0},
}

Config.WhitelistJobs = {}
```

***

## 📌 Notes

* **Flexible Access:** Use command, events, or proximity prompts—choose what fits your server best.
* **Job Restrictions:** Use `Config.WhitelistJobs` to restrict access (empty = all jobs allowed).
* **Multilingual:** Language and prompts are configurable.
* **Records Grouping (`id`):** Zones sharing the same `id` read/write the same group of records.

***

## 🗄️ Database

Both scripts **create/update the DB table automatically on resource start** (no SQL file required).\
If you want a clean reset, drop the table and restart the resource:

**bt\_medicalfiles**

```sql
DROP TABLE IF EXISTS medicalfiles;
```

**bt\_lawrecords**

```sql
DROP TABLE IF EXISTS lawrecords;
```

***
