Garry's Mod Wiki

GM:OnUndo

  boolean GM:OnUndo( string name, string customText )

Description

Called when the player undoes something.

Arguments

1 string name
The name of the undo action
2 string customText
The custom text for the undo, set by undo.SetCustomUndoText

Returns

1 boolean suppress
Return false to suppress the undo notification.

Example

Print a message when the player undoes something.

hook.Add( "OnUndo", "CustomUndoText", function( name, customText ) if customText ~= nil then MsgN( "Undone " .. customText ) else MsgN( "Undone " .. name ) end end )
Output: Undone <action>