Jump to content

help with mine script


Rickyz1992

Recommended Posts

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

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