AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [TF2 MvM] Chat Fix (https://forums.alliedmods.net/showthread.php?t=316223)

Theon32 05-13-2019 08:23

[TF2 MvM] Chat Fix
 
So for some reason my chat on MvM is broken because I can't see the opposing team, but I was being told that it was a default behavior, so I tried making a plugin to fix it, but this issue happens:

I added a command listener for 'say' and while it does work, it doesn't hide any commands that start with '/', and no I don't wanna hide it if it starts with '/', only if it is a valid command.
https://i.imgur.com/Al9B45J.png

Here's the code:
PHP Code:

public Action:Chat(client, const char[] commandint argc)
{
    if (
StrEqual(command"say_team") || StrEqual(command"say_party")) {return Plugin_Handled;}
    
int PlayerTeam GetClientTeam(client);
    new 
String:Args[128];
    
GetCmdArgString(Argssizeof(Args));
    
StripQuotes(Args);
    new 
String:cl_name[32];
    
GetClientName(clientcl_namesizeof(cl_name));
    new 
String:spec[8];

    if (
PlayerTeam == 1) {spec "*SPEC* ";}

    
CPrintToChatAllEx(client"%s{teamcolor}%s{default} :  %s"speccl_nameArgs);
    return 
Plugin_Handled;



Kolapsicle 05-13-2019 10:27

Re: [TF2 MvM] Chat Fix
 
You can use CommandExists to check if any text following a forward slash is registered before printing it to chat. You need to pass the full command (e.g. "sm_blind", not "blind").

Theon32 05-13-2019 10:45

Re: [TF2 MvM] Chat Fix
 
Cool, thanks! I'll see what I can do.

Theon32 05-13-2019 12:43

Re: [TF2 MvM] Chat Fix
 
I'm still new to some of this stuff, so how do I remove the forward slash from the beginning of the string?
Edit: Never mind, just used this:
PHP Code:

ReplaceString(Cmdsizeof(Cmd), "/"""false); 

Also, /equip or /mm doesn't hide from model manager.

Pelipoika 05-13-2019 14:55

Re: [TF2 MvM] Chat Fix
 
2 Attachment(s)
😂😂😂

Theon32 05-13-2019 19:01

Re: [TF2 MvM] Chat Fix
 
Wait does this remove the team chat?

Pelipoika 05-13-2019 20:02

Re: [TF2 MvM] Chat Fix
 
no

Theon32 05-14-2019 07:10

Re: [TF2 MvM] Chat Fix
 
Okay, thanks! I'll try it out.


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

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