Raised This Month: $32 Target: $400
 8% 

Restrict Names 1.2a


Post New Thread Reply   
 
Thread Tools Display Modes
alecsoviki
Junior Member
Join Date: May 2012
Location: Germany
Old 02-25-2016 , 06:40   Re: Restrict Names 1.2a
Reply With Quote #361

Quote:
Originally Posted by fysiks View Post
This plugin is for restricting names; nothing to do with chat.

Normaly PD ! Du scriben aber du nicht verstein....

That messages from chat, like:

"L 02/25/2016 - 130:12: Dauibineicap - D was renamed because "-""

Last edited by alecsoviki; 02-25-2016 at 06:42.
alecsoviki is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-17-2018 , 15:22   Re: Restrict Names 1.2a
Reply With Quote #362

Quote:
Originally Posted by Brad View Post
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.

@Brad, firstable i liked the plugin but i couldnt understand how can i add the nicks to the .ini file?

For example i have a blacklist and could you please show me how can i add these? I couldnt understand regex logic. And where can i find text to regex converter?

No Name ^ . ^
Hades Underwold ; CS
Ccash ! Ccomedy
[Anti]'Biyotik

And i have a question can plugin detect nicks with spaces (gap) between them like above?

Last edited by hasanalizxc; 05-17-2018 at 22:01.
hasanalizxc is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-19-2018 , 15:34   Re: Restrict Names 1.2a
Reply With Quote #363

You can search the internet for RegEx basics (look for perl-compatible regular expressions "PCRE" and you can ignore the information about flags in the pattern). Then, simply test things out.

For example, "hello\s*world" will match the name with any number of spaces between 'hello' and 'world' (including no spaces).

If a name includes one of the following characters you need to escape it with a backslash:
Code:
.[{}()\*+?|^$
Also, according to the plugin instructions, all characters should be lowercase.

Your examples would be something like this:

Code:
"no name \^ \. \^"
"hades underwold ; cs"
"ccash ! ccomedy"
"\[anti\]'biyotik"
__________________

Last edited by fysiks; 05-20-2018 at 22:15. Reason: Updated control character list
fysiks is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-19-2018 , 18:49   Re: Restrict Names 1.2a
Reply With Quote #364

Quote:
Originally Posted by fysiks View Post
You can search the internet for RegEx basics (look for perl-compatible regular expressions "PCRE" and you can ignore the information about flags in the pattern). Then, simply test things out.

For example, "hello\s*world" will match the name with any number of spaces between 'hello' and 'world' (including no spaces).

If a name includes a RegEx control character (e.g. '[' ']' '(' ')' '.' '^' \ etc) you need to escape it with a backslash. Also, according to the plugin instructions, all regular characters should be lowercase.

Your examples would be something like this:

Code:
"no name \^ \. \^"
"hades underwold ; cs"
"ccash ! ccomedy"
"\[anti\]'biyotik"
you are telling good thanks but do you know any website plain text to regex converter (i really need it)? because regex logic is too complex for me. you will tell me "why this is so hard?" because sometimes i encounter with too sophisticated nicks with diffent (varied) special characters.
hasanalizxc is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-19-2018 , 22:51   Re: Restrict Names 1.2a
Reply With Quote #365

Quote:
Originally Posted by hasanalizxc View Post
do you know any website plain text to regex converter (i really need it)?
If you want to match a literal string, you simply need to escape the control characters (like in my examples above).

Quote:
Originally Posted by hasanalizxc View Post
because regex logic is too complex for me. you will tell me "why this is so hard?"
Just try some things out and test them. I often use Notepad++ search to test my regular expressions.

Quote:
Originally Posted by hasanalizxc View Post
because sometimes i encounter with too sophisticated nicks with diffent (varied) special characters.
And that's why RegEx is so useful here. You'll need to learn and practive RegEx to be able to do any special name matching.
__________________
fysiks is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-20-2018 , 08:48   Re: Restrict Names 1.2a
Reply With Quote #366

Quote:
Originally Posted by fysiks View Post
If you want to match a literal string, you simply need to escape the control characters (like in my examples above).



Just try some things out and test them. I often use Notepad++ search to test my regular expressions.



And that's why RegEx is so useful here. You'll need to learn and practive RegEx to be able to do any special name matching.
i installed this plugin in my server. i tested it and it works. this time it is changing players'nicks and makes them "name had console key". i removed the plugin for this reason. why is it making this?
hasanalizxc is offline
Mordekay
Squirrel of Fortune
Join Date: Apr 2006
Location: Germany
Old 05-20-2018 , 09:35   Re: Restrict Names 1.2a
Reply With Quote #367

Read the restrictnames.ini
Code:
[`~] "console key not allowed" 0 "Name had Console Key"
Remove or comment out this line if you don't want this.
__________________

Mordekay is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-20-2018 , 10:47   Re: Restrict Names 1.2a
Reply With Quote #368

Quote:
Originally Posted by fysiks View Post

If a name includes a RegEx control character (e.g. '[' ']' '(' ')' '.' '^' \ etc) you need to escape it with a backslash. Also, according to the plugin instructions, all regular characters should be lowercase.

[/code]
Could you please write me RegEx all control characters list? i couldnt find. and i will add my blacklist here. i am requesting from you could you please convert to regex for me? And i will change the next nicknames by looking at the examples that you have made.

Thanks for your interest.

eXe.KinG' Abuzer
الاحسن cN
TAYYIP ERDOGAN
KEMAL ATATURK
IYI | ' Naim ONGUNYURT TV
IYI | ' Naim ONGUNYURT TV.
DeVLeT BaHCeLi*
ANDREI RUBLEV
I WANT SUCK YOUR LIP :*
ZING ZING ZING
ToNeRCi Dayi
GirlPower # CanSu
ExeLanCe ' BAFANA -YRD-
SON ANNE BUKUCU
Ne Dediysek o
HAKANN.BOZKURT ;;
Rnope Wurat III
PASIF GAY #GOTTEN VEREN
DalyaROCK ;
Dalyarock
ANASINI SIKTIREN OC
SiKeRleR---OC----SENI---
$$BraZZerS$$
Andre~
Yapma!
DREAMW!NK.
'EDiBESE'
Sergeant|Eren
Adam_bro74
`Asuman`[hs].
n3tRoX~ ` Shaqqy*
- <kg> onLy KASIMPASALI *
~La PoRTe^^
aim] ~ poLuex =)

Last edited by hasanalizxc; 05-20-2018 at 20:43.
hasanalizxc is offline
hasanalizxc
Senior Member
Join Date: May 2018
Old 05-20-2018 , 10:48   Re: Restrict Names 1.2a
Reply With Quote #369

Quote:
Originally Posted by Mordekay View Post
Read the restrictnames.ini
Code:
[`~] "console key not allowed" 0 "Name had Console Key"
Remove or comment out this line if you don't want this.
Thank you so much. i appreciate.
hasanalizxc is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-20-2018 , 22:12   Re: Restrict Names 1.2a
Reply With Quote #370

Quote:
Originally Posted by hasanalizxc View Post
Could you please write me RegEx all control characters list? i couldnt find.
I do it based on my memory and I just try it in Notepad++ to see if it works. I updated my original post to include another of the control characters that I forgot to list.

Quote:
Originally Posted by hasanalizxc View Post
and i will add my blacklist here. i am requesting from you could you please convert to regex for me? And i will change the next nicknames by looking at the examples that you have made.
No, I will not do it for you. It's not that hard. It's simple and I've already told you how to do it.

Once you get them working like this, you can modify them to account for variable spaces and other variations.
__________________

Last edited by fysiks; 05-20-2018 at 22:19.
fysiks 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 08:31.


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