On_Chat

Feb 22, 2018
On_Chat
  • Method:
    On_Chat

    Description:
    Runs when a Player types something in the chat


    Argument(s):
    ChatEvent ce

    Properties/Methods:
    ChatEvent.NewText
    ChatEvent.ToString() - Original Text
    ChatEvent.Substring(int start, int length)

    No Name, Attacker, or Victim.

    Examples:
    Python:

    Code (Python):

    def On_Chat(self, Player, ChatEvent):
         Text = ChatEvent.OriginalMessage
         ChatEvent.NewText = "    " # How to make the chat message disappear
         Server.Broadcast(Text)
     

    Javascript:
    Code (Javascript):

    function On_Chat(Player, ChatEvent)
    {
         Text = ChatEvent.OriginalMessage;
         ChatEvent.NewText = "    "; // How to make the chat message disappear
         Server.Broadcast(Text);
    }
     

    C#:
    Code (C#):

    public override void Initialize()
    {
         Hooks.OnChat += ChatHandler;
    }

    public override void DeInitialize()
    {
         Hooks.OnChat -= ChatHandler;
    }

    public void ChatHandler(Fougerite.Player Player, ref ChatString chatString)
    {
         string Text = chatString.OriginalMessage;
         chatString.NewText = "   ";
         Server.GetServer().Broadcast(Text);
    }