## Features
- Menu-based ban system
- SQL database integration for ban storage
- Support for permanent and temporary bans
- Custom and predefined ban reasons
- Multi-language support
- Advanced admin hierarchy system
- Disconnect ban tracking
- Ban history tracking
- Web integration capabilities
## Requirements
- AMX Mod X 1.8.2 or higher
- MySQL database
- Metamod
## Installation
### 1. File Setup
1. Copy the following files to their respective directories:
- `scripting/DiveBanX.sma` → `addons/amxmodx/scripting/`
- `plugins/DiveBanX.amxx` → `addons/amxmodx/plugins/`
- `configs/diveban.cfg` → `addons/amxmodx/configs/`
- Language files from `lang/` → `addons/amxmodx/data/lang/`
### 2. Database Setup
1. Configure database connection in `diveban.cfg`:
```
// Database Configuration
db_host "localhost"
db_user "your_username"
db_pass "your_password"
db_name "your_database"
db_table "divebanx_bans"
```
3. The plugin will automatically create all necessary tables in the database upon first run.
### 3. Plugin Configuration
1. Edit `configs/diveban.cfg` to set up:
- Admin access levels
- Ban durations
- Custom ban reasons
- Web integration settings (if used)
- Console message formats
## Usage
### Admin Commands
- Access the ban menu: `amx_banmenu` or say `/amx`
- Direct ban command: `amx_ban <time> <player> <reason>`
- Unban command: `amx_unban <steamid/ip>`
- Clear bans: `amx_clear`
- Offline ban command: `amx_addban <time> <player> <reason>`
- Disconnect menu: `amx_disconnect_menu`
### Ban Menu System
1. **Main Menu**
- Lists all players currently on the server
- Shows player status and admin level indicators
2. **Reason Menu**
- Predefined reasons from configuration
- Option for custom reason (higher admin levels only)
3. **Duration Menu**
- Configurable time periods
- Permanent ban option
- Custom duration option (higher admin levels only)
4. **Confirmation Menu**
- Shows selected player
- Displays chosen reason and duration
- Options to modify selections
- Final ban confirmation
### Admin Levels
- Main Admin (Level 8): Full access to all features
- Sub Admin (Level 7): Limited access to custom reasons/durations
- Regular Admin (Level 6): Basic ban menu access
## Ban Types
The plugin supports multiple identification methods for banning players:
1. **Steam ID**
- Bans based on player's Steam ID
- Most reliable method for Steam players
- Format: STEAM_0:X:XXXXXX
2. **IP Address**
- Bans based on player's IP address
- Effective for non-Steam servers
- Can affect multiple players if they share the same IP
3. **Nickname**
- Bans based on player's name
- Less secure as players can easily change names
- Useful for temporary bans
4. **Cookie**
- Uses browser cookies to track banned players
- Effective for web-based integrations
- Can be bypassed by clearing browser data
5. **UID (Unique ID)**
- Server-specific unique identifier
- More reliable than IP or nickname
- Persists across sessions
6. **DiveID**
- Unique identifier generated by the plugin
- Combines multiple identification methods
- Most comprehensive ban method
7. **CD Key**
- Uses player's CD Key for identification
- Specific to games using CD Key authentication
- Very reliable for supported games
The plugin can use multiple identification methods simultaneously for more effective banning. Admins can select which methods to use when applying a ban through the menu system.
## Changelog
### Modified Version 2024.1 Information
#### Command System Improvements
- Standardized all commands to use the `amx_` prefix instead of `db_` for better consistency with AMX Mod X conventions
- Fixed command handling for `amx_ban` to prevent accidental bans:
- Added proper argument validation
- Added usage instructions when command is used incorrectly
- Added better error messages for invalid time formats
- Command now requires all parameters: `amx_ban <time> <player> <reason>`
#### Code Modernization
- Updated deprecated function calls to their modern equivalents:
- Replaced `strbreak()` with `argbreak()` for better string parsing
- Updated `md5()` to `hash_string(Hash_Md5, ...)` for improved hashing
- Changed `client_disconnect()` to `client_disconnected()` for better event handling
- Fixed sound precaching system to properly handle cvar values
#### Documentation
- Updated all command references in documentation to reflect new `amx_` prefix
- Added detailed command usage examples
- Improved error message descriptions
#### Bug Fixes
- Fixed an issue where `amx_ban` without arguments would ban a random player
- Fixed sound precaching error in plugin initialization
- Corrected command registration to properly handle admin access levels
- Improved error handling for invalid ban time formats