**Admin Chat Prefix** is a professional and lightweight SourceMod plugin that adds configurable colored prefixes to player chat messages based on their admin flags. Each rank displays a unique tag before the player's name in chat, making it easy to identify staff members and VIPs at a glance.
### Chat Preview
```
*DEAD* [OWNER] PlayerName: Hello everyone!
[ADMIN] AdminName: Welcome to the server!
[VIP] VipPlayer: Thanks for the VIP!
[PLAYER] RegularPlayer: Hey guys!
```
---
## ✨ Features
- 🎨 **Colored Prefixes** — Full color support for prefix, name, and message with 19 built-in color tags
- 🔑 **Flag-Based Assignment** — Each prefix is tied to a SourceMod admin flag (a-z)
- 🌍 **Wildcard Support** — Use `*` flag to assign a default prefix to all players (e.g. `[PLAYER]`)
- ⚡ **Live Reload** — Reload configuration in-game with `sm_reloadprefixes`
- 🔁 **Auto-Refresh** — Prefixes update automatically when admin flags change via `sm_reloadadmins`
- 📋 **Priority System** — First match wins; order entries from highest to lowest rank
- 💀 **Dead/Team Indicators** — Automatically shows `*DEAD*` and team tags `(Terrorist)` / `(Counter-Terrorist)`
- 📝 **Auto-Config** — Default configuration file is created automatically on first run
- 🔄 **Late-Load Safe** — Plugin works correctly even when loaded mid-game
---
## 📦 Installation
1. Copy `admin_prefix.smx` to:
```
csgo/addons/sourcemod/plugins/
```
2. Copy `admin_prefix.cfg` to:
```
csgo/addons/sourcemod/configs/
```
3. Restart the server or load the plugin manually:
```
sm plugins load admin_prefix
```
> **Note:** If the config file is missing, the plugin will automatically generate a default one on startup.
---
## ⚙️ Configuration
Edit the configuration file located at:
```
csgo/addons/sourcemod/configs/admin_prefix.cfg
```
| Field | Description |
|---|---|
| `flag` | SourceMod admin flag character (`a`-`z`) or `*` for all players |
| `prefix` | The tag text shown in chat (e.g. `[OWNER]`) |
| `prefix_color` | Color of the prefix tag |
| `name_color` | Color of the player's name |
| `msg_color` | Color of the chat message text |
### Priority
Entries are matched **top to bottom** — the first matching flag wins. Always place higher ranks at the top and the `*` wildcard entry at the **bottom** as a fallback.
---
## 🎨 Available Colors
| Color Tag | Color |
|---|---|
| `{default}` | White (default) |
| `{white}` | White |
| `{darkred}` | Dark Red |
| `{teamcolor}` | Team Color (CT Blue / T Gold) |
| `{green}` | Green |
| `{olive}` | Olive |
| `{lime}` | Lime |
| `{red}` | Red |
| `{blue}` | Dark Blue |
| `{lightblue}` | Light Blue |
| `{darkblue}` | Dark Blue |
| `{purple}` | Purple |
| `{magenta}` | Purple |
| `{orange}` | Orange |
| `{yellow}` | Yellow |
| `{gold}` | Orange |
| `{grey}` | Grey |
| `{cyan}` | Light Blue |
| `{pink}` | Purple |
> **Note:** Some colors share the same CS:GO engine color code (e.g. `{purple}`, `{magenta}`, `{pink}` all display as purple). This is a CS:GO engine limitation.
**Q: Can I add more ranks?**
A: Yes! Simply add a new numbered entry in the config file with the desired flag and colors, then use `sm_reloadprefixes`.
**Q: A player has multiple flags. Which prefix do they get?**
A: The first matching entry in the config (top to bottom). Arrange your entries from highest to lowest priority.
**Q: Does the plugin modify team/all chat?**
A: Yes, it works with both `say` (all chat) and `say_team` (team chat).
**Q: Does it affect SourceMod commands like !rtv?**
A: No, messages starting with `!` or `/` are skipped and handled normally by SourceMod.
---
## 📜 Changelog
### v1.0.0
- Initial release
- Flag-based colored chat prefixes
- Wildcard `*` support for default player prefix
- In-game config reload command (`sm_reloadprefixes`)
- Auto-refresh prefixes on `sm_reloadadmins`
- Auto-generated default configuration
- 19 built-in color tags using native CS:GO single-byte color codes