Garry's Mod Wiki


  GM:SetupMove( Player ply, CMoveData mv, CUserCmd cmd )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.


SetupMove is called before the engine process movements. This allows us to override the players movement.

See Game Movement for an explanation on the move system.


1 Player ply
The player whose movement we are about to process
2 CMoveData mv
The move data to override/use
3 CUserCmd cmd
The command data


Make drowning even more entertaining:

hook.Add( "SetupMove", "Drowning:HandleWaterInLungs", function( ply, mv, cmd ) if ( ply:WaterLevel() >= 2 ) then mv:SetUpSpeed( -100 ) cmd:SetUpMove( -100 ) end end )


Disable the player's ability to jump by removing a key from CMoveData:

local CMoveData = FindMetaTable("CMoveData") function CMoveData:RemoveKeys(keys) -- Using bitwise operations to clear the key bits. local newbuttons =, bit.bnot(keys)) self:SetButtons(newbuttons) end hook.Add("SetupMove", "Disable Jumping", function(ply, mvd, cmd) if mvd:KeyDown(IN_JUMP) then mvd:RemoveKeys(IN_JUMP) end end)