AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What line to use in order to block only domain name ? (https://forums.alliedmods.net/showthread.php?t=189659)

deviss 07-09-2012 16:52

What line to use in order to block only domain name ?
 
Hello

According to this plugin http://forums.alliedmods.net/showthr...=17363&page=35, i'm trying to block names that comes to blabla.com , blabla.ru , www.domain.com , etc

I am using this line \b[\w\.]+\.(com|ro|ru|info|eu||biznet|org)\b

The problem is that it blocks any name that has a . (dot) For example i have name [H.K.] test > this name will be changed and it shouldn't

It should block only and only names that have .com , ru, etc as a domain/subdomain name

guipatinador 07-09-2012 19:31

Re: What line to use in order to block only domain name ?
 
you use restrict names only for that?
you can use this if you want

Spoiler
untested but should work.

edit1: dont work lol.

containi version,

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define ADMIN_LEVEL ADMIN_BAN // change the admin level if you want

public plugin_init()
{
    
register_plugin("block domain name""1.0""guipatinador")
    
register_forward(FM_ClientUserInfoChanged"forward_client_userinfochanged")
}

public 
forward_client_userinfochanged(id)
{
    if(
is_user_connected(id) || !(get_user_flags(id) & ADMIN_LEVEL))
    {
        new 
name[32]
        
get_user_name(idnamecharsmax(name))
        
        if((
containi(name,".com") != -1) ||
        (
containi(name,".ro") != -1) ||
        (
containi(name,".ru") != -1) ||
        (
containi(name,".info") != -1) ||
        (
containi(name,".eu") != -1) ||
        (
containi(name,".biznet") != -1) ||
        (
containi(name,".org") != -1))
            
        
server_cmd("kick #%d ^"Nickname not allowed here.^""get_user_userid(id))
    }
    return 
PLUGIN_CONTINUE



Emp` 07-09-2012 19:44

Re: What line to use in order to block only domain name ?
 
Quote:

Originally Posted by guipatinador (Post 1746992)
you use restrict names only for that?
you can use this if you want

PHP Code:

public forward_client_userinfochanged(id)
{
    if(
is_user_connected(id) || !(get_user_flags(id) & ADMIN_LEVEL))
    {
        new 
name[32]
        
get_user_name(idnamecharsmax(name))
        
        if(
TrieKeyExists(domainname))
            
server_cmd("kick #%d ^"Nickname not allowed here.^""get_user_userid(id))
    }
    return 
PLUGIN_CONTINUE


untested but should work.

That will only check if their name is ".com", ".ro", etc.

@deviss: You might get more help looking on a RegEx forum; unless an advanced scripter that has experience with RegEx (*cough* Exolent *cough*) cares to help out.

fysiks 07-09-2012 23:45

Re: What line to use in order to block only domain name ?
 
I think you have a typo in there. Also, I would probably just avoid the word boundary pattern (I'm not even sure if it's supported).

Code:

[\w\.]+\.(com|ro|ru|info|eu|biznet|org)
If this doesn't work then I suggest that you try things with Exolent's RegEx Tester plugin. Start with the most simple pattern and start adding things to it. E.g. Try it with just a single extension (.com, etc) and see if you can get it to match correctly without giving an incorrect match (like you mentioned above.

deviss 07-10-2012 06:52

Re: What line to use in order to block only domain name ?
 
As i've said, the line i've posted works fine but for example if there is someone named Hescom , his nickname will be changed because it contains in his name, at the end "com" while the line should block only the .com at the end of the name, it ignores the .com , Also if some name contains just the "." it will also change it.

I've tried looking for a simple plugin that would change the nicknames but it's kinda stupid to use two plugins for the same things.

Atm i'm using RegEx to rename names that have less than 2 chars, more than 26 and those named Player. Still trying to find the solution for .com at the and

@fisiks, what would be the difference of your posted line?


Btw, thanks for trying to help guys. appreciated

jimaway 07-10-2012 07:00

Re: What line to use in order to block only domain name ?
 
[a-zA-Z0-9.-]+\.(com|ro|ru|info|eu|biznet|org)

deviss 07-10-2012 07:35

fysiks line seems to work fine, thanks a lot!

jimaway, thank you for your reply as well.


MERGE EDIT 1:
Sorry for bumping this but seems some players still are renamed and they don't have a .com at the end of the name

For example Bro MCrank jr. this name is renamed and it shouldn't be ...


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

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