AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hiding said '' register_clcmd '' (https://forums.alliedmods.net/showthread.php?t=107853)

KadiR 10-31-2009 05:47

Hiding said '' register_clcmd ''
 
Quote:

register_clcmd("say hi", ..);
I want to hide the register_clcmd, so if I write '' hi '', '' hi '' should be hided in chat.

And the 2. thing, how can I make, that if the word hi is in chat, that it does the function:

Like that .hi, _hi,/hi

I don't want to regiser this, is there an other way?

vitorrd 10-31-2009 05:56

Re: Hiding said '' register_clcmd ''
 
Either register the three commands or hook SayText (not recommended).
Return PLUGIN_HANDLED in your command to avoid showing it, PLUGIN_CONTINUE to let the server continue processing it (which will end up in it being sent to the chat).

xPaw 10-31-2009 06:51

Re: Hiding said '' register_clcmd ''
 
Hook "say" and read args there.

ConnorMcLeod 11-01-2009 05:29

Re: Hiding said '' register_clcmd ''
 
Best is to register all commands and let amxx check them in client_command.
Hook say cmd is rather when you want to detect a word in a sentence.

You can use this stock to register all commands :

PHP Code:

register_saycmd(saycommand[], function[], flags = -1info[] = ""FlagManager = -1)
{
    new 
temp[64];
    
formatex(temp63"say /%s"saycommand);
    
register_clcmd(temp, function, flagsinfoFlagManager);
    
formatex(temp63"say .%s"saycommand);
    
register_clcmd(temp, function, flagsinfoFlagManager);
    
formatex(temp63"say_team /%s"saycommandFlagManager);
    
register_clcmd(temp, function, flagsinfo);
    
formatex(temp63"say_team .%s"saycommandFlagManager);
    
register_clcmd(temp, function, flagsinfoFlagManager);
    
formatex(temp63".%s"saycommand);
    
register_clcmd(temp, function, flagsinfoFlagManager);
    
formatex(temp63"/%s"saycommand);
    
register_clcmd(temp, function, flagsinfoFlagManager);



Then, do :

register_saycmd("hi", ...

/hi, .hi will work in chat, say and say_team, and also in console.

SnoW 11-01-2009 07:08

Re: Hiding said '' register_clcmd ''
 
Your stock's name fails.

xPaw 11-01-2009 07:28

Re: Hiding said '' register_clcmd ''
 
Quote:

Originally Posted by SnoW (Post 977809)
Your stock's name fails.

Whats wrong with it ? :|

SnoW 11-01-2009 11:07

Re: Hiding said '' register_clcmd ''
 
Quote:

Originally Posted by xPaw (Post 977817)
Whats wrong with it ? :|

It registers console commands as well, but the name is saycmd. ;)

Arkshine 11-01-2009 11:22

Re: Hiding said '' register_clcmd ''
 
Dear God, what a tragedy.

xPaw 11-01-2009 11:23

Re: Hiding said '' register_clcmd ''
 
Quote:

Originally Posted by SnoW (Post 977940)
It registers console commands as well, but the name is saycmd. ;)

That doesnt really matter, you can name it like SnoW_Is_Cool( ... ) :)

ConnorMcLeod 11-01-2009 17:18

Re: Hiding said '' register_clcmd ''
 
Quote:

Originally Posted by xPaw (Post 977952)
That doesnt really matter, you can name it like SnoW_Is_Cool( ... ) :)

Would fail, whatever the content of the function.


All times are GMT -4. The time now is 17:41.

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