Jump to content

Recommended Posts

Posted

Overview

This AMX Mod X plugin provides a comprehensive gag system for Counter-Strike 1.6 servers. It automatically mutes players who use offensive language or advertisements, and allows admins to manually gag/ungag players.

Version: 1.1 (Modified)
Original Author: Cristi. C
Modified by: steams.ro
Requirements: AMX Mod X 1.8.2+, ColorChat, nVault


Features

๐Ÿ”‡ Auto-Gag System

  • Automatically detects and gags players using offensive words or advertisements
  • Customizable word list stored in gag_words.ini
  • Configurable auto-gag duration

๐Ÿ‘ฎ Admin Commands

  • Manual gag/ungag commands for administrators
  • Protection for admins (optional)
  • Configurable maximum gag duration

๐Ÿ”’ Restrictions When Gagged

  • Cannot use text chat (say, say_team)
  • Cannot use voice chat (voice speak)
  • Optional name tag prefix (Gag#)

๐Ÿ’พ Persistent Storage

  • Gag status saved using nVault
  • Players retain remaining gag time after disconnect/reconnect
  • Saves based on IP address

๐Ÿ“ข Notifications

  • Colored chat messages for all gag/ungag events
  • Custom sound effects
  • Detailed logging to GagLog.log

Installation

  1. Copy Files:

    • Place the .sma file in addons/amxmodx/scripting/
    • Place the .amxx file in addons/amxmodx/plugins/
  2. Add to plugins.ini:

    special_admin_gag.amxx
    
  3. Create Word List:

    • Create gag_words.ini in addons/amxmodx/configs/
    • Add one offensive word per line
    • Lines starting with # are comments
  4. Add Sound Files (Optional):

    • Place sound files in sound/misc/ directory:
      • gagged.wav - played when gagged
      • ungagged.wav - played when ungagged
  5. Restart Server or type amx_reloadsound in console


Configuration (CVARs)

Add these to your amxx.cfg file:

// Auto-gag duration in minutes when triggered by bad words
amx_autogag_time 3

// Maximum gag duration limit in minutes
amx_gag_minute_limit 300

// Time conversion (minutes to seconds) - don't change unless needed
amx_gag_minute_in_seconds 60

// Add name tag when gagged (1 = yes, 0 = no)
// IMPORTANT: Setting to 0 is recommended to avoid name persistence issues
amx_gag_tagname 0

// Allow gagging admins (1 = yes, 0 = no)
amx_admingag 0

// Maximum number of words to load from gag_words.ini
amx_maxwords 200

// Chat tag prefix for plugin messages
amx_gagtag "*"

CVAR Details

CVAR Default Description
amx_autogag_time 3 Minutes of gag for auto-gag trigger
amx_gag_minute_limit 300 Maximum minutes admins can set
amx_gag_minute_in_seconds 60 Conversion rate (usually 60)
amx_gag_tagname 1 Add "Gag#" prefix to player name (โš ๏ธ See limitations)
amx_admingag 0 Allow gagging administrators
amx_maxwords 200 Max words in filter list
amx_gagtag * Tag shown in chat messages

โš ๏ธ Note about amx_gag_tagname:

  • When enabled (1), adds "Gag#" prefix to gagged player names
  • Known Issue: Players will keep this prefix after disconnect due to CS 1.6 saving names locally
  • Recommendation: Set to 0 (disabled) on most servers to avoid this issue
  • The plugin will still show gag status through chat messages

Commands

Console Commands (amx_)

Gag a player:

amx_gag <name> <minutes> [reason]
  • <name> - Player name or part of name
  • <minutes> - Duration in minutes (max: amx_gag_minute_limit)
  • [reason] - Optional reason (for logging)

Ungag a player:

amx_ungag <name>
  • <name> - Player name or part of name

Chat Commands (/)

Gag a player:

/gag <name> <minutes>

Ungag a player:

/ungag <name>

Required Access

All commands require ADMIN_KICK flag by default. This can be changed in the source code:

#define COMMAND_ACCESS ADMIN_KICK

Word Filter Setup

Create addons/amxmodx/configs/gag_words.ini:

# Offensive Words List
# One word per line
# Lines starting with # are comments

fuck
shit
bitch
asshole
# Add advertisements
discord.gg
free skins
hack download

Notes:

  • Word matching is case-insensitive
  • Partial matches trigger the filter (e.g., "fuck" matches "fucking")
  • Be careful with common words to avoid false positives

How It Works

Auto-Gag Flow

  1. Player types a message in chat
  2. Plugin checks message against gag_words.ini
  3. If match found:
    • Player is gagged for amx_autogag_time minutes
    • Name tag added (if enabled)
    • Voice chat disabled
    • Notification sent to all players
    • Event logged to GagLog.log

Manual Gag Flow

  1. Admin uses amx_gag or /gag command
  2. Plugin validates:
    • Target exists
    • Target not already gagged
    • Duration within limits
    • Admin permissions (if target is admin)
  3. Gag applied with same restrictions as auto-gag

Ungag Flow

  1. Admin uses amx_ungag or /ungag command
  2. Plugin validates target has gag
  3. Gag removed:
    • Original name restored (if tag was added)
    • Voice chat re-enabled
    • Notification sent

Auto-Ungag (Time Expiration)

  1. Timer checks every second
  2. For each gagged player:
    • Decrements remaining time
    • When time reaches 0:
      • Auto-ungag applied
      • Notification sent
      • Event logged

Persistence

On Disconnect:

  • Current gag status saved to nVault
  • Saves: gagged status, remaining time, original name

On Connect:

  • Loads saved gag data from nVault
  • If gag still active:
    • Applies restrictions
    • Shows remaining time
    • Restores name tag

File Structure

cstrike/
โ”œโ”€โ”€ addons/
โ”‚   โ””โ”€โ”€ amxmodx/
โ”‚       โ”œโ”€โ”€ configs/
โ”‚       โ”‚   โ””โ”€โ”€ gag_words.ini          # Offensive words list
โ”‚       โ”œโ”€โ”€ data/
โ”‚       โ”‚   โ””โ”€โ”€ vault/
โ”‚       โ”‚       โ””โ”€โ”€ GagSystem.vault     # Persistent storage
โ”‚       โ”œโ”€โ”€ logs/
โ”‚       โ”‚   โ””โ”€โ”€ GagLog.log             # Plugin log file
โ”‚       โ”œโ”€โ”€ plugins/
โ”‚       โ”‚   โ””โ”€โ”€ special_admin_gag.amxx # Compiled plugin
โ”‚       โ””โ”€โ”€ scripting/
โ”‚           โ””โ”€โ”€ special_admin_gag.sma  # Source code
โ””โ”€โ”€ sound/
    โ””โ”€โ”€ misc/
        โ”œโ”€โ”€ gagged.wav                # Gagged sound
        โ””โ”€โ”€ ungagged.wav               # Ungagged sound

Logging

All events are logged to addons/amxmodx/logs/GagLog.log:

Log Entry Types:

[AUTOGAG] - Player auto-gagged by filter
[GAG] - Admin manually gagged player
[UNGAG] - Admin manually ungagged player
[AUTOUNGAG] - Gag expired automatically
[EXIT] - Gagged player disconnected

Example Log Entries:

[AUTOGAG]<PlayerName><192.168.1.1><STEAM_ID> got AutoGag for swearing or advertising!
[GAG]AdminName gagged <PlayerName><192.168.1.1><STEAM_ID> for <30> minutes
[UNGAG]<AdminName> ungagged <PlayerName><192.168.1.1><STEAM_ID>
[AUTOUNGAG]<PlayerName> received AutoUnGag!
[EXIT]Gagged player <PlayerName><192.168.1.1><STEAM_ID> has disconnected!

Troubleshooting

Problem: Gag not persisting after disconnect

Solution: Check that nVault is working:

  • Verify addons/amxmodx/data/vault/GagSystem.vault exists
  • Check file permissions (should be writable)
  • Review error logs in addons/amxmodx/logs/

Problem: Words not being filtered

Solution:

  • Verify gag_words.ini exists in correct location
  • Check amx_maxwords cvar isn't too low
  • Ensure words don't have extra spaces or special characters
  • Check server logs for loading errors

Problem: Name tag stays after player disconnects

Explanation: This is a CS 1.6 limitation, not a bug:

  • When the plugin changes a player's name, CS 1.6 immediately saves it to the client's config.cfg
  • The plugin cannot modify files on the player's computer
  • When they disconnect, they keep the "Gag#" prefix in their saved name

Solutions:

  • Best: Set amx_gag_tagname 0 to disable name changing entirely
  • Alternative: Players must manually change their name using console: name "YourName"
  • Most professional servers don't use name tags for this reason

Problem: Admin can't gag other admins

Solution: Set amx_admingag 1 to allow admin gagging

Problem: Commands not working

Solution:

  • Verify admin has ADMIN_KICK flag
  • Check users.ini for proper admin setup
  • Ensure plugin is loaded (amx_plugins in console)

API Information

Storage Format

Data is stored in nVault with format:

Key: <IP>-Gag
Value: <gagged_status>#<remaining_minutes>#<original_name>

Example: 192.168.1.1-Gag โ†’ 1#15#PlayerName

Hook Points

The plugin registers these hooks:

  • say - Chat message monitoring
  • say_team - Team chat monitoring
  • Custom think entity for timer

Permissions

Default Access Level

  • ADMIN_KICK - Required for all gag/ungag commands

Modify Access Level

Edit source code and recompile:

#define COMMAND_ACCESS ADMIN_BAN  // Change to desired flag

Common flags:

  • ADMIN_KICK (d) - Kick/ban access
  • ADMIN_BAN (e) - Permanent ban
  • ADMIN_SLAY (f) - Slay/harm players
  • ADMIN_RCON (l) - RCON access

Known Limitations

  1. IP-Based Storage: Gags are tied to IP addresses, not SteamID

    • Players with dynamic IPs may evade gags
    • VPN users can bypass
  2. Name Changes (Tag Feature):

    • When amx_gag_tagname 1 is enabled, the "Gag#" prefix is added to player names
    • IMPORTANT: When a gagged player disconnects, they will keep the "Gag#" prefix in their saved name
    • This is a CS 1.6 limitation - the client saves the name to config.cfg immediately when changed
    • The plugin cannot modify files on the client's computer
    • Workaround: Players must manually change their name after reconnecting, or set amx_gag_tagname 0 to disable this feature
    • Recommendation: Most servers disable name tags (amx_gag_tagname 0) and rely on chat messages instead
  3. Voice Chat: Requires voice to be enabled on server

  4. Performance: Large word lists (>500 words) may impact performance


Future Enhancements

Possible improvements for future versions:

  • [ ] SteamID-based storage instead of IP
  • [ ] Regex support for word patterns
  • [ ] Web interface for word list management
  • [ ] Statistics tracking (total gags, top offenders)
  • [ ] Different gag levels (chat only, voice only, both)
  • [ ] Temporary gag warnings before auto-gag
  • [ ] Ban after X auto-gags

Support & Credits

Original Author: Cristi. C
Modified by: steams.ro
Modifications:

  • Fixed critical save/load bugs
  • Improved persistence system
  • Enhanced error handling
  • English translation
  • Code optimization

For support, issues, or suggestions:

  • Check AlliedModders forums
  • Review AMX Mod X documentation
  • Consult server logs for errors
  • Visit steams.ro for updates

License

This plugin is provided as-is for Counter-Strike 1.6 servers running AMX Mod X. Free to use and modify for your server needs.


Changelog

Version 1.1 (Modified by steams.ro)

  • โœ… Fixed save function calling wrong player ID in CommandGag/CommandUngag
  • โœ… Fixed name copying using proper copy() function instead of direct assignment
  • โœ… Fixed register_plugin() to use VERSION constant and AUTHOR
  • โœ… Added proper persistence on reconnect with full state restoration
  • โœ… Improved LoadGagedPlayers to restore voice restrictions and name tags
  • โœ… Added auto-ungag name restoration in Forward_GagThinker
  • โœ… Added variable reset on disconnect/connect to prevent conflicts
  • โœ… Improved error handling and code structure
  • โœ… Translated all messages, comments, and documentation to English
  • โœ… Optimized storage format to include original name

Version 1.0 (Original by Cristi. C)

  • Initial release
  • Auto-gag system
  • Manual gag/ungag commands
  • nVault persistence
  • Chat and voice restrictions

ย 

amx_gag.amxx amx_gag.sma

sound.zip

×
×
  • Create New...