Garry's Mod Wiki

GM:ChatText

  boolean GM:ChatText( number index, string name, string text, string type )

Description

Called when a message is printed to the chat box. Note, that this isn't working with player messages even though there are arguments for it.

For player messages see GM:PlayerSay and GM:OnPlayerChat

Arguments

1 number index
The index of the player.
2 string name
The name of the player.
3 string text
The text that is being sent.
4 string type
Chat filter type. Possible values are:
  • joinleave - Player join and leave messages
  • namechange - Player name change messages
  • servermsg - Server messages such as convar changes
  • teamchange - Team changes?
  • chat - (Obsolete?) Player chat? Seems to trigger when server console uses the say command
  • none - A fallback value

Returns

1 boolean
Return true to suppress the chat message.

Example

Hides default join and leave messages in chat.

hook.Add( "ChatText", "hide_joinleave", function( index, name, text, type ) if ( type == "joinleave" ) then return true end end )