Garry's Mod Wiki

GM:CanUndo

  boolean GM:CanUndo( Player ply, table undo )

Description

Called whenever a players tries to undo.

Arguments

1 Player ply
The player who tried to undo something.
2 table undo
The undo table as a Undo structure.

Returns

1 boolean
Return false to disallow the undo.

Example

Here's a trick you can do to achieve the behavior of this function on the client.

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 )