Jump to content

Any way to check if wheels are on the floor?


[FOTL]Aphex

Recommended Posts

I'm making a jump script that works fine so far, but I'd like it to be so that when you jump you cant jump until you're on the floor again. As it is at the moment I just have a timer that only lets you jump once every 500ms, but if they were to jump off somewhere high they could still "jump" every 500ms.

I've tried checking the Z velocity first, to make sure it was between -0.02 and 0.02, but the jump doesnt work if you're driving up or downhill... or at the peak of the jump (you're z velocity goes to 0 momentarily).

function jumpy(player) 
    local veh = getPedOccupiedVehicle(player) 
    if ok == true then 
        if (veh) then 
            local x,y,z = getElementVelocity(veh) 
            setElementVelocity (veh, x, y, z+0.2) 
            ok = false 
            setTimer(function() ok = true end,500,1)     
        end 
    end 
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...