Jump to content

setPedControlState


Lloyd Logan

Recommended Posts

Help? Nothing happens, i am new to set ped control state, i want the ped to crouch when the F4 button is pressed?

function funcInput ( key, keyState ) 
    setPedControlState ( johnny, "crouch", true ) 
end 
  
function bindTheKeys () 
  bindKey ( "F4", "down", funcInput )  
  bindKey ( "F4", "up", funcInput )       
end 
addEventHandler ( "onClientResourceStart", bindTheKeys ) 

Link to comment

I didn't try it.

crouch = false 
  
function funcInput ( ) 
    if crouch == false then 
        setPedControlState ( johnny, "crouch", true ) 
        crouch = true 
    else 
        setPedControlState ( johnny, "crouch", false ) 
        crouch = false       
    end 
end 
bindKey ( "F4", "down", funcInput )  

Link to comment
I didn't try it.
crouch = false 
  
function funcInput ( ) 
    if crouch == false then 
        setPedControlState ( johnny, "crouch", true ) 
        crouch = true 
    else 
        setPedControlState ( johnny, "crouch", false ) 
        crouch = false       
    end 
end 
bindKey ( "F4", "down", funcInput )  

Doesn't work either, player kind of jitters but nothing. Nothing in Debug Script 3 either.

Link to comment

Hmm.. i think that to because i do that the ped jump for 1 time and the key won't bind -_-" dman :

local johnny = createPed ( 120, 2068.70020 ,985.72357 ,10.67188 ) 
function Test() 
    setPedControlState ( johnny, "jump", true ) 
end 
addEventHandler ( "onClientResourceStart", root , Test )  
bindKey ("F4", "down", Test ) 
  
Link to comment
-- Server Side ... 
function walking(walking) 
    setPedAnimation( johnny, "ped", "WOMAN_walknorm") 
end 
johnny = createPed( 79, 366.4220, -73.4700, 1001.5080 ) 
  
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for k, i in ipairs ( getElementsByType ( "player" )) do 
            bindKey ( i, "u", "down", walking ) 
        end 
    end 
) 
  
addEventHandler ( "onPlayerJoin", root, 
    function () 
        bindKey ( source, "u", "down", walking ) 
    end 
) 

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