Raised This Month: $51 Target: $400
 12% 

Don't say IPs


Post New Thread Reply   
 
Thread Tools Display Modes
AmineKyo
فوق سريرك
Join Date: Oct 2011
Location: Morocco
Old 02-15-2012 , 08:06   Re: Don't say IPs
Reply With Quote #71

Thanks But What I Mean It Was An Inc And I Want Ragex Module Thats All


And "Astro"
Ca You Give Me The Compiler For Linux Please
And Thank You So Much
__________________
AmineKyo is offline
Astro
Member
Join Date: Jul 2011
Old 02-15-2012 , 11:06   Re: Don't say IPs
Reply With Quote #72

PHP Code:
#define PATTERN "(?:(?:2\s*5\s*[0-5]|2\s*[0-4]\s*[0-9]|1\s*[0-9]\s*[0-9]|[1-9]?\s*[0-9])\s*\.\s*){3}(?:2\s*5\s*[0-5]|2\s*[0-4]\s*[0-9]|1\s*[0-9]\s*[0-9]|[1-9]?\s*[0-9])" 
will match 1 2 3 . 1 2 3 . 1 2 3 . 1 2 3, 123.123.123.123, 1 23. 12 3 . 1 2 3 .1 23 etc.

Eventually you could use my editted version. It checks say and say_team (the original plugin doesn't), blocks the message completely and prints informational message in green to spammer only.

PHP Code:
/*
Copyleft 2005
Plugin topic: http://www.amxmodx.org/forums/viewtopic.php?p=90172


Don't say IPs
=============
Messages like "hey join my server 213.34.231.23" are automatically blocked... and another message is printed instead. :-P
Or, you can choose to just ban violators by setting cvar ip_banviolators to 1 and ip_banminutes to how many minutes the violator should be banned. 0 is permanent, 5 is default.

/JGHG


VERSIONS
========
050204    0.1    First version


CREDITS
=======
Requested by lord_inuyasha88.
*/

#include <amxmodx>
#include <regex>

#define PLUGINNAME    "Don't say IPs"
#define VERSION        "0.1"
#define AUTHOR        "JGHG"
#define PATTERN                "(?:(?:2\s*5\s*[0-5]|2\s*[0-4]\s*[0-9]|1\s*[0-9]\s*[0-9]|[1-9]?\s*[0-9])\s*\.\s*){3}(?:2\s*5\s*[0-5]|2\s*[0-4]\s*[0-9]|1\s*[0-9]\s*[0-9]|[1-9]?\s*[0-9])"

//#define PRINTTOALL
#define MESSAGE "[DIP] Your message contained IP address and was blocked."

// Variables
new iResultRegex:hPatterniReturnValueszError[64], szAllArgs[1024],  iSayTextszMessage[256];

#if defined PRINTTOALL
new iCount 1iPlayers[32]
#endif

public plugin_modules() 

    
require_module("regex");
}

public 
hook_say(idlevelcid
{
    
read_args(szAllArgs1023);
    
    
iResult regex_match_c(szAllArgshPatterniReturnValue);
    
    switch (
iResult
    {
    case 
REGEX_MATCH_FAIL
        {
            
log_amx("REGEX_MATCH_FAIL! %s"szError);
            return 
PLUGIN_CONTINUE;
        }
    case 
REGEX_PATTERN_FAIL
        {
            
log_amx("REGEX_PATTERN_FAIL! %s"szError);
            return 
PLUGIN_CONTINUE;
        }
    case 
REGEX_NO_MATCH
        {
            return 
PLUGIN_CONTINUE;
        }
    default: 
        {
            
szMessage[0] = 0x04;
            
format(szMessage[1], 251MESSAGE);
            
szMessage[192] = '^0';
            
#if defined PRINTTOALL
            
get_players(iPlayersiCount"ch");
            
            for (new 
0iCounti++)
            {
                if (
is_user_connected(iPlayers[i]))
                {
                    
message_begin(MSG_ONE_UNRELIABLEiSayText_iPlayers[i]);
                    
write_byte(iPlayers[i]);
                    
write_string(szMessage);
                    
message_end();
                }
            }
#else
            
message_begin(MSG_ONEiSayText_id);
            
write_byte(id);
            
write_string(szMessage);
            
message_end();
#endif
            
            
return PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
plugin_init() 
{
    
register_plugin(PLUGINNAMEVERSIONAUTHOR);
    
    
register_clcmd("say""hook_say");
    
register_clcmd("say_team""hook_say");
    
    
register_dictionary("admincmd.txt");
    
    
iSayText get_user_msgid("SayText");
    
    
hPattern regex_compile(PATTERNiReturnValueszError63"i");
}

public 
plugin_end() {
    
regex_free(hPattern);   

EDIT:
Quote:
Originally Posted by Danidude
Hey can u edit ur pluin in which the message is shown to everyone?
PHP Code:
//Find and uncomment PRINTTOALL = remove // before
#define PRINTTOALL 

Last edited by Astro; 06-02-2012 at 07:54. Reason: Posted my version of the plugin.
Astro is offline
Old 05-24-2012, 17:34
Moh Es
This message has been deleted by Exolent[jNr]. Reason: Advertising server.
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 06-18-2012 , 14:37   Re: Don't say IPs
Reply With Quote #73

Astro i think you should add admin immunity

PHP Code:
/*
Copyleft 2005
Plugin topic: http://www.amxmodx.org/forums/viewtopic.php?p=90172


Don't say IPs
=============
Messages like "hey join my server 213.34.231.23" are automatically blocked... and another message is printed instead. :-P
Or, you can choose to just ban violators by setting cvar ip_banviolators to 1 and ip_banminutes to how many minutes the violator should be banned. 0 is permanent, 5 is default.

/JGHG


VERSIONS
========
050204    0.1    First version


CREDITS
=======
Requested by lord_inuyasha88.
*/

#include <amxmodx>
#include <regex>

#define PLUGINNAME    "Don't say IPs"
#define VERSION        "0.1"
#define AUTHOR        "JGHG"

#define PATTERN                "(?:(?:2\s*5\s*[0-5]|2\s*[0-4]\s*[0-9]|1\s*[0-9]\s*[0-9]|[1-9]?\s*[0-9])\s*\.\s*){3}(?:2\s*5\s*[0-5]|2\s*[0-4]\s*[0-9]|1\s*[0-9]\s*[0-9]|[1-9]?\s*[0-9])"

//#define PRINTTOALL
#define MESSAGE "[DIP] Your message contained IP address and was blocked."

#define ADMINLEVEL ADMIN_IMMUNITY // change this if you want. More info http://www.amxmodx.org/funcwiki.php?go=module&id=1

// Variables
new iResultRegex:hPatterniReturnValueszError[64], szAllArgs[1024],  iSayTextszMessage[256];

#if defined PRINTTOALL
new iCount 1iPlayers[32]
#endif

public plugin_modules() 

    
require_module("regex");
}

public 
hook_say(idlevelcid
{
    if(!(
get_user_flags(id) & ADMINLEVEL))
    {
        
read_args(szAllArgs1023);
        
        
iResult regex_match_c(szAllArgshPatterniReturnValue);
        
        switch (
iResult
        {
            case 
REGEX_MATCH_FAIL
            {
                
log_amx("REGEX_MATCH_FAIL! %s"szError);
                return 
PLUGIN_CONTINUE;
            }
            case 
REGEX_PATTERN_FAIL
            {
                
log_amx("REGEX_PATTERN_FAIL! %s"szError);
                return 
PLUGIN_CONTINUE;
            }
            case 
REGEX_NO_MATCH
            {
                return 
PLUGIN_CONTINUE;
            }
            default:{
                
szMessage[0] = 0x04;
                
format(szMessage[1], 251MESSAGE);
                
szMessage[192] = '^0';
                
                
#if defined PRINTTOALL
                
get_players(iPlayersiCount"ch");
                
                for (new 
0iCounti++)
                {
                    if (
is_user_connected(iPlayers[i]))
                    {
                        
message_begin(MSG_ONE_UNRELIABLEiSayText_iPlayers[i]);
                        
write_byte(iPlayers[i]);
                        
write_string(szMessage);
                        
message_end();
                    }
                }
                
#else
                
message_begin(MSG_ONEiSayText_id);
                
write_byte(id);
                
write_string(szMessage);
                
message_end();
                
#endif
                
                
return PLUGIN_HANDLED;
            }
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
plugin_init() 
{
    
register_plugin(PLUGINNAMEVERSIONAUTHOR);
    
    
register_clcmd("say""hook_say");
    
register_clcmd("say_team""hook_say");
    
    
register_dictionary("admincmd.txt");
    
    
iSayText get_user_msgid("SayText");
    
    
hPattern regex_compile(PATTERNiReturnValueszError63"i");
}

public 
plugin_end() {
    
regex_free(hPattern);   

You can change admin level here:
PHP Code:
#define ADMINLEVEL ADMIN_IMMUNITY 
__________________
PM for help = ignore

Last edited by guipatinador; 06-18-2012 at 16:46.
guipatinador 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 13:43.


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