Jump to content

setting gravity


ramrod

Recommended Posts

AHHH so its not in the meta like i thought, will try tht ow :D

thnx

ahh ok, so i did that...but it doesnt work.

what is the problem here

function grav ( sourcePlayer, command, level )

setGravity ( 0.0035(level) )

end

addCommandHandler ( "setgravity", grav )

Link to comment

ohhh i edited that cos thats what i thought u had t odo LOL. my bad, thanks, ill figure something out :D

ok, so i tried to fiddle around, and it still doesnt work, where abouts do i put the gravity number i want it to be? where would i bet the 0.0035

Link to comment

Sorry I mis-read the doc for setGravity() - it doesn't affect players/vehicles. You'd need to do something like:

  
function setGravityForPlayer(player) 
    setPlayerGravity(player,0.0035) 
end 
  
addCommandHandler("setgravity", 
    function(player,cmd) 
        for _,player in pairs(getElementsByType("player")) do 
            setGravityForPlayer(player) 
        end 
    end 
) 
  
addEventHandler('onPlayerSpawn',getRootElement(), 
    function() 
        setTimer(setGravityForPlayer,1000,1,source) 
    end 
) 
  

The command now loops though the players and sets their gravity. Then each time a player spawns the same setting is made - this allows people who join after the command has been issued, to have their gravity set the same.

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