AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blocking a command from appearing in chat (https://forums.alliedmods.net/showthread.php?t=245896)

EpicKiller 08-08-2014 11:02

Blocking a command from appearing in chat
 
Hi. I know that there is at least one topic regarding this subject, I've seen it a while ago, but I really can't find it now.

So, how can I block a chat text from appearing? I know it's something about getting the user's input, then returning PLUGIN_HANDLED, but I really can't remember how to get his chat input.

PreDominance 08-08-2014 11:05

Re: Blocking a command from appearing in chat
 
Well, every time a user wants to say something he has to run the command "say". Register the clcmd "say", and take it from there.

That said you could really just download almost ANY plugin and find it yourself.

EpicKiller 08-08-2014 11:11

Re: Blocking a command from appearing in chat
 
Ok. Thanks!

mottzi 08-09-2014 12:22

Re: Blocking a command from appearing in chat
 
Mind that return PLUGIN_HANDLED_MAIN would be accurate in such situation as it wouldnt prevent other plugins from hooking the command.

EpicKiller 08-09-2014 12:49

Re: Blocking a command from appearing in chat
 
Quote:

Originally Posted by mottzi (Post 2181595)
Mind that return PLUGIN_HANDLED_MAIN would be accurate in such situation as it wouldnt prevent other plugins from hooking the command.

Oh. Well, I didn't know that. I'll keep that in mind, thank you!

aron9forever 08-10-2014 09:15

Re: Blocking a command from appearing in chat
 
I got some advice for you, since I just made this stuff
probably, you'll want all commands to start with "/"

you should make one plugin that handles all chat commands, and do something like:
register commands normally, register_clcmd("say /hello")
after registering all commands, register_clcmd("say", "stop_say")
PHP Code:

public stop_say(id)
{
    new 
message[129];
    
read_argv(1,message,128);
        if (
message[0]==47) return PLUGIN_HANDLED// 47 = ascii value for "/"

return PLUGIN_CONTINUE


This will stop everything beginning with / from being printed, but, will also stop other plugins below this plugin in plugins.ini from using slash commands. You also wanna sure you don't have other plugins above this one that handle messages (green admin names, ghostchat or whatever) basically any plugin that cancels default cstrike chat and prints messages manually by MSG_ALL

EpicKiller 08-10-2014 11:01

Re: Blocking a command from appearing in chat
 
That's great! Thanks! I only needed the code to stop one command from appearing, it's kind of a hidden plugin, but I will use the code for all the commands, it's nicer. Thank you! :)


All times are GMT -4. The time now is 12:54.

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