Garry's Mod Wiki


  gui.AddCaption( string text, number duration, boolean fromPlayer = false )


Pushes text to the closed caption box.

The function will not work, if the console command variable "closecaption" is set to 0.


1 string text
The caption to emit. See Closed Captions for more info
2 number duration
How long the caption should stay for
3 boolean fromPlayer = false
Is this caption coming from the player?

This is used to give different colors to the caption to differentiate, for example, whether the SMG is fired by the player or NPC.


Prints "Hello World" in bold

RunConsoleCommand("closecaption", "1") // To activate the caption gui.AddCaption("<B>Hello World!<B>", 5)