GetGravity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(Checked, minor fixes)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
This function returns the current gravity level for the context in which it is called (server or client).
This function returns the current gravity level


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">getGravity ()</syntaxhighlight>
<syntaxhighlight lang="lua">
getGravity()
</syntaxhighlight>


==Example==
==Example==
<syntaxhighlight lang="lua">addCommandHandler ( "gravity", "gravlevel" )
This serverside command outputs the serverside gravity level.
function gravlevel ()
<syntaxhighlight lang="lua">
     local gravity = getGravity ( )
function getGravityLevel( playerSource )
     outputConsole ( "The Gravity is currently set to " ..gravity )
     local gravity = getGravity()
end</syntaxhighlight>
     outputConsole ( "The gravity is currently set to "..gravity, playerSource )
end
-- attach the 'getGravityLevel' function to the "gravity" command
addCommandHandler ( getGravityLevel, "gravity" )
</syntaxhighlight>


==See Also==
==See Also==
{{World functions}}
{{World functions}}

Revision as of 17:13, 31 July 2007

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

Syntax

getGravity()

Example

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 ( getGravityLevel, "gravity" )

See Also