• Rebind without messing with keyconfig
    10 replies, posted
Hi I'm looking to convert strafing into turning, how can I do this without binding IN_MOVELEFT/RIGHT to IN_LEFT/RIGHT? Thanks
You could do it by hooking into CreateMove probably.
The little experience I have with that involves setting a movement axis and changing speed. Is there a way to block specific IN_KEYS altogether?
[b][url=http://wiki.garrysmod.com/?title=CUserCmd.SetButtons]CUserCmd.SetButtons [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
You are awesome! Thank you!
Gah! No! This has some really weird results. If I do [code]function GM:CreateMove( cmd ) cmd:SetButtons( IN_RIGHT ) //can be anything at all end[/code] Movement and some input is exactly the same. Jumping, sprinting, walking and crouching are completely blocked. What is going on?
You have an extra end. If removing the extra end doesn't help, try [lua]hook.Add("CreateMove", "hookname", function(cmd) cmd:SetButtons(IN_RIGHT) end)[/lua]
Extra end was bad copying on my end. Hooking has identical result to overriding. Player doesn't spin as I would expect, instead movement is normal and most input doesn't do anything. Also I noticed this time around primary and secondary fire are blocked as well.
Are you running it clientside?
If you're not sure whether it's working or not, add cmd:SetViewAngles(Angle(0, 0, 0)) in the createmove hook and see if you can move your aim. If not, it worked. You should also try cmd:SetSideMove(0) or some other variation of the parameters, the wiki doesn't list them.
I am running it clientside. SetViewAngles and SetSideMove work fine, SetButtons just seems to be completely broken.
Sorry, you need to Log In to post a reply to this thread.