View Single Post
LegacyCode
Member
Join Date: Apr 2017
Old 04-12-2017 , 04:53   Re: Hiding commands in public chat
Reply With Quote #3

Try this:

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin"ChatCmdBlocker""0.1""LegacyCode" )

    
register_clcmd"say""handleBlockCmdOutput" )
    
register_clcmd"say_team""handleBlockCmdOutput" )
}

public 
handleBlockCmdOutputid )
{
    new const 
a_ChatCommands[][] =
    {
        
"thetime",
        
"/rank",
        
"/top15",
        
"/hp",
        
"/nextmap",
        
"/timeleft"
    
}

    new 
s_Message[192], s_ChatCmd[16]
    
read_argss_Messagecharsmaxs_Message ) )
    
remove_quotess_Message )
    
trims_Message )

    if ( !
s_Message[0] || !is_user_connectedid ) )
        return 
PLUGIN_HANDLED

    copyc
s_ChatCmdcharsmaxs_ChatCmd ), s_Message' ' )

    for ( new 
isizeof a_ChatCommandsi++ )
    {
        if ( 
equalis_ChatCmda_ChatCommands[i] ) )
            return 
PLUGIN_HANDLED
    
}

    return 
PLUGIN_CONTINUE

Place it at the very start of the "Custom" section in plugins.ini:

Code:
; Custom - Add 3rd party plugins here
block_chat.amxx
...
I hope this is a good attempt at the problem, I'm new to this.
Let me know if it works!

- LegacyCode
Attached Files
File Type: sma Get Plugin or Get Source (block_chat.sma - 1021 views - 812 Bytes)

Last edited by LegacyCode; 04-12-2017 at 04:56.
LegacyCode is offline