> For the complete documentation index, see [llms.txt](https://igris-script.gitbook.io/igris-script/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://igris-script.gitbook.io/igris-script/paid-script/igris-bankrobbery.md).

# Igris BankRobbery

<figure><img src="https://2862342791-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFnkzyjlqOP6UGw1GyN62%2Fuploads%2FzqyjPnzv196FXVfXNkBE%2Fbankr.png?alt=media&amp;token=71fef801-91b9-4d3a-a2b3-2ec2e7ab4109" alt=""><figcaption></figcaption></figure>

igris\_bankrobbery (v1.0.3) is a dynamite bank robbery for RedM VORP servers. Robbers plant dynamite on the vault, detonate it from a safe distance, then search the safe for cash while on-duty lawmen are alerted. 4 banks are configured: Blackwater, Saint Denis, Rhodes and Valentine.

| Requirement         | Status   | Notes                                                         |
| ------------------- | -------- | ------------------------------------------------------------- |
| RedM server         | Required |                                                               |
| vorp\_core          | Required | Characters, jobs, money, notifications                        |
| vorp\_inventory     | Required | Dynamite item                                                 |
| brew\_society       | Optional | Only needed when `Config.UseBrewSocietyDuty = true` (default) |
| chat                | Optional | Lawmen also get the alert in chat                             |
| Discord webhook URL | Optional | Robbery logs                                                  |

`config.lua` is left open (escrow\_ignore), so every setting and text can be edited. The rest of the code is protected by Tebex escrow.

### Installation

Installation takes about five minutes: copy the folder, import the dynamite item, set your law jobs and add the `ensure` line.

1. Download the resource from your Tebex / CFX Portal account (Keymaster → Granted Assets).
2. Place the `igris_bankrobbery` folder in your `resources` directory.
3. Import `item.sql` to add the `dynamite` item. Skip this step if your server already has a `dynamite` item.
4. Open `config.lua`:
5. Put your law job names in `Config.GuardJobs`.
6. Set `Config.UseBrewSocietyDuty` to `true` (Brew Society) or `false` (no duty system).
7. Paste your Discord webhook in `Config.Webhook`, or leave it empty to turn logs off.
8. Set `Config.CommandCoords = false` on a live server (it enables a `/coords` helper command).
9. Translate `Config.Text` if your server is not French.
10. Add the resource to your `server.cfg` after its dependencies:

```
ensure vorp_core
ensure vorp_inventory
ensure brew_society   # only if you use Brew Society duty
ensure igris_bankrobbery
```

6. Restart the server. The console prints `[igris_bankrobbery] Script créé par Igris Script` when the resource starts.
7. Test in game: have a lawman go on duty, take a dynamite, go to a bank vault and press E.

To test alone, set `Config.RequireGuardsOnDuty = false` temporarily.

### Brew Society duty integration

With Brew Society enabled, only lawmen who are on duty count toward the minimum guards and receive the robbery alert.

```lua
Config.UseBrewSocietyDuty = true          -- count and alert only on-duty lawmen
Config.RequireGuardsOnDuty = true         -- block robberies when too few lawmen are on duty
Config.MinimumGuardsOnDuty = 1            -- minimum on-duty lawmen to start a robbery
Config.AllowRobberyIfDutyExportFails = false
```

* The script reads duty through the `brew_society` export `getUserDuty(source)`, with `GetUserDuty` as a fallback. No edit to Brew Society is needed.
* The resource must be named exactly `brew_society` and be started before igris\_bankrobbery.
* `AllowRobberyIfDutyExportFails`: if Brew Society is stopped or its export fails, `false` counts nobody as on duty (robberies are blocked), and `true` counts every player with a guard job.
* Without Brew Society, set `UseBrewSocietyDuty = false`: every connected player with a job in `Config.GuardJobs` is counted and alerted.

### Gameplay

A robbery takes about a minute: plant, run, detonate, then search the safe for 10 seconds.

1. **Start**: stand within 2 m of a bank vault with a dynamite and press **E**. The server checks the cooldown, the number of on-duty lawmen and the dynamite, then removes 1 dynamite.
2. **Plant**: the robber plants the dynamite (5 s) and takes out a detonator.
3. **Detonate**: move at least 12 m away and press **E**. The dynamite explodes, a large smoke cloud rises for 2 minutes (visible to every player), and on-duty lawmen get a notification and a chat alert with the bank name.
4. **Search**: go back to the vault and press **E** to search the safe (10 s, player frozen).
5. **Reward**: the robber receives a random amount of cash between the bank's `rewardMin` and `rewardMax` (600 to 1000 $ by default).

The search is cancelled if the robber dies or moves away, and the robbery counts as failed. Either way, the bank then goes on cooldown (200 s by default).

### Configuration reference

All settings are in `config.lua`. Times are in milliseconds unless noted, distances in meters.

#### Robbery

| Setting                                          | Default                               | What it does                                                     |
| ------------------------------------------------ | ------------------------------------- | ---------------------------------------------------------------- |
| Config.ItemRequirement                           | `"dynamite"`                          | Item needed to start                                             |
| Config.RemoveItemOnStart                         | `true`                                | Removes 1 item when the robbery starts                           |
| Config.StartKey                                  | `0xCEFD9220` (E)                      | Key for every step                                               |
| Config.StartDistance / CollectDistance           | `2.0` / `2.0`                         | Distance to the vault to start and to search                     |
| Config.MinimumExplosionDistance                  | `12.0`                                | Distance required before detonating                              |
| Config.PlantTime / DetonatorTime / SearchTime    | `5000` / `3000` / `10000`             | Duration of each step                                            |
| Config.RobberyCooldown                           | `200`                                 | Cooldown per bank, in seconds                                    |
| Config.FreezeDuringSearch                        | `true`                                | Freezes the robber while searching                               |
| Config.CancelSearchIfDead / CancelSearchIfTooFar | `true` / `true`                       | Cancels the search                                               |
| Config.DynamiteProp / DetonatorProp              | `p_dynamite01x` / `p_cs_detonator01x` | Props used                                                       |
| Config.CommandCoords                             | `true`                                | `/coords` helper to find positions; set `false` on a live server |
| Config.Debug                                     | `false`                               | Debug prints                                                     |

#### Lawmen

| Setting                                    | Default                               | What it does                       |
| ------------------------------------------ | ------------------------------------- | ---------------------------------- |
| Config.GuardJobs                           | sheriflm, policelm, policewe, marshal | Jobs alerted and counted as guards |
| Config.RequireGuardsOnDuty                 | `true`                                | Requires lawmen on duty to start   |
| Config.MinimumGuardsOnDuty                 | `1`                                   | Minimum number of lawmen           |
| Config.GuardAlertDuration / NotifyDuration | `15000` / per type                    | Notification durations             |

#### Smoke

| Setting                         | Default                          | What it does                                         |
| ------------------------------- | -------------------------------- | ---------------------------------------------------- |
| Config.SmokeEnabled             | `true`                           | Smoke cloud after the explosion, visible to everyone |
| Config.SmokeDuration            | `120000`                         | 2 minutes                                            |
| Config.SmokeHeight / SmokeScale | `6.0` / `3.0`                    | Height and size of the cloud                         |
| Config.SmokeAsset / SmokeEffect | `core` / `ent_amb_smoke_factory` | Particle effect                                      |
| Config.SmokeOffsets             | 5 columns                        | Positions and scale of each smoke column             |

#### Banks

Each bank in `Config.Stores` has a name, the vault coordinates and a reward range. Add a bank by copying a block:

```lua
{
    name = "Armadillo Bank",
    x = 0.0, y = 0.0, z = 0.0,   -- vault position (use /coords)
    rewardMin = 400,
    rewardMax = 800
},
```

#### Discord logs and texts

* `Config.Webhook`, `Config.WebhookName`, `Config.WebhookColor`: the log shows the player, character, job, bank, coordinates and planned reward. Leave `Webhook` empty to turn logs off.
* `Config.Text`: every player, lawman and webhook text, in French by default. Replace the values to translate; keep `%s` where it appears (bank name, amount).

### Troubleshooting

| Problem                                             | Fix                                                                                                                                                 |
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| "Not enough sheriffs/marshals on duty"              | Lawmen must have a job from `Config.GuardJobs` and be on duty in Brew Society; or lower `MinimumGuardsOnDuty`, or set `RequireGuardsOnDuty = false` |
| Always "not enough guards" even with lawmen on duty | `brew_society` is not started or not named `brew_society`; start it before this script, or set `UseBrewSocietyDuty = false`                         |
| "You need dynamite"                                 | The player has no item named like `Config.ItemRequirement`; import `item.sql`                                                                       |
| No prompt at the bank                               | Stand within `StartDistance` of the vault coordinates in `Config.Stores`                                                                            |
| "You are still too close"                           | Move at least `MinimumExplosionDistance` (12 m) from the dynamite                                                                                   |
| "This bank is on cooldown"                          | Wait `RobberyCooldown` seconds after the last robbery of that bank                                                                                  |
| Lawmen get no alert                                 | Their job is not in `Config.GuardJobs`, or they are off duty                                                                                        |
| No smoke                                            | `SmokeEnabled = true`; keep the default `SmokeAsset` and `SmokeEffect`                                                                              |
| No Discord logs                                     | Valid URL in `Config.Webhook` instead of `url_webhooks`                                                                                             |

Still stuck? Set `Config.Debug = true`, reproduce the issue, and open a ticket on our Discord with the server and F8 console logs.
