• No way to disable someone from walking slowly
    4 replies, posted
Back again after like 2 hours! This time, I'm trying to make it so the player cannot stop walking in just one direction (In this case, in front) and only goes 1 speed. As a way to cheap out on this since I wasn't able to force a player to run (This is all run within a SWEP) I just set the speed of crouch, walk, and run to the same amount. But now whenever someone holds ALT they can just walk slowly and I already tried to stop that from happening within the code: hook.Add("SetupMove", "ForeverRunRollout", function(ply, mData, cData) if(ply:GetActiveWeapon().Rolling) then           mData:SetForwardSpeed(ply:GetRunSpeed()) cData:SetForwardMove(ply:GetRunSpeed())           mData:SetSideSpeed(0)           cData:SetSideMove(0)           if(mData:KeyDown(IN_WALK)) then                       mData:SetButtons(mData:GetButtons() - IN_WALK)                       end end end) For some reason, it does work for keys like IN_JUMP but won't work with IN_WALK
Try using a Move hook, instead. Also, you should use bit operators instead of arithmetic subtraction for your IN_WALK removal. To remove a flag: bit.band(nFlags - bit.bnot(IN_WALK))
bit.band(nFlags, bit.bnot(FLAG)) FTFY
Thank you, edited in.
Sorry, you need to Log In to post a reply to this thread.