Hale Posted July 11, 2016 Share Posted July 11, 2016 Hi, so I'm triggering this code via GUI: function movePed() if (source == GUIEditor.button[1]) then -- Walk button setPedAnalogControlState (ped, 'walk', 1) elseif (source == GUIEditor.button[2]) then -- Sprint button setPedAnalogControlState (ped, 'sprint', 1) elseif (source == GUIEditor.button[3]) then -- Stop button setPedAnalogControlState (ped, 'forwards', 0) end end The problem is: Stop button works, but Walk and Sprint don't. I've tried using 'forwards' instead of 'walk' and that works, but 'walk' and 'sprint' don't work. Anyone has a possible solution? Thanks in advance! Link to comment
Hale Posted July 11, 2016 Author Share Posted July 11, 2016 EDIT: Walk works with 'forwards' and state below 0.5, but sprint still isn't in function. function movePed() if (source == GUIEditor.button[1]) then setPedAnalogControlState(ped, 'forwards', 0.2) elseif (source == GUIEditor.button[2]) then setPedAnalogControlState(ped, 'forwards', 1) elseif (source == GUIEditor.button[3]) then setPedAnalogControlState(ped, 'forwards', 0) end end Link to comment
Captain Cody Posted July 11, 2016 Share Posted July 11, 2016 Try function movePed() if (source == GUIEditor.button[1]) then -- Walk button setPedAnalogControlState (ped, 'forwards', 1) setPedAnalogControlState (ped, 'walk', 1) elseif (source == GUIEditor.button[2]) then -- Sprint button setPedAnalogControlState (ped, 'forwards', 1) setPedAnalogControlState (ped, 'sprint', 1) elseif (source == GUIEditor.button[3]) then -- Stop button setPedAnalogControlState (ped, 'forwards', 0) end end Link to comment
Hale Posted July 11, 2016 Author Share Posted July 11, 2016 Try function movePed() if (source == GUIEditor.button[1]) then -- Walk button setPedAnalogControlState (ped, 'forwards', 1) setPedAnalogControlState (ped, 'walk', 1) elseif (source == GUIEditor.button[2]) then -- Sprint button setPedAnalogControlState (ped, 'forwards', 1) setPedAnalogControlState (ped, 'sprint', 1) elseif (source == GUIEditor.button[3]) then -- Stop button setPedAnalogControlState (ped, 'forwards', 0) end end Tried it already, tried again now. The ped just walks normally like player when holding W. Link to comment
Captain Cody Posted July 11, 2016 Share Posted July 11, 2016 I'm not to sure then sorry. Link to comment
Hale Posted July 11, 2016 Author Share Posted July 11, 2016 No problem, thanks anyway Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now