Raised This Month: $51 Target: $400
 12% 

Solved Hiding commands in public chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
asw32
Junior Member
Join Date: Apr 2017
Old 04-11-2017 , 22:42   Hiding commands in public chat
Reply With Quote #1

Hello,

In CS 1.6 AMXX How do I go about making it so that when people type the following commands in my server, the commands are only shown to that player, not the whole server. Also, I don't want the command to show up as having been typed.

So:

If a player types "thetime" or "/rank" I do not want the command to publicly show up in the server. I only want them to see the return from that command. I don't want other players to see "thetime".

I want to do this for thetime, /rank, /top15, /hp, /nextmap, and /timeleft.

Any help would be appreciated. I saw posts from searching about using PUBLIC_HANDLED and stuff like that, but I couldn't figure out what file to put that in or where to put it.

Thanks in advance.

Last edited by asw32; 04-13-2017 at 19:55.
asw32 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-12-2017 , 00:53   Re: Hiding commands in public chat
Reply With Quote #2

Code:
register_clcmd("say", "cmdSay")

Code:
public cmdSay(id) {     new szWords[20]     read_argv(1, szWords, charsmax(szWords))     remove_quotes (szWords)     if(equal(szWords, "thetime"))     {          client_print(id, print_chat, szWords)          return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }

I think the original plugin that uses thetime will be affected. If it be, then you need to add the client_print() in the code of your nextmap plugin.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-12-2017 at 00:59.
EFFx is offline
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 - 1022 views - 812 Bytes)

Last edited by LegacyCode; 04-12-2017 at 04:56.
LegacyCode is offline
asw32
Junior Member
Join Date: Apr 2017
Old 04-12-2017 , 19:09   Re: Hiding commands in public chat
Reply With Quote #4

Quote:
Originally Posted by LegacyCode View Post
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
Thanks so much for your effort. And thank you to the other poster as well.

Using yours, Legacy, it works in that it doesn't display the command being said. But for example, when someone types "thetime", it still displays the time to everyone in the server. I want it to only show up to the person who typed it. How would that be done? Also, instead of "/nextmap" and "/timeleft" I need it to work for "nextmap" and "timeleft" instead.
asw32 is offline
asw32
Junior Member
Join Date: Apr 2017
Old 04-12-2017 , 19:42   Re: Hiding commands in public chat
Reply With Quote #5

Nevermind, I figured out how to do /nextmap and /timeleft myself, I just read yours and edited accordingly.

Anyone know how to make it so thetime, nextmap, timeleft only display the result to the typer?
asw32 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-12-2017 , 21:47   Re: Hiding commands in public chat
Reply With Quote #6

Quote:
Originally Posted by asw32 View Post
Anyone know how to make it so thetime, nextmap, timeleft only display the result to the typer?
You'll need to edit those plugins.
__________________
fysiks is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-12-2017 , 22:00   Re: Hiding commands in public chat
Reply With Quote #7

Add on client_print or whatever prints the message, id instead of 0.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-12-2017 at 22:01.
EFFx is offline
asw32
Junior Member
Join Date: Apr 2017
Old 04-13-2017 , 00:38   Re: Hiding commands in public chat
Reply With Quote #8

Where do I add that on? I'm trying to learn how to do some of this stuff, I'm not real good at it. Where should I look to add on client_print? And what does that do?
asw32 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-13-2017 , 09:26   Re: Hiding commands in public chat
Reply With Quote #9

Quote:
Originally Posted by asw32 View Post
Where do I add that on? I'm trying to learn how to do some of this stuff, I'm not real good at it. Where should I look to add on client_print? And what does that do?
You won't add anything. You need to edit the plugin that produces the message and change the print statement to send it only to the person who typed the command. That is often a client_print() with a 0 and often the variable for the player who used the command is id (this is not always the case, you just have to look at the code to see what the variable names are).
__________________
fysiks is offline
asw32
Junior Member
Join Date: Apr 2017
Old 04-13-2017 , 19:55   Re: Hiding commands in public chat
Reply With Quote #10

thanks everyone, really appreciate it
asw32 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 12:41.


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