Garry's Mod Wiki

Revision Difference


<function name="CanUndo" parent="GM" type="hook"> <ishook>yes</ishook> <description>Called whenever a players tries to undo.</description> <realm>Client</realm> <realm>Server</realm> <added>2020.06.24</added> <args> <arg name="ply" type="Player">The player who tried to undo something</arg> <arg name="undo" type="table">The undo table as a <page>Structures/Undo</page></arg> </args> <rets> <ret name="" type="boolean">Return false to disallow the undo</ret> </rets> </function> <example> <description> Here's a trick you can do to achieve the behavior of this function on the client. </description> <code> hook.Add("PlayerBindPress", "CanUndo", function(ply, bind) if ply == LocalPlayer() and bind == "gmod_undo" then return true -- false to allow, true to prevent end end) </code> </example>