Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
deviss
Member
Join Date: Feb 2011
Old 07-09-2012 , 16:52   What line to use in order to block only domain name ?
Reply With Quote #1

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
deviss is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 07-09-2012 , 19:31   Re: What line to use in order to block only domain name ?
Reply With Quote #2

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


Last edited by guipatinador; 07-09-2012 at 20:06.
guipatinador is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 07-09-2012 , 19:44   Re: What line to use in order to block only domain name ?
Reply With Quote #3

Quote:
Originally Posted by guipatinador View Post
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.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-09-2012 , 23:45   Re: What line to use in order to block only domain name ?
Reply With Quote #4

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.
__________________
fysiks is offline
deviss
Member
Join Date: Feb 2011
Old 07-10-2012 , 06:52   Re: What line to use in order to block only domain name ?
Reply With Quote #5

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

Last edited by deviss; 07-10-2012 at 06:53.
deviss is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 07-10-2012 , 07:00   Re: What line to use in order to block only domain name ?
Reply With Quote #6

[a-zA-Z0-9.-]+\.(com|ro|ru|info|eu|biznet|org)

Last edited by jimaway; 07-10-2012 at 07:14.
jimaway is offline
deviss
Member
Join Date: Feb 2011
Old 07-10-2012 , 07:35  
Reply With Quote #7

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 ...

Last edited by YamiKaitou; 07-11-2012 at 07:44. Reason: Merging posts, use the Edit button next time
deviss is offline
Reply



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 15:15.


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