Thread: block symbols
View Single Post
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-08-2021 , 19:34   Re: block symbols
Reply With Quote #5

try this, untested

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>

#define PLUGIN "Block symbols"
#define VERSION "1.0"
#define AUTHOR ""

new const g_prefix[] = "=[PROTECT]"

new const symbols[] =
{
    
"!",
    
"#",
    
"*",
    
"(",
    
")",
    
"-",
    
"_",
    
"+",
    
"=",
    
"{",
    
"}",
    
"[",
    
"]",
    
"|",
    
"\",
    "
/",
    "
:",
    "
;",
    "
,",
    "
~",
    "
`",
    "<",
    ">",
    "ï¼…s0 114",
    "%",
    "&"
}

new const g_szExceptions[] =
{
    ".com",
    ".ro",
    "imgur"
}

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say","handle_say")
    register_clcmd("say_team","handle_say")
}

public handle_say(id)
{
    new arg[256]
    read_args(arg,255)
    remove_quotes(arg)
    trim(arg)

    if(arg[0] =='^0' || !strlen(arg)) return PLUGIN_HANDLED

    for(new i=0;i<charsmax(symbols);i++) 
    {
        if(containi(arg,symbols[i]) != -1 && containi(arg, g_szExceptions[i]) != -1)
        {
            ColorChat(id,GREEN,"^x04%s^x03Your chat message can not contain ^4symbols^x03 or^x04 advertising words",g_prefix)
            return PLUGIN_HANDLED
        }
    }
    return PLUGIN_CONTINUE

__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be