Raised This Month: $32 Target: $400
 8% 

block symbols


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
giumbalau
Member
Join Date: Jan 2021
Old 05-08-2021 , 16:28   block symbols
Reply With Quote #1

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


Last edited by giumbalau; 05-08-2021 at 16:29.
giumbalau is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2021 , 17:24   Re: block symbols
Reply With Quote #2

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?
__________________

Last edited by fysiks; 05-08-2021 at 17:27.
fysiks is offline
giumbalau
Member
Join Date: Jan 2021
Old 05-08-2021 , 18:38   Re: block symbols
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
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
giumbalau is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2021 , 18:49   Re: block symbols
Reply With Quote #4

Quote:
Originally Posted by giumbalau View Post
The only thing is that i want to restrict .ro and .com domains but without blocking imgur links and war gods
It sounds like you need a more complex plugin to do that properly. I.e. you need to probably one with regex (pattern matching).
__________________
fysiks is offline
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
giumbalau
Member
Join Date: Jan 2021
Old 05-08-2021 , 19:57   Re: block symbols
Reply With Quote #6

Quote:
Originally Posted by Napoleon_be View Post
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
giumbalau 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 19:53.


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