Raised This Month: $ Target: $400
 0% 

[REQ] Block Commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Awesome_man
Senior Member
Join Date: May 2014
Location: singapore
Old 11-12-2014 , 02:20   [REQ] Block Commands
Reply With Quote #1

Can someone please make a plugin which should block these symbols ( % # )
Awesome_man is offline
popeye10
Senior Member
Join Date: May 2014
Location: Navi Mumbai (India)
Old 11-12-2014 , 07:02   Re: [REQ] Block Commands
Reply With Quote #2

Try this

PHP Code:
#include <amxmodx> 

new const gBlockTexts[][] = { 
    
".",
    
"%",
    
"#",
    
"@"
     
}; 

public 
plugin_init() { 
    
register_plugin("Block.""0.0.2""Exolent"); 
     
    
register_clcmd("say""CmdSay"); 
    
register_clcmd("say_team""CmdSay"); 


public 
CmdSay(id) { 
    new 
args[192]; 
    
read_args(argscharsmax(args)); 
    
remove_quotes(args); 
     
    for(new 
0sizeof(gBlockTexts); i++) { 
        if(
containi(argsgBlockTexts[i]) != -1) { 
            
client_print(id,print_chat"Your message cannot contain (.),(%),(#),(@)"
            return 
PLUGIN_HANDLED
        } 
    } 
     
    return 
PLUGIN_CONTINUE

__________________

Last edited by popeye10; 11-12-2014 at 07:04.
popeye10 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-12-2014 , 07:08   Re: [REQ] Block Commands
Reply With Quote #3

Quote:
Originally Posted by popeye10 View Post
Try this

PHP Code:
#include <amxmodx> 

new const gBlockTexts[][] = { 
    
".",
    
"%",
    
"#",
    
"@"
     
}; 

public 
plugin_init() { 
    
register_plugin("Block.""0.0.2""Exolent"); 
     
    
register_clcmd("say""CmdSay"); 
    
register_clcmd("say_team""CmdSay"); 


public 
CmdSay(id) { 
    new 
args[192]; 
    
read_args(argscharsmax(args)); 
    
remove_quotes(args); 
     
    for(new 
0sizeof(gBlockTexts); i++) { 
        if(
containi(argsgBlockTexts[i]) != -1) { 
            
client_print(id,print_chat"Your message cannot contain (.),(%),(#),(@)"
            return 
PLUGIN_HANDLED
        } 
    } 
     
    return 
PLUGIN_CONTINUE

He also needs it to be blocked at nickname.
__________________
Jhob94 is offline
Eagle07
Veteran Member
Join Date: May 2014
Location: Morocco :D
Old 11-12-2014 , 07:49   Re: [REQ] Block Commands
Reply With Quote #4

Quote:
Originally Posted by Jhob94 View Post
He also needs it to be blocked at nickname.
PHP Code:
#include <amxmodx>  

new const gBlockTexts[][] = {  
    
"."
    
"%"
    
"#"
    
"@" 
    
};  

public 
plugin_init() {  
    
register_plugin("Block.""0.0.2""Exolent");  
    
    
register_clcmd("say""CmdSay");  
    
register_clcmd("say_team""CmdSay");  
}  

public 
CmdSay(id) {  
    new 
args[192];  
    
read_args(argscharsmax(args));  
    
remove_quotes(args);  
    
    for(new 
0sizeof(gBlockTexts); i++) {  
        if(
containi(argsgBlockTexts[i]) != -1) {  
            
client_print(id,print_chat"Your message cannot contain (.),(%),(#),(@)")  
            return 
PLUGIN_HANDLED;  
        }  
    }  
    
    return 
PLUGIN_CONTINUE;  
}  
public 
client_connectid 

    static 
szName32 ]; 
    
get_user_nameidszNamecharsmaxszName ) ); 
    
    for(new 
0sizeof(gBlockTexts); i++) {  
        if(
containi(szNamegBlockTexts[i]) != -1) {  
            
server_cmd("kick #%d "get_user_userid(id))
        }  
    }  
    return 
PLUGIN_CONTINUE;  

__________________
Eagle07 is offline
Awesome_man
Senior Member
Join Date: May 2014
Location: singapore
Old 11-12-2014 , 09:08   Re: [REQ] Block Commands
Reply With Quote #5

Quote:
Originally Posted by Eagle07 View Post
PHP Code:
#include <amxmodx>  

new const gBlockTexts[][] = {  
    
"."
    
"%"
    
"#"
    
"@" 
    
};  

public 
plugin_init() {  
    
register_plugin("Block.""0.0.2""Exolent");  
    
    
register_clcmd("say""CmdSay");  
    
register_clcmd("say_team""CmdSay");  
}  

public 
CmdSay(id) {  
    new 
args[192];  
    
read_args(argscharsmax(args));  
    
remove_quotes(args);  
    
    for(new 
0sizeof(gBlockTexts); i++) {  
        if(
containi(argsgBlockTexts[i]) != -1) {  
            
client_print(id,print_chat"Your message cannot contain (.),(%),(#),(@)")  
            return 
PLUGIN_HANDLED;  
        }  
    }  
    
    return 
PLUGIN_CONTINUE;  
}  
public 
client_connectid 

    static 
szName32 ]; 
    
get_user_nameidszNamecharsmaxszName ) ); 
    
    for(new 
0sizeof(gBlockTexts); i++) {  
        if(
containi(szNamegBlockTexts[i]) != -1) {  
            
server_cmd("kick #%d "get_user_userid(id))
        }  
    }  
    return 
PLUGIN_CONTINUE;  

I want that "#" should be blocked from nick only if it come first in nick.. eg : #player not player# or pl#ayer

Last edited by Awesome_man; 11-12-2014 at 09:17.
Awesome_man is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-12-2014 , 11:18   Re: [REQ] Block Commands
Reply With Quote #6

Quote:
Originally Posted by Jhob94 View Post
He also needs it to be blocked at nickname.
Quote:
Originally Posted by Awesome_man View Post
I want that "#" should be blocked from nick only if it come first in nick.. eg : #player not player# or pl#ayer
Where in the original request was this mentioned? Next time, make sure your full request is documented in the first post
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-12-2014 , 11:33   Re: [REQ] Block Commands
Reply With Quote #7

Quote:
Originally Posted by YamiKaitou View Post
Where in the original request was this mentioned? Next time, make sure your full request is documented in the first post
He never said he wanted to block it from chat. He said he wants to block the character

Anyway, its useless to block only if is the first. You must block at all or it still being possible to crash the server. And i suggest you to kick the player if he has it on nick. If you have connect announce, it will still crash if you only replace it. It gets the name for the message before you can change player's name.
__________________
Jhob94 is offline
Awesome_man
Senior Member
Join Date: May 2014
Location: singapore
Old 11-13-2014 , 00:31   Re: [REQ] Block Commands
Reply With Quote #8

Quote:
Originally Posted by Jhob94 View Post
He never said he wanted to block it from chat. He said he wants to block the character

Anyway, its useless to block only if is the first. You must block at all or it still being possible to crash the server. And i suggest you to kick the player if he has it on nick. If you have connect announce, it will still crash if you only replace it. It gets the name for the message before you can change player's name.
So what is the protection to avoid crash ?
Awesome_man is offline
KaranMohadkar
Senior Member
Join Date: Oct 2012
Location: Reality !
Old 11-13-2014 , 04:05   Re: [REQ] Block Commands
Reply With Quote #9

Search the best fixes for these exploits are on forum already - > https://forums.alliedmods.net/showth...57#post2202157

%s ( is a issue only when you use admin_chat_colors or any chat color plugin )
__________________

Last edited by KaranMohadkar; 11-13-2014 at 04:10.
KaranMohadkar is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-13-2014 , 04:12   Re: [REQ] Block Commands
Reply With Quote #10

Quote:
Originally Posted by Awesome_man View Post
So what is the protection to avoid crash ?
This crash only happens when the message is sent by some plugin. This is something that amxx team should fix for the next build. Every print, like chat, hud, whatever that is sent and contains that characters, the player that receives the message gets crashed.
__________________
Jhob94 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 01:17.


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