Rickyz1992 Posted January 12, 2008 Share Posted January 12, 2008 ------------------- JUMP --------------------------- function Jump ( key, keyState ) local vehicle = getPlayerOccupiedVehicle(getLocalPlayer()) if ( keyState == "down" ) and ( isVehicleOnGround( vehicle ) == true ) then end local x, y, z = getElementVelocity(vehicle) setElementVelocity(vehicle, x, y, z + 0.4) end bindKey ( "z", "down", Jump ) -- bind the player's z down key The meaning of the script is that you can let your car jump with "Z". the car jumps, but you can let it jump when it's not touching the ground. and i can't fix it, it should only jump when you touch the ground. Link to comment
Rickyz1992 Posted January 12, 2008 Author Share Posted January 12, 2008 someone could fix this? Link to comment
KaMeR Posted January 12, 2008 Share Posted January 12, 2008 function Jump ( key, keyState ) local vehicle = getPlayerOccupiedVehicle(getLocalPlayer()) if ( keyState == "down" ) and ( isVehicleOnGround( vehicle ) == true ) then end if ( isVehicleOnGround( vehicle ) ) then local x, y, z = getElementVelocity(vehicle) setElementVelocity(vehicle, x, y, z + 0.4) end end bindKey ( "z", "down", Jump ) -- bind the player's z down key try this one works for me Link to comment
Rickyz1992 Posted January 12, 2008 Author Share Posted January 12, 2008 function Jump ( key, keyState ) local vehicle = getPlayerOccupiedVehicle(getLocalPlayer()) if ( keyState == "down" ) and ( isVehicleOnGround( vehicle ) == true ) then end if ( isVehicleOnGround( vehicle ) ) then local x, y, z = getElementVelocity(vehicle) setElementVelocity(vehicle, x, y, z + 0.4) end end bindKey ( "z", "down", Jump ) -- bind the player's z down key try this one works for me Thank you very much^^ Link to comment
[email protected] Posted January 12, 2008 Share Posted January 12, 2008 By the way, you can remove: if ( keyState == "down" ) and ( isVehicleOnGround( vehicle ) == true ) then end as it does exactly nothing at all , it checks if the keystate is equal to down and if the vehicle is on the ground.. and if that is both true, then it does nothing, because you placed an "END" directly after the "THEN" 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