AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   block symbols (https://forums.alliedmods.net/showthread.php?t=332380)

giumbalau 05-08-2021 16:28

block symbols
 
Can anyone add the white list function to this plugin please ?
like white_list.ini

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",
"%",
"&"
}
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)
{
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



fysiks 05-08-2021 17:24

Re: block symbols
 
Adding a while list to a black list plugin doesn't make any sense. Simply remove the ones you don't want to be blacklisted.

If that's doesn't address the question, you need to explain what you want a plugin to do?

giumbalau 05-08-2021 18:38

Re: block symbols
 
Quote:

Originally Posted by fysiks (Post 2746313)
Adding a while list to a black list plugin doesn't make any sense. Simply remove the ones you don't want to be blacklisted.

If that's doesn't address the question, you need to explain what you want a plugin to do?

The only thing is that i want to restrict .ro and .com domains but without blocking imgur links and war gods :cry:

fysiks 05-08-2021 18:49

Re: block symbols
 
Quote:

Originally Posted by giumbalau (Post 2746315)
The only thing is that i want to restrict .ro and .com domains but without blocking imgur links and war gods :cry:

It sounds like you need a more complex plugin to do that properly. I.e. you need to probably one with regex (pattern matching).

Napoleon_be 05-08-2021 19:34

Re: block symbols
 
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



giumbalau 05-08-2021 19:57

Re: block symbols
 
Quote:

Originally Posted by Napoleon_be (Post 2746317)
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



Thank you :) thank you very much


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

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