# Flash Notifier
CS2 plugin that tells players in chat when they flash someone, or get flashed themselves.
```
You flashed PlayerName for 2.5s
PlayerName flashed you for 2.5s
```
## Features
- **Attacker notification** - "You flashed PlayerName for 2.5s" when you blind someone
- **Victim notification** - "PlayerName flashed you for 2.5s" when you get blinded
- **Team-coloured names** - the other player's name takes their team's colour
- **Fully configurable messages** - text, colours and placeholders
- **Minimum duration filter** - ignore the tiny partial flashes nobody cares about
- **Team-flash-only mode** - optionally notify only when a teammate is blinded
- **Lightweight** - one event hook, no timers, no database, nothing per tick
## Requirements
[CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp/releases) (API version 227 or
newer). Nothing else.
## Installation
1. Copy the `FlashNotifier` folder into `addons/counterstrikesharp/plugins/`, so you end up with
`addons/counterstrikesharp/plugins/FlashNotifier/FlashNotifier.dll`.
CounterStrikeSharp only loads a plugin from a folder named after its dll - the file on its own in
`plugins/` is ignored.
2. Restart the server, or run `css_plugins load FlashNotifier`.
3. The config is generated at
`addons/counterstrikesharp/configs/plugins/FlashNotifier/FlashNotifier.json`.
## Configuration
```json
{
"NotifyAttacker": true,
"NotifyVictim": true,
"AttackerMessage": "{GREEN}You flashed {TEAM}{VICTIM}{GREEN} for {YELLOW}{DURATION}s",
"VictimMessage": "{TEAM}{ATTACKER}{DEFAULT} flashed you for {YELLOW}{DURATION}s",
"MinDuration": 0.5,
"DurationDecimals": 1,
"NotifyTeamFlashOnly": false,
"ConfigVersion": 1
}
```
| Option | Default | Description |
|--------|---------|-------------|
| `NotifyAttacker` | `true` | Send a message to the player who threw the flash |
| `NotifyVictim` | `true` | Send a message to the player who got blinded |
| `AttackerMessage` | see above | The line the attacker sees |
| `VictimMessage` | see above | The line the victim sees |
| `MinDuration` | `0.5` | Minimum blind duration, in seconds, worth reporting. Negative values are treated as `0`. |
| `DurationDecimals` | `1` | Decimal places for the duration (`1` = 2.5s, `2` = 2.50s). Clamped to 0-3. |
| `NotifyTeamFlashOnly` | `false` | Only notify when the blinded player is a teammate |
Self-flashes are never reported - you already know.
## Placeholders
| Placeholder | Replaced with |
|-------------|---------------|
| `{ATTACKER}` | Name of the player who threw the flash |
| `{VICTIM}` | Name of the player who got blinded |
| `{DURATION}` | Blind duration in seconds |
| `{TEAM}` | Team colour of **the other player** - the victim in `AttackerMessage`, the attacker in `VictimMessage` |
| `{ATTACKERTEAM}` | Team colour of the attacker, whichever message it is used in |
| `{VICTIMTEAM}` | Team colour of the victim, whichever message it is used in |
Team colours are orange for T and blue for CT. A player who is not on a team gets the default
colour.
Player names are stripped of control characters before they go into the line, so a name cannot
recolour your chat or break it across lines.
## Colour codes
| Code | Colour |
|------|--------|
| `{DEFAULT}` / `{WHITE}` | White |
| `{DARKRED}` | Dark red |
| `{RED}` | Red |
| `{LIGHTRED}` | Light red |
| `{GREEN}` | Green |
| `{LIME}` | Lime |
| `{OLIVE}` / `{LIGHTGREEN}` | Olive |
| `{YELLOW}` / `{LIGHTYELLOW}` | Yellow |
| `{GOLD}` / `{ORANGE}` | Gold / orange |
| `{SILVER}` / `{BLUEGREY}` | Silver |
| `{GREY}` / `{GRAY}` | Grey |
| `{BLUE}` / `{LIGHTBLUE}` | Blue |
| `{DARKBLUE}` | Dark blue |
| `{PURPLE}` / `{MAGENTA}` | Purple |
| `{LIGHTPURPLE}` | Light purple |
Some names share a row because the game itself gives them the same colour - they are kept as
aliases so existing configs keep working.
## Message examples
Show only the duration:
```json
"VictimMessage": "{YELLOW}{DURATION}s{DEFAULT} flash from {TEAM}{ATTACKER}"
```
Minimalist:
```json
"AttackerMessage": "{GREEN}Flash hit {TEAM}{VICTIM}",
"VictimMessage": "{RED}Flashed by {TEAM}{ATTACKER}"
```
Both names in one line, each in its own team colour:
```json
"VictimMessage": "{ATTACKERTEAM}{ATTACKER}{DEFAULT} flashed {VICTIMTEAM}{VICTIM}{DEFAULT} for {YELLOW}{DURATION}s"
```
## What is in the archive
```
addons/counterstrikesharp/plugins/FlashNotifier/
FlashNotifier.dll the plugin
FlashNotifier.deps.json dependency manifest - keep it next to the dll
README.md this file
```
CounterStrikeSharp's own assemblies are deliberately not included; the server already has them and
a second copy only risks a version clash.
## Changelog
### 1.1.0
- **Fixed the colour codes.** Several tokens produced a different colour than their name promised -
`{RED}` was dark red, `{PURPLE}` was light purple, `{GREY}` was silver, `{LIGHTBLUE}` was dark
blue and `{DARKBLUE}` was not a colour at all. They now resolve through CounterStrikeSharp's own
constants, so they follow the game rather than a hard-coded byte.
- **Fixed team colours.** T names came out purple instead of orange.
- **Fixed `{TEAM}`.** It always used the attacker's colour, so in `AttackerMessage` the victim's
name was painted with the attacker's team colour. It now follows the name it sits next to, and
`{ATTACKERTEAM}` / `{VICTIMTEAM}` were added for full control.
- **Flashes involving bots are reported again.** Previously a bot anywhere in the pair silenced the
message for the human as well.
- **`DurationDecimals` is clamped** to 0-3. A value like `-1` used to throw on every flash.
- Player names are sanitised before being placed in a message.
- New colour tokens: `{DARKRED}`, `{LIGHTRED}`, `{OLIVE}`, `{GOLD}`, `{SILVER}`, `{BLUEGREY}`,
`{LIGHTPURPLE}`, `{MAGENTA}`, `{LIGHTYELLOW}`, `{GRAY}`.
### 1.0.0
- First release.
## Author
**illusion @ CodeStrike**
## License
All rights reserved.