# BA Board

### 🚀 Features

* 📋 Fully functional BA Entry Control Board UI with drag-and-drop freetype areas
* 🧑‍🚒 Insert/remove tags per player with synced real-time status
* ⏱️ Dynamic Time To Whistle (TTW) and Time Of Whistle (TOW) calculation
* 🔁 Realtime ADSU/DSU alarm monitoring and flashing
* 🔊 Built-in audio alarms (evacuation tones, beeps)
* 🚨 EVAC system with acknowledge prompt
* 🧭 Supports **multiple BA boards** at once, each fully independent
* ✅ Works with `r_scba` (optional) and `ox_target`
* 🔌 Fully exportable for use with other scripts

***

### 📦 Dependencies

This script requires:

* [`ox_target`](https://overextended.dev/ox_target/)

We also recommend:

* BA Board 3D Model - Available on our store
* [`r_scba`](https://docs.rytrak.fr/scripts/firefighter-scba-system)

***

### 🧱 Installation

Follow instructions in [Getting Started](/rp-works-modding-docs/readme.md)

{% hint style="warning" %}
Ensure that the dependancies are started BEFORE this resource in server.cfg
{% endhint %}

***

### 🧩 Commands

| Command     | Description               |
| ----------- | ------------------------- |
| `/dsu`      | Triggers DSU alarm        |
| `/withdraw` | Triggers withdrawal alert |

> 🛑 All commands only work while wearing an SCBA (If integration enabled).

***

### 🎯 Interactions

The system uses `ox_target` to handle interactions with **placed board props**.

#### When looking at a board, options include:

* **Open BA Board** – View the UI
* **Insert Tag** – Insert your identity into the board
* **Remove Tag** – Only available on the board you've tagged into

***

### 📤 Exports

#### Client Exports

```lua
exports["DH_BABoard"]:IsTagInserted() -- Get whether client's tag is inserted (BOOL)
exports["DH_BABoard"]:GetCurrentBoardId() -- Get current netID of board open (int)
exports["DH_BABoard"]:GetTagBoardId() -- Get netID of board client has tag in (int)
exports["DH_BABoard"]:GetTTW() -- Get current client's time to whistle
exports["DH_BABoard"]:GetTOW() -- Get current client's time of whistle
```

#### Server Exports

```lua
exports["DH_BABoard"]:GetWearersForBoard(boardId) -- Get all wearers with tags in the board
exports["DH_BABoard"]:IsPlayerOnBoard(playerId)-- Does the player have their tag in? (Bool)
exports["DH_BABoard"]:GetBoardFromPlayer(playerId) -- Get the board netID the player has tag in
```

***

### ⚙️ Configuration

```lua
-- 🔧 Prop model used for the BA board
Config.BAPropModel = "prop_ba"  -- Change this if your server uses a custom model

-- 🚀 Enable or disable the spawn ba command 
--     (ANY prop matching the above prop will work, it doesn't need to be spawned 
--     by this script - Disable if using boot script or other spawning method)
Config.EnableSpawnCommand = true

-- Automatically detects if r_scba is active. Set to false to manually disable 
-- integration.
Config.UseSCBA = GetResourceState("r_scba") == "started"

-- 📡 Update frequency (in ms) for sending pressure/TTW updates
Config.UpdateInterval = 1000

-- ⏱️ Time (in seconds) a player must be stationary before ADSU alert triggers
Config.ADSU_TriggerTime = 28

-- 📢 Minimum pressure before whistle alarm (in bar)
Config.WhistlePressure = 50

-- 🧪 TTW Scaling Values
Config.StandardWorkingDuration = 30 -- minutes @ 300 bar
Config.HardWorkingDuration = 15     -- minutes @ 300 bar
```

***

### 💬 Credits

* **Developed by:** RP Works Modding
* **Targeting System:** [`ox_target`](https://overextended.dev/ox_target/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rp-works-modding.gitbook.io/rp-works-modding-docs/ba-board.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
