Raised This Month: $ Target: $400
 0% 

Restrict Names 1.2a


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Server Management        Approver:   EKS (166)
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 08-30-2005 , 13:33   Restrict Names 1.2a
Reply With Quote #1

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:
  • fun
  • regex
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
  • None.
Attached Files
File Type: sma Get Plugin or Get Source (restrictnames.sma - 22395 views - 13.3 KB)
File Type: txt restrictnames.txt (3.2 KB, 15924 views)
File Type: zip restrictnames.zip (595 Bytes, 16083 views)

Last edited by Brad; 09-12-2008 at 19:51. Reason: had to rpetty it up in case it got visitors
Brad is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 08-30-2005 , 13:34  
Reply With Quote #2

Credits

Idea for the plugin came from Anti-Bigot with RegEx Matching by Manip (updated by jtp10181).

Translations:Notes

Language Translations:

If you have a set of new translations or updates to existing translations, please post them in the sister thread to this one: Restrict Names (Translations)

Miscellaneous:
  • The regex phrases are looked at in the order that they are listed in the INI file. This means that if there's more than one regex phrase that the player's name can match, it'll only be caught by the first regex phrase. For example, if the first phrase happens to have a 'ban' punishment and the phrase you really want to have catch it is 'rename', the player will be banned.
  • The player names are forced to lowercase before being checked against the regex phrases so don't use uppercase characters as any part of the player name.
Change Log

[2005-09-30] v1.2a
  • Fixed compilation error that occurs on 1.01 and lower AMXX installations. Thanks to ohswildcats.
  • Added option to not check immune players for name violations. Thanks to Hawk552.
[2005-09-27] v1.2
  • Logs can automatically be deleted after a CVAR-defined number of months.
  • Fixed issue where players could disconnect before being punished. Players are now punished immediately and without warning.
[2005-09-06] v1.1
  • Will now ban when "restnames_amxban" is set to 1.
  • Separate log file is being created in the .\logs directory detailing punishments with more information than before. Punishments were previously being logged in the amxx log file.
  • Will not check name if the user is HLTV.
  • CVAR added to indicate whether to check bots for name violations.
  • Config file structure changed slightly to accomodate different ban lengths per regular expression.
    • <RegEx> <Reason> <PunishmentType> <PunishmentOption>
  • Removed CVARs "restnames_ban_time" and "restnames_default_name".
  • All RENAME punishments now have to have the new name provided as the "punishmentOption" segment in the config file. If not provided, the player will be kicked.
  • All BAN punishments now need to provide the ban length as the "punishmentOption" segment in the config file. If not provided, the ban is permanent.
[2005-08-30] v1.0
  • Initial release.

Last edited by Brad; 09-12-2008 at 19:52.
Brad is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-30-2005 , 13:37  
Reply With Quote #3

Nice plugin. I plan on using this. Good job.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 08-30-2005 , 14:39  
Reply With Quote #4

First I want to say good job but I have a suggestion:
Quote:
Originally Posted by Brad Jones
<RegEx> <Reason> <PunishmentType> <NewName>
Would be better if it were
Quote:
Originally Posted by Suicid3
<RegEx> <Reason> <PunishmentType> <PunishmentOption>
And its used differently for the different punishment options:
For rename: new name
For ban: minutes
For kick: Nothing

This would be better than having the ban minutes be a cvar because some names you might want a perm ban or others 10 minutes or others 1hour and so on. Tell me what you think
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 08-30-2005 , 16:15  
Reply With Quote #5

I thought about that Sui but never got around to implementing it (as I only ban permanently in regards to this plugin). I think it's a really good idea and I plan on doing it a bit later on. I definitely think it's a better way to handle it than how it's currently handled.
Brad is offline
Edgar
Member
Join Date: Jul 2005
Location: Germany
Old 08-30-2005 , 17:17  
Reply With Quote #6

Feature request:
cvar to ignore bots

Bug(?) report:
Quote:
Originally Posted by amxx.cfg
restnames_check_names 1
restnames_amxban 0
restnames_ban_time 999
Quote:
Originally Posted by restrictnames.ini
Player "banned" 2
Quote:
Originally Posted by amxx log
L 08/30/2005 - 22:04:24: [restrictnames.amxx] Player was renamed ('player' not allowed).
I removed my adminrights and joined the server with the nick "Player".
I just got renamed.
Edgar is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 08-30-2005 , 18:11  
Reply With Quote #7

Quote:
Originally Posted by Edgar
Feature request:
cvar to ignore bots
I *always* forget about the damn bots. Thanks for the head's up. I'll add it in for the next release.

Quote:
Originally Posted by Edgar
Bug(?) report:
Quote:
Originally Posted by amxx.cfg
restnames_check_names 1
restnames_amxban 0
restnames_ban_time 999
Quote:
Originally Posted by restrictnames.ini
Player "banned" 2
Quote:
Originally Posted by amxx log
L 08/30/2005 - 22:04:24: [restrictnames.amxx] Player was renamed ('player' not allowed).
I removed my adminrights and joined the server with the nick "Player".
I just got renamed.
Yeah, um... I can't duplicate this however I did find a different problem when testing it.

When I had restnames_amxban set to 1, it wouldn't ban me. <-- That's the bug I found.
When I had restnames_amxban set to 0, it did ban me as expected. <-- That's where I can't duplicate your problem.

Try using all lowercase letters for the constants defining the player name in your regex phrase (i.e. "player" instead of "Player") as the names all get converted to lowercase before being compared to the regex phrases. Also of note, if you just use "player" as your regex phrase, it will catch all of the following:
  • Player
  • (1)Player
  • I am the Greatest Player
  • StraightPlayerForReal
Is that what you want? If you only want examples of the first two things caught, you should use the regex phrase I provided in the file: ^(\(\d\))?player$

If, after converting the sample names in your regex phrases to lowercase, you are still having problems, send me your INI via private message and I'll see what I can uncover.
Brad is offline
Edgar
Member
Join Date: Jul 2005
Location: Germany
Old 08-31-2005 , 05:11  
Reply With Quote #8

Uhm my fault :/

I had your standart Player ( ^(\(\d\))?player\b ) and my player in the restrictnames.ini

If possible can you kick/ban the player as long as they try to connect?
I have this in my users.ini to get rid of these "Player" 's
"Player" "4jga89n6n4" "z" "a" ; Player
__________________
Edgar is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 08-31-2005 , 09:07  
Reply With Quote #9

Quote:
Originally Posted by Edgar
Uhm my fault :/
Not a problem as it allowed me to discover the other issue.

Quote:
Originally Posted by Edgar
I had your standart Player ( ^(\(\d\))?player\b ) and my player in the restrictnames.ini
So the original 'player' regex phrase was catching it before the 'player' regex phrase you added. I added a note to the 2nd post in this thread to make it clearer how it works in that respect.

Also, you should change the 'player' phrase from ^(\(\d\))?player\b to ^(\(\d\))?player$ . I've updated it in the download file. The original regex would catch "Player for Real". The new one correctly catches only 'player' or '(1)player' (where '1' is any single digit number).

Quote:
Originally Posted by Edgar
If possible can you kick/ban the player as long as they try to connect?
I have this in my users.ini to get rid of these "Player" 's
"Player" "4jga89n6n4" "z" "a" ; Player
I'm not sure what you mean. They will continue to be punished as per the punishment specified in the INI each time they connect with a restricted name.

If they change to an acceptable name, they won't get punished.

Are you asking for a different behavior?
Brad is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 09-03-2005 , 13:31  
Reply With Quote #10

Language file update. The new Dutch translation was kindly provided by proach and updated by B0oGeYm4n.
Brad is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode