Garry's Mod Wiki

Revision Difference

GM:ChatText#527797

<function name="ChatText" parent="GM" type="hook"> <ishook>yes</ishook> <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 <page>GM:PlayerSay</page> and <page>GM:OnPlayerChat</page> </description> <realm>Client</realm> <predicted>No</predicted> <args> <arg name="index" type="number">The index of the player.</arg> <arg name="name" type="string">The name of the player.</arg> <arg name="text" type="string">The text that is being sent.</arg> <arg name="type" type="string">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? * none - A fallback value</arg> * `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? * `none` - A fallback value</arg> </args> <rets> <ret name="" type="boolean">Return true to suppress the chat message</ret>⤶ <ret name="" type="boolean">Return true to suppress the chat message.</ret>⤶ </rets> </function> <example> <description>Hides default join and leave messages in chat.</description> <code> hook.Add( "ChatText", "hide_joinleave", function( index, name, text, typ ) if ( typ == "joinleave" ) then return true end⤶ hook.Add( "ChatText", "hide_joinleave", function( index, name, text, type ) if ( type == "joinleave" ) then⤶ return true⤶ end⤶ end ) </code> </example>