• Disable player crouching?
    6 replies, posted
What would be the best way of disabling player crouching entirely? I had a look at [b][url=http://wiki.garrysmod.com/?title=Player.Crouching]Player.Crouching [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] but I assume that wouldn't get called until the player is actually already crouching, and not when the crouch key is initially pressed? Could I use something alike: [lua] if self.Owner:KeyDown(IN_DUCK) then -- do nothing end [/lua]
You could try returning false on the HandlePlayerDucking hook, I guess.
I tried this: [lua] function GM:HandlePlayerDucking( ply, velocity ) if ply:Team() == TEAM_HUNTERS then if ply:Crouching() then local len2d = velocity:Length2D() if len2d > 0.5 then ply.CalcIdeal = ACT_MP_CROUCHWALK else ply.CalcIdeal = ACT_MP_CROUCH_IDLE end return true end end return false end hook.Add("HandlePlayerDucking", "PropHunt_HandlePlayerDucking", HandlePlayerDucking) [/lua] Basically, I want to disable props the ability to crouch in prophunt, however, using that above, absolutely nothing was affected. Everyone was still able to crouch.
Oh, my bad, that'd explain it then. Anyone know of a hook, or function I could use to accomplish disabling player crouching?
Thanks very much, got it working nicely.
Sorry, you need to Log In to post a reply to this thread.