Lloyd Logan Posted February 12, 2013 Posted February 12, 2013 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 )
iPrestege Posted February 12, 2013 Posted February 12, 2013 function funcInput() setPedControlState ( johnny, "crouch", true ) end bindKey ( "F4", "both", funcInput ) addEventHandler ( "onClientResourceStart", resourceRoot , funcInput )
3NAD Posted February 12, 2013 Posted February 12, 2013 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 )
Lloyd Logan Posted February 12, 2013 Author Posted February 12, 2013 function funcInput() setPedControlState ( johnny, "crouch", true ) end bindKey ( "F4", "both", funcInput ) addEventHandler ( "onClientResourceStart", resourceRoot , funcInput ) Doesn't work
Lloyd Logan Posted February 12, 2013 Author Posted February 12, 2013 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.
iPrestege Posted February 12, 2013 Posted February 12, 2013 So , Me to i try it and doesnot work and nothing in debugscript just wait some time .
Lloyd Logan Posted February 12, 2013 Author Posted February 12, 2013 So , Me to i try it and doesnot work and nothing in debugscript just wait some time . I'll wait.
csiguusz Posted February 12, 2013 Posted February 12, 2013 I don't know if setPedControlState is bugged or just we can't use it right, but it never worked for me... I remebmer i could make peds jump with this but nothing else. You can maybe use setPedAnimation instead.
iPrestege Posted February 12, 2013 Posted February 12, 2013 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 )
Lloyd Logan Posted February 12, 2013 Author Posted February 12, 2013 I tried this but nothing function walking(walking) setPedAnimation( johnny, "ped", "WOMAN_walknorm") end bindKey ( player, "u", "down", walking ) johnny = createPed( 79, 366.4220, -73.4700, 1001.5080 )
iPrestege Posted February 12, 2013 Posted February 12, 2013 -- 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 )
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