Jump to content

setPedAnalogControlState doesn't work?


Hale

Recommended Posts

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

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

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...