• CreateMove cmd:SetButtons irregular behavior
    2 replies, posted
I'm trying to disable the use of movement using the CreateMove hook, but there is some irregular behavior with how SetButtons is functioning. [lua]cmd:SetButtons(IN_FORWARD)[/lua] doesn't allow me to jump, crouch, or fire my weapons, but I can still move freely. [lua]cmd:SetButtons(bit.band(cmd:GetButtons(), bit.bnot(bit.bor(IN_FORWARD, IN_BACK, IN_LEFT, IN_RIGHT))))[/lua] This allows me to do everything as if Buttons aren't even being set.
I wish there were bitwise operations. It feels so much easier to just do something like [lua]cmd:SetButtons( cmd:GetButtons() | ~( IN_FORWARD & IN_BACK & IN_LEFT & IN_RIGHT ) );[/lua] Or something like that.
There's a macro for that cmd:ClearMovement()
Sorry, you need to Log In to post a reply to this thread.