AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Don't say IPs (https://forums.alliedmods.net/showthread.php?t=9949)

AmineKyo 02-15-2012 08:06

Re: Don't say IPs
 
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 :D Please
And Thank You So Much :)

Astro 02-15-2012 11:06

Re: Don't say IPs
 
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 


guipatinador 06-18-2012 14:37

Re: Don't say IPs
 
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 



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

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