chat.AddText

From Garry's Mod
Jump to: navigation, search
 chat.AddText( )

Contents

Description

Adds text to the local player's chat box (which only they can read).

Arguments

vararg arguments

The arguments. Arguments can be:

  • table - Color structure. Will set the color for all following strings until the next Color argument.
  • string - Text to be added to the chat box.
  • Player - Adds the name of the player in the player's team color to the chat box.
  • any - Any other type, such as Entity will be converted to string and added as text.

Examples

Example

Prints the player's name and current weapon to their chat area.

local ply = LocalPlayer()
chat.AddText( Color( 100, 100, 255 ), ply, ", you are holding ", Color( 100, 255, 100 ), ply:GetActiveWeapon():GetClass() )

Output:

chat AddText.png
Personal tools
Navigation