Raised This Month: $248 Target: $400
 62% 

[L4D/L4D2] No Team Chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author
bullet28
Junior Member
Join Date: Apr 2012
Location: Ukraine
Plugin ID:
7029
Plugin Version:
2
Plugin Category:
General Purpose
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Redirecting all 'say_team' messages to 'say' in order to remove (Survivor) prefix when it's useless
    Old 04-06-2020 , 22:40   [L4D/L4D2] No Team Chat
    Reply With Quote #1

    Basically what this does is making your chat a little cleaner.

    Name:  result.jpg
Views: 575
Size:  38.1 KB

    Should be used in gamemodes where there is only 1 playable team (coop, scavenge, etc)

    ConVars:
    noteamsay_ignorelist "/|@" - Messages starting with this will be ignored, separate by | symbol

    Notes:
    - Compile using 1.10 or higher compiler, otherwise "No command callback available" exception can occur.
    - Ignore list limited to have 16 elements of 16 characters now, change it in source if you need more.

    Updates history:
    09 April 2020: Switched to use 'OnClientSayCommand' (thanks to Marttt), added ignore list convar.
    Attached Files
    File Type: sp Get Plugin or Get Source (lfd_noTeamSay.sp - 75 views - 1.8 KB)
    File Type: smx lfd_noTeamSay.smx (4.5 KB, 34 views)

    Last edited by bullet28; 04-08-2020 at 18:26.
    bullet28 is offline
    zaviier
    Member
    Join Date: Aug 2017
    Old 04-07-2020 , 11:48   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #2

    Thanks... this is great for one team only.
    zaviier is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Old 04-08-2020 , 16:47   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #3

    Nice, good idea.

    Anyway I checked the code and you can do some improvements.

    Spoiler
    __________________

    Last edited by Marttt; 04-08-2020 at 16:51.
    Marttt is offline
    bullet28
    Junior Member
    Join Date: Apr 2012
    Location: Ukraine
    Old 04-08-2020 , 17:07   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #4

    Quote:
    Originally Posted by Marttt View Post
    Found an extra space while changing the say_team for say command, after the client name
    It is not extra, original message has same amount of spaces, if you remove it -- message will look different.

    Quote:
    Originally Posted by Marttt View Post
    Replace the "GetClientName" with "%N", unless there is some reason to do it.
    It is used for TrimString.. but reality is that trim should be removed too, so I do it.

    Quote:
    Originally Posted by Marttt View Post
    OnClientSayCommand(int client, const char[] command, const char[] sArgs)
    If it's really so important.. ok, I will use it.

    Quote:
    Originally Posted by Marttt View Post
    You could hide the "team chat" command for the sender, now it is displaying twice.
    What do you mean by "team chat command"? I never seen messages twice while using this plugin.

    Quote:
    Originally Posted by Marttt View Post
    Maybe you should remove the "@" prefix for this code, because if u are an admin, you are able to talk only with admins using @ prefix in team chat
    Ok, didn't knew about this prefix. I will add convar for those who has their own preferences.
    bullet28 is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Old 04-08-2020 , 17:33   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #5

    Quote:
    Originally Posted by bullet28 View Post
    It is not extra, original message has same amount of spaces, if you remove it -- message will look different.
    What I mean is that you are "double" spacing, instead just a single one.

    .Mart. : a (all chat)
    .Mart. : a (team chat)

    EDIT: I cant show here because SM removes double spacing from the post, but you can check what I mean by clicking in "quote"

    Quote:
    Originally Posted by bullet28 View Post
    What do you mean by "team chat command"? I never seen messages twice while using this plugin.
    I get this result because I have a plugin that makes !commands lowercase, probably is some conflict.
    I made a test removing the RegConsoleCmd and changing it to the Action OnClientSayCommand and it stopped.
    I also had to change the last line to Plugin_Stop; and check if the command var is "say_team"

    Anyway nice plugin, I just wanted to warn you about some stuff you could improve
    __________________

    Last edited by Marttt; 04-08-2020 at 17:37.
    Marttt is offline
    bullet28
    Junior Member
    Join Date: Apr 2012
    Location: Ukraine
    Old 04-08-2020 , 18:24   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #6

    Quote:
    Originally Posted by Marttt View Post
    I made a test removing the RegConsoleCmd and changing it to the Action OnClientSayCommand and it stopped
    Good. I have updated version to use OnClientSayCommand. Thank you!

    Quote:
    Originally Posted by Marttt View Post
    I mean is that you are "double" spacing, instead just a single one
    I have recorded for you a small video to show that I has exactly same amount of spaces as in original game. https://youtu.be/mtUomL5-ZNk Are you using L4D2 too?
    bullet28 is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Old 04-08-2020 , 19:37   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #7

    L4D2 Windows (Local Server), but no problem, thanks to check.
    __________________
    Marttt is offline
    fbef0102
    Senior Member
    Join Date: Sep 2017
    Location: TW
    Old 04-21-2020 , 07:05   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #8

    I have this error in sourcemod 1.8 on local windows server
    Spoiler


    so I modify some codes, works for me.
    PHP Code:
    public void OnPluginStart() {
        
    AddCommandListener(TeamSay_Callback"say_team");
    .
    .
    }

    public 
    Action TeamSay_Callback(int client, const char[] commandint argc){
        if (!
    StrEqual(command"say_team"false))
            return 
    Plugin_Continue;

        if (
    client <= 0)
            return 
    Plugin_Continue;

        
    char msg[MAX_NAME_LENGTH];
        
    GetCmdArg(1msgsizeof(msg));

        for (
    int i 0sizeof ignoreListi++) {
            if (
    ignoreList[i][0] != EOS && StrContains(msgignoreList[i]) == 0) {
                return 
    Plugin_Continue;
            }
        }
        
        
    TrimString(msg);

        
    char buffer[256];
        
    Format(buffersizeof(buffer), "\x03%N\x01 :  %s"clientmsg);

        for (
    int i 1<= MaxClientsi++) {
            if (
    IsClientInGame(i) && !IsFakeClient(i)) {
                
    SayText2(iclientbuffer);
            }
        }

        return 
    Plugin_Handled;
    }

    /*
    public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs) {
        if (!StrEqual(command, "say_team", false))
            return Plugin_Continue;

        if (client <= 0)
            return Plugin_Continue;

        char msg[192];
        GetCmdArg(1, msg, sizeof(msg));

        for (int i = 0; i < sizeof ignoreList; i++) {
            if (ignoreList[i][0] != EOS && StrContains(msg, ignoreList[i]) == 0) {
                return Plugin_Continue;
            }
        }
        
        TrimString(msg);

        char buffer[256];
        Format(buffer, sizeof(buffer), "\x03%N\x01 :  %s", client, msg);

        for (int i = 1; i <= MaxClients; i++) {
            if (IsClientInGame(i) && !IsFakeClient(i)) {
                SayText2(i, client, buffer);
            }
        }

        return Plugin_Stop;
    }
    */ 
    __________________
    fbef0102 is offline
    Zheldorg
    New Member
    Join Date: Aug 2020
    Old 08-04-2020 , 15:47   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #9

    I compiled using build "1.10.0.6492" but still got the error "[SM] Exception reported: No command callback available".
    I'm not sure if it's appropriate to call GetCmdArg () here, because already getting sArgs as chat argument string
    My fix option using this:
    PHP Code:
    public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs) {
        if (!
    StrEqual(command"say_team"false))
            return 
    Plugin_Continue;

        if (
    client <= 0)
            return 
    Plugin_Continue;

        
    char msg[192];
        
    strcopy(msgsizeof(msg), sArgs);// replacement GetCmdArg(1, msg, sizeof(msg));
    //    GetCmdArg(1, msg, sizeof(msg)); // do error:
    /*
    L 08/04/2020 - 21:43:30: [SM] Exception reported: No command callback available
    L 08/04/2020 - 21:43:30: [SM] Blaming: lfd_noTeamSay.smx
    L 08/04/2020 - 21:43:30: [SM] Call stack trace:
    L 08/04/2020 - 21:43:30: [SM]   [0] GetCmdArg
    L 08/04/2020 - 21:43:30: [SM]   [1] Line 38, D:\ScmdServers\apps\l4d2\left4dead2\addons\sourcemod\scripting\lfd_noTeamSay.sp::OnClientSayCommand 
    */
        
    for (int i 0sizeof ignoreListi++) {
            if (
    ignoreList[i][0] != EOS && StrContains(msgignoreList[i]) == 0) {
                return 
    Plugin_Continue;
            }
        }
        
        
    TrimString(msg);

        
    char buffer[256];
        
    Format(buffersizeof(buffer), "\x03%N\x01 :  %s"clientmsg);

        for (
    int i 1<= MaxClientsi++) {
            if (
    IsClientInGame(i) && !IsFakeClient(i)) {
                
    SayText2(iclientbuffer);
            }
        }

        return 
    Plugin_Stop;

    Zheldorg is offline
    fbef0102
    Senior Member
    Join Date: Sep 2017
    Location: TW
    Old 09-15-2020 , 15:03   Re: [L4D/L4D2] No Team Chat
    Reply With Quote #10

    Remake
    https://github.com/fbef0102/L4D1_2-P.../lfd_noTeamSay
    __________________
    fbef0102 is offline
    Reply


    Thread Tools
    Display Modes

    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 13:35.


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