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 - 21487 views - 13.3 KB)
File Type: txt restrictnames.txt (3.2 KB, 15266 views)
File Type: zip restrictnames.zip (595 Bytes, 15404 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
AMD_Ryzen
New Member
Join Date: Jan 2021
Old 01-05-2021 , 05:03   Re: Restrict Names 1.2a
Reply With Quote #4

Quote:
Originally Posted by Hawk552 View Post
Nice plugin. I plan on using this. Good job.
Good afternoon, forum users. All with the coming holidays. I'm new here, I don't know all the rules of the forum yet, and I communicate through an online translator. So do not judge strictly)
Now let's move on to the topic of this Restrictnames plugin. I figured out how it prohibits login to the server and kicks certain nicknames. I also figured out bans and changing a nickname. But how to change the nickname for players with Russian symbols (nicknames), I did not understand
Tell me how to fill out the form in restrictnames.ini so that Russian letters are prohibited
Let's say a player with the nickname "Newbie" enters and his nickname changes to "Default_HuK"

(?i)^Newbie$ "name 'Newbie' cTaHDaPTHoe" 0 "Default_HuK"

And if a player comes in with Russian symbols, with a Russian nickname, for example, Александр, then what should the line look like?

If I do this ((? I) ^ Александр $ "name 'Александр' cTaHDaPTHoe" 0 "Default_HuK"), then nothing happens.
Write a ready-made line for restrictnames.ini that blocks all Russian characters
Thank you

Last edited by AMD_Ryzen; 01-05-2021 at 09:15.
AMD_Ryzen is offline
AMD_Ryzen
New Member
Join Date: Jan 2021
Old 05-09-2021 , 07:49   Re: Restrict Names 1.2a
Reply With Quote #5

Quote:
Originally Posted by AMD_Ryzen View Post
Good afternoon, forum users. All with the coming holidays. I'm new here, I don't know all the rules of the forum yet, and I communicate through an online translator. So do not judge strictly)
Now let's move on to the topic of this Restrictnames plugin. I figured out how it prohibits login to the server and kicks certain nicknames. I also figured out bans and changing a nickname. But how to change the nickname for players with Russian symbols (nicknames), I did not understand
Tell me how to fill out the form in restrictnames.ini so that Russian letters are prohibited
Let's say a player with the nickname "Newbie" enters and his nickname changes to "Default_HuK"

(?i)^Newbie$ "name 'Newbie' cTaHDaPTHoe" 0 "Default_HuK"

And if a player comes in with Russian symbols, with a Russian nickname, for example, Александр, then what should the line look like?

If I do this ((? I) ^ Александр $ "name 'Александр' cTaHDaPTHoe" 0 "Default_HuK"), then nothing happens.
Write a ready-made line for restrictnames.ini that blocks all Russian characters
Thank you
Still relevant. I'm waiting for help with my question
AMD_Ryzen is offline
drag1c
Junior Member
Join Date: Apr 2014
Location: Serbia, Nova Pazova
Old 11-27-2021 , 04:01   Re: Restrict Names 1.2a
Reply With Quote #6

(?i)\W*(brain damage)\W*

Could anyone explain me why this string does not work?
It should detect anyone with any type of case letter with this part inside nickname.
drag1c is offline
Send a message via Skype™ to drag1c
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-27-2021 , 14:20   Re: Restrict Names 1.2a
Reply With Quote #7

Quote:
Originally Posted by drag1c View Post
(?i)\W*(brain damage)\W*

Could anyone explain me why this string does not work?
It should detect anyone with any type of case letter with this part inside nickname.
You should provide examples (that you have actually tried) of what you expect should result in a match.

Why do you have parentheses around "brain damage"? Based on the very limited information provided, it doesn't seem like you would need those (but shouldn't prevent it from working).
__________________
fysiks is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 08-30-2005 , 14:39  
Reply With Quote #8

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 #9

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 #10

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
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 00:22.


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