Jump to content

can any one help


nasserdfdd

Recommended Posts

Posted

You can check for the position if the player is above 1000 height, then set his gravity. Make sure that you set the gravity client-side so it's not globally set.

  • Moderators
Posted

As setGravitywon't affect ped/players, you have to use setPedGravityinstead, but this function is available on the server side only.

So you have to do this on the server-side obviously:

setTimer(function () 
    for k, player in ipairs ( getElementsByType( "player" ) ) do -- for all connected players 
        local _, _, z = getElementPosition( player ) -- get his position ( we just care about the z position ) 
        if z >= 1000 then -- if the player's z position is over or equal to 1000 
            setPedGravity( player, 0.001 ) -- lower his gravity to 0.001 
        else -- otherwise 
            setPedGravity( player, 0.008 ) -- set his gravity to default one 
        end 
    end 
end, 1000, 0) -- and do the entire thing every seconds 

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