AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   How to let everyone talk with each other. (https://forums.alliedmods.net/showthread.php?t=305317)

nikita2150 02-15-2018 13:20

How to let everyone talk with each other.
 
Hello everyone,
I've been searching on the internet on how to make everyone able to speak with each other in the chat, to let dead players talk with live players and live players with dead.
I would appreciate any help, thank you in advanced!:)

eyal282 02-15-2018 13:39

Re: How to let everyone talk with each other.
 
Quote:

Originally Posted by nikita2150 (Post 2578344)
Hello everyone,
I've been searching on the internet on how to make everyone able to speak with each other in the chat, to let dead players talk with live players and live players with dead.
I would appreciate any help, thank you in advanced!:)

Game?

nikita2150 02-15-2018 13:43

Re: How to let everyone talk with each other.
 
Quote:

Originally Posted by eyal282 (Post 2578348)
Game?

CS:S

Franc1sco 02-15-2018 15:05

Re: How to let everyone talk with each other.
 
For css maybe sv_alltalk 1

eyal282 02-16-2018 08:08

Re: How to let everyone talk with each other.
 
Maybe set sm_deadtalk to 2?

nikita2150 02-17-2018 03:48

Re: How to let everyone talk with each other.
 
Okay, I see no one understood me, I'll ask another question.
How to let a *DEAD* admin talk in the cheat with live and dead players.
Thank you in advance.

kot4404 02-17-2018 06:49

Re: How to let everyone talk with each other.
 
Use sm_say command

eyal282 02-21-2018 05:48

Re: How to let everyone talk with each other.
 
Quote:

Originally Posted by nikita2150 (Post 2578642)
Okay, I see no one understood me, I'll ask another question.
How to let a *DEAD* admin talk in the cheat with live and dead players.
Thank you in advance.

I made an API plugin called ”Chat Revamp”. It’s yet to be able to allow chats that shouldn’t be sent to be sent but I’ll fix it today and post you another plugin that allows dead chat.

Tell me if this works after you adjust the cvars.


Code:

#include <sourcemod>
#include <sdktools>

public Plugin:myinfo =
{
        name = "Chat Revamp ( Chat Processor )",
        author = "Eyal282 ( FuckTheSchool )",
        description = "Allows plugins to intercept chat communications between players and edit them",
        version = "1.3",
        url = "<- URL ->"
}

new Handle:fw_ChatSent = INVALID_HANDLE;
new Handle:fw_ChatSent_Post = INVALID_HANDLE;

new Handle:cvHideNameChange = INVALID_HANDLE;
new Handle:cvDeadChat = INVALID_HANDLE;


public Action:CR_OnChatSent(&Receiver, &Sender, &bChat, String:Tag[], String:Name[], String:Message[], &WillSend)
{
        if(WillSend)
        {
                if(GetConVarBool(cvHideNameChange))
                {       
                        if(StrContains(Tag, "Name", false) != -1 && CheckCommandAccess(Sender, "sm_kick", ADMFLAG_KICK))
                        {
                                if(!CheckCommandAccess(Receiver, "sm_kick", ADMFLAG_KICK))
                                        return Plugin_Handled;
                        }
                }
        }
        else
        {
                if(GetConVarBool(cvDeadChat))
                {
                        if(StrContains(Tag, "Dead", false) != -1)
                        {
                                if(StrContains(Tag, "All") != -1 || GetClientTeam(Sender) == GetClientTeam(Receiver))
                                        WillSend = true;
                        }
                }
        }
        return Plugin_Continue;
}

public Action:CR_OnChatSent_Post(Receiver, Sender, bChat, String:Tag[], String:Name[], String:Message[])
{
        if(!GetConVarBool(cvHideNameChange))
                return Plugin_Continue;
               
        else if(StrContains(Tag, "Name", false) != -1 && CheckCommandAccess(Sender, "sm_kick", ADMFLAG_KICK))
                PrintToChat(Sender, "Your name change is only shown to admins!");
       
        return Plugin_Continue;
}
public OnPluginStart()
{       
        HookUserMessage(GetUserMessageId("SayText2"), Message_SayText2, true);
       
        // public Action:CR_OnChatSent(&Sender, &bChat, String:Tag[], String:Name[], String:Message[], &Something, &OtherSomething, players[], &playersNum)
       
        // @param Receiver                        The client receiving the message.
        // @param Sender                        The client sending the message.
        // @param bChat                                Unsure, I think whether or not the message is printed in console not only in chat.
        // @param String:Tag[]                Message display tags ( Changing will not affect who will see it, but it acts as a format of message, Example: #L4D_Chat_All, #L4D_Chat_Infected )
        // @param String:Name[]                Name of the sender.
        // @param String:Message[]        The message the client sends.
        // @param WillSend                        Will the message actually be sent without changing this to true? Change to true if you want to force the message to be sent even if it shouldn't.

        // @Return                                        Even to allow chat to send, Odd to disallow chat to send. Plugin_Stop will act as Plugin_Continue due to that.
       
        // @Note                                        Tag in L4D2 and probably all games will contain "Name" when the chat message is a name change.

        // @Note                                        All parameters are copied back to the forward.
        fw_ChatSent = CreateGlobalForward("CR_OnChatSent", ET_Event, Param_CellByRef, Param_CellByRef, Param_String, Param_String, Param_String, Param_CellByRef, Param_CellByRef, Param_Array, Param_CellByRef, Param_CellByRef);
       
        // public Action:CR_OnChatSent_Post(Receiver, Sender, bChat, String:Tag[], String:Name[], String:Message[])
       
        // @Note: The parameters on post and pre are identical.
        // @Note: Tag in L4D2 and probably all games will contain "Name" when the chat message is a name change.
        fw_ChatSent_Post = CreateGlobalForward("CR_OnChatSent_Post", ET_Ignore, Param_Cell, Param_Cell, Param_String, Param_String, Param_String, Param_Cell, Param_Cell, Param_Array, Param_Cell);
       
       
        cvHideNameChange = CreateConVar("cr_hide_admin_name_change", "1", "If set to 1, only admins can see name changes");
        cvDeadChat = CreateConVar("cr_dead_chat", "0", "If set to 1, dead players can chat.");
}

public Action:Message_SayText2(UserMsg msg_id, Handle:Bf, const int[] players, int playersNum, bool reliable, bool init)
{
        new Sender = BfReadByte(Bf);
       
        if(Sender <= 0 || Sender > MaxClients)
                return Plugin_Continue;
               
        new bChat = BfReadByte(Bf);
       
        new String:Tag[50];
        BfReadString(Bf, Tag, sizeof(Tag));
       
        new String:Name[64];
        BfReadString(Bf, Name, sizeof(Name));
       
        new String:Message[300];
        BfReadString(Bf, Message, sizeof(Message));

        new Handle:DP = CreateDataPack();
               
        RequestFrame(SendMessage, DP);
       
        WritePackCell(DP, Sender);
        WritePackCell(DP, bChat);
        WritePackString(DP, Tag);
        WritePackString(DP, Name);
        WritePackString(DP, Message);
       
        WritePackCell(DP, playersNum);
       
        for(new i=0;i < playersNum;i++)
                WritePackCell(DP, players[i]);
               
        return Plugin_Handled;
}

public SendMessage(Handle:DP)
{
        ResetPack(DP);
        new Sender = ReadPackCell(DP);
        new bChat = ReadPackCell(DP);
        new String:Tag[50];
        ReadPackString(DP, Tag, sizeof(Tag));
        new String:Name[64];
        ReadPackString(DP, Name, sizeof(Name));
        new String:Message[300];
        ReadPackString(DP, Message, sizeof(Message));
        new players[MAXPLAYERS];
        new playersNum = ReadPackCell(DP);

        for(new i=0;i < playersNum;i++)
        {
                players[i] = ReadPackCell(DP);
        }
       
        CloseHandle(DP);

        new ReturnValue;
       
        for(new id=1;id <= MaxClients;id++)
        {
                if(!IsClientInGame(id))
                        continue;
                       
                else if(IsFakeClient(id))
                        continue;
                       
                new bool:WillSend;
                for(new i=0;i < playersNum;i++)
                {
                        if(players[i] == id)
                        {
                                WillSend = true;
                        }
                }
                Call_StartForward(fw_ChatSent);
               
                Call_PushCellRef(id);
                Call_PushCellRef(Sender);
                Call_PushCellRef(bChat);
                Call_PushStringEx(Tag, sizeof(Tag), SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
                Call_PushStringEx(Name, sizeof(Name), SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);       
                Call_PushStringEx(Message, sizeof(Message), SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);       
                Call_PushCellRef(WillSend);
                       
                Call_Finish(ReturnValue);
                       
                if((ReturnValue & 1) == 1 || !WillSend)
                                return;
                               
                static UserMsg:SayText;
                if(!SayText)
                        SayText = GetUserMessageId("SayText2");
               
                new Handle:Bf = StartMessageOne("SayText2", id, USERMSG_BLOCKHOOKS);
                BfWriteByte(Bf, Sender);
                BfWriteByte(Bf, bChat);
                BfWriteString(Bf, Tag);
                BfWriteString(Bf, Name);
                BfWriteString(Bf, Message);
                EndMessage()
       
                Call_StartForward(fw_ChatSent_Post);
               
                Call_PushCell(id);
                Call_PushCell(Sender);
                Call_PushCell(bChat);
                Call_PushString(Tag);
                Call_PushString(Name);       
                Call_PushString(Message);       
               
                Call_Finish(ReturnValue);
        }
}



All times are GMT -4. The time now is 10:37.

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