---
description: >-
  A fully featured, standalone flashbang system for FiveM with realistic
  effects, AI interaction, and 3D audio support.
---

# Flashbang

### 🚀 Features

* 💥 Custom addon flashbang weapon with 0-damage frag explosion
* 💥 Single flashbang or multi-banger (9-banger) support
* 👁️ Configurable masks dampen the effects (like gas masks or sunglasses)
* 🎧 Full 3D positional audio using native GTA explosions
* 👁️ LOS and directional detection — players only get blinded if they _see_ the detonation
* 🧠 Realistic flash effects: whiteout, blurred vision, drunk movement, and ear ringing
* 🧍‍♂️ NPCs react with panic, ragdoll, and flee behavior
* 🎮 Easy-to-use exports for full integration with other scripts
* ⚙️ Fully configurable via `config.lua`
* 📦 Flashbang 3D model and custom add-on weapon included

***

### 🧱 Installation

Follow instructions in [Getting Started](readme)

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

***

### 🎯 How It Works

* Players throw the flashbang (addon weapon).
* After a realistic cook time (configurable), the grenade explodes with a **visual and audio effect**.
* Nearby players are:
  * **Fully flashed** if they were looking at it and had line of sight.
  * **Partially disoriented** if they were nearby but not looking directly.
  * **Unaffected** if behind solid cover.
* NPCs are stunned or flee if within range and have line of sight.

***

### 📤 Exports

#### Client Exports

<table><thead><tr><th width="499">Export</th><th>Description</th></tr></thead><tbody><tr><td><pre class="language-lua"><code class="lang-lua"><strong>exports["RPW_Flashbang"]:TriggerFlashEffect(coords)
</strong></code></pre></td><td>Applies flash effect on the local player</td></tr><tr><td><pre class="language-lua"><code class="lang-lua"><strong>exports["RPW_Flashbang"]:IsPlayerFlashed()
</strong></code></pre></td><td>Returns <code>true</code> if the player is currently flashed</td></tr><tr><td><pre class="language-lua"><code class="lang-lua"><strong>exports["RPW_Flashbang"]:DetonateFlashbang(coords)
</strong></code></pre></td><td>Triggers a flashbang effect manually</td></tr><tr><td><pre class="language-lua"><code class="lang-lua"><strong>exports["RPW_Flashbang"]:GetFlashbangConfig()
</strong></code></pre></td><td>Returns the current flashbang config table</td></tr></tbody></table>

***

### ⚙️ Configuration

```lua
Config = {
    FlashbangRadius = 15.0,        -- Max distance for full effect
    StunDuration = 5000,           -- Time the player is disoriented
    CookTime = 2000,               -- Time from throw to detonation
    FlashAffectsNPCs = true,       -- Enable AI reactions
    FlashIntensity = 1.0           -- from 0.1 (light) to 1.0 (full)
}

Config.AntiFlashMasks = {
    [36] = true, -- example: ID of mask model
    [52] = true, -- add as many as you need!
}

Config.MaskProtectionStrength = 'partial' -- options: 'none', 'partial', 'full'

Config.MultiFlashbang = {
    enabled = true -- Whether this should be a nine-banger or a single flash/bang
}
```

***

### 🔊 Custom Audio

To use custom audio for the flashbang, find your chosen .mp3 file and replace flashbang.mp3 within the html/ folder
