Garry's Mod Wiki

Revision Difference

GM:OnUndo#526991

<function name="OnUndo" parent="GM" type="hook"> <ishook>yes</ishook> <description>Called when the player undoes something.</description> <realm>Client</realm> <predicted>No</predicted> <args> <arg name="name" type="string">The name of the undo action</arg> <arg name="customText" type="string">The custom text for the undo, set by <page>undo.SetCustomUndoText</page></arg> </args> <rets>⤶ <ret name="CanUndo" type="boolean">Return false to prevent the undo.⤶ <note>Will be available in the next update.</note>⤶ </ret>⤶ </rets>⤶ </function> <example> <description>Print a message when the player undoes something.</description> <code> function GM:OnUndo( name, customText ) if customText != nil then MsgN( "Undone " .. customText ) else MsgN( "Undone " .. name ) end end </code> <output>Undone &lt;action&gt;</output> </example>