Revision Difference
GM:OnUndo#527378
<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 name="suppress" type="boolean">Return false to suppress the undo notification.
</ret>
</rets>
</function>
<example>
<description>Print a message when the player undoes something.</description>
<code>
hook.Add( "OnUndo", "CustomUndoText", function( name, customText )
if customText ~= nil then
MsgN( "Undone " .. customText )
else
MsgN( "Undone " .. name )
end
end )
</code>
<output>Undone <action></output>
</example>