Raised This Month: $ Target: $400
 0% 

Blocking symbols


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LuboRusev
Member
Join Date: May 2015
Location: Pleven, Bulgaria
Old 07-18-2015 , 12:43   Blocking symbols
Reply With Quote #1

Hi... How can I make the plugin so.. it doesn't show the message if it contains "," and "." ?? Here's the code:
PHP Code:
#include <amxmodx>
#include <amxmisc>

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

new const g_prefix[] = "[NoSymbolS]"

new const symbols[] =
{
",",
"."
}

public 
plugin_init()
{
register_plugin(PLUGINVERSIONAUTHOR)
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)
{
client_print_color(id,print_chat,"^4[ZP] ^1Your message cannot contain ^"^4,^1^" and ^"^4.^1^" symbols!",g_prefix)
return 
PLUGIN_HANDLED
}



return 
PLUGIN_CONTINUE

__________________
Виж понякога в 4:20.. понякога просто така.. Понякога с кафето и абсолютно винаги след храна
LuboRusev is offline
Send a message via Skype™ to LuboRusev
Decak
Senior Member
Join Date: Sep 2012
Old 07-18-2015 , 17:49   Re: Blocking symbols
Reply With Quote #2

Code:
charsmax(symbols)
-->

Code:
sizeof symbols
Decak is offline
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 07-18-2015 , 19:48   Re: Blocking symbols
Reply With Quote #3

PHP Code:
#include <amxmodx>

new g_szBlockedSymbols[][] = {
    
",",
    
"."
};

public 
plugin_init() {
    
register_clcmd("say""ClcmdSay");
    
register_clcmd("say_team""ClcmdSay");
}

public 
ClcmdSay(id) {
    new 
szArgs[32];
    
read_args(szArgs31);
    
remove_quotes(szArgs);

    for(new 
isizeof g_szBlockedSymbolsi++) {
        if(
strfind(szArgsg_szBlockedSymbols[i]) != -1) {
            
client_print_color(idprint_team_red"[ZP]^1 Your message cannot contain ^"^4,^1^" and ^"^4.^1^" symbols!");
            return 
1;
        }
    }
    return 
0;


Last edited by OnePL; 07-18-2015 at 19:49.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
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 20:48.


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