Restrict Names 1.2a
This plugin will check a player's name when they enter the server and also if they change their name mid-game. It checks their name against a list of regex examples and if it matches any, the player will be punished as per the setting for that particular example (rename, kick, or ban).
The regex examples are kept in
.\configs\restrictnames.ini and I've included a sample file for you in the attached ZIP. The sample file is setup to rename players named 'player', players with too short a name (2 or fewer characters), and players with too long a name (over 26 characters), kick players with racist or homophobic terms in their name, and ban players that have 'japs', a variation of 'mygot', or 'game-deception' in their name (both japs and mygot are popular hacking clans while 'game-deception' is a name used in a hack with rapid name change).
Name violations are recorded within the
.\logs directory. One log file is created per month and is named in the format of
restrictnamesMM.log where "MM" is the two-digit month number. The CVAR
restnames_log_cnt can be used to set the number of log files to keep.
Installation
File Locations:- .\configs\restrictnames.ini
- .\data\lang\restrictnames.txt
- .\plugins\restrictnames.amxx
Required Modules:Configuration Files
restrictnames.ini (collection of regex phrases to restrict)
Each line has the following elements:
<RegEx> <Reason> <PunishmentType> <PunishmentOption>
- <RegEx>
It is the regex phrase that detects a restricted name.
<Reason>
It is the text that is displayed to the user to indicate why they're being punished.
<PunishmentType>
It is the method used to punish a player.- 0: rename to value specified by restnames_default_name CVar, or the custom name indicated as 'NewName'
1: kick the player
2: ban the player
<PunishmentOption>
It is only used if the punishment type is rename or ban. If 'punishmentType' is 0 (rename), punishmentOption must be the new name to give the player. If 'punishmentType' is 2 (ban), punishmentOption must be the ban length
Options (CVARS)
restnames_check_names <0|1>
Indicates if this plugin should check the names against the restriction list.
- 0: Do not check the names.
1: Check the names.
Default value is
1.
restnames_amxban <0|1>
Indicates method of banning players.
- 0: ban via 'banid'
1: ban via 'amx_ban' (use only if you have the amxbans plugin installed)
Default value is
0.
restnames_check_bots <0|1>
Indicates if this plugin should check the names of bots for violations.
- 0: Do not check the bots.
1: Check the names of bots.
Default value is
1.
restnames_log_cnt <0..11>
Specifies the number of previous month's logs to retain. The current month is always retained.
Default is 2 months.
restnames_immunity <0|1>
Indicates if players with the immunity flag are checked for name violations.
- 0: check everyone
1: check everyone except players with immunity flag
Default value is
0.
The immunity flag is set as
ADMIN_IMMUNITY by default but can be changed in the script.
Compiler Options
Most people will have no need for this section.
Near the top of the script, there is a set of compiler options that define how the script is compiled.
Code:
/*-----------------------------------------------------------
COMPILER OPTIONS
-----------------------------------------------------------*/
//-----------------------------------------------------------
// Set the flag that indicates if a player has immunity from
// name violation checking, when restnames_immunity is 1.
#define IMMUNITY ADMIN_IMMUNITY
//-----------------------------------------------------------
Known Issues