getGravity | Multi Theft Auto: Wiki Skip to content

getGravity

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function returns the current gravity level for the context in which it is called (server or client).

Syntax

float getGravity ( )

Returns

  • float: value

Returns a float with the current server or client (depending on where you call the function) gravity level.

Code Examples

shared

This serverside command outputs the serverside gravity level.

function getGravityLevel( playerSource )
local gravity = getGravity ( )
outputConsole ( "The gravity is currently set to " .. gravity, playerSource )
end
-- attach the 'getGravityLevel' function to the "gravity" command
addCommandHandler ( "gravity", getGravityLevel )

See Also

World Functions