Garry's Mod Wiki

GM:OnCloseCaptionEmit

  boolean GM:OnCloseCaptionEmit( string soundScript, number duration, boolean fromPlayer, string fullText )

Description

Called when a caption has been emitted to the closed caption box.

Arguments

1 string soundScript
The name of the soundscript, or customLuaToken if it's from gui.AddCaption
2 number duration
How long the caption should stay for
3 boolean fromPlayer
Is this caption coming from the player?
4 string fullText
The caption. Can be nil if its token is not registered

Returns

1 boolean
Return true to prevent the caption from appearing

Example

hook.Add( "OnCloseCaptionEmit", "OnCloseCaptionEmit_Example", function( soundScript, duration, fromPlayer, fullText ) print( "Close caption emitted:", fullText, duration, fromPlayer, soundScript ) end )