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

Hooking say


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Halt
Senior Member
Join Date: Jan 2015
Location: Black Mesa
Old 09-19-2017 , 11:38   Hooking say
Reply With Quote #1

Anyone see the "blatantly" obvious reason why my chat is printing twice? Once with the colors I set and once with default TF2 chat colors.

PHP Code:
    RegConsoleCmd("say"Say);
    
RegConsoleCmd("say_team"Say);

public 
Action Say(ClientArgs)
{
    new 
String:Argx[128];
    
GetCmdArgString(Argxsizeof(Argx))
    
StripQuotes(Argx);
    
TrimString(Argx);
    if (
bIsPlayerZombie[Client] && !BaseComm_IsClientGagged(Client))
        
PrintToChatAll("\x0730FF31%N: \x07ff2929%s"ClientArgx);
    else if (!
bIsPlayerZombie[Client] && !BaseComm_IsClientGagged(Client))
        
PrintToChatAll("\x071f88ff%N: \x07e1e1e1%s"ClientArgx);

Halt is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 09-19-2017 , 12:18   Re: Hooking say
Reply With Quote #2

Why not use OnClientSayCommand
__________________
WildCard65 is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 09-19-2017 , 13:11   Re: Hooking say
Reply With Quote #3

Use simple chat processor or chat processor, they have forwards you can use to modify the chat easily
__________________
blaacky is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-19-2017 , 14:19   Re: Hooking say
Reply With Quote #4

The bug in your code (one of them, the immediate problem) is that you're not handling the command (return Plugin_Handled;) so the game is still processing it.

You should use OnClientSayCommand if you just want to get chat text, but for what you're doing you really need one of the central processing plugins to coordinate chat modifications.
__________________
asherkin 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 18:05.


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