GetGravity: Difference between revisions
Jump to navigation
Jump to search
m (Fixed section) |
No edit summary |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float getGravity() | float getGravity() | ||
Line 11: | Line 10: | ||
===Returns=== | ===Returns=== | ||
Returns a float with the current server or client (depending on where you call the function) gravity level. | Returns a float with the current server or client (depending on where you call the function) gravity level. | ||
==Example== | ==Example== | ||
Line 18: | Line 16: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function getGravityLevel( playerSource ) | function getGravityLevel( playerSource ) | ||
local gravity = getGravity() | local gravity = getGravity ( ) | ||
outputConsole ( "The gravity is currently set to "..gravity, playerSource ) | outputConsole ( "The gravity is currently set to " .. gravity, playerSource ) | ||
end | end | ||
-- attach the 'getGravityLevel' function to the "gravity" command | -- attach the 'getGravityLevel' function to the "gravity" command | ||
addCommandHandler ( | addCommandHandler ( "gravity", getGravityLevel ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{World functions}} | {{World functions}} | ||
[[ru:getGravity]] |
Latest revision as of 09:53, 7 March 2010
This function returns the current gravity level for the context in which it is called (server or client).
Syntax
float getGravity()
Returns
Returns a float with the current server or client (depending on where you call the function) gravity level.
Example
Click to collapse [-]
ServerThis 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
- areTrafficLightsLocked
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGravity
- getHeatHaze
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getOcclusionsEnabled
- getRainLevel
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getWeather
- getWindVelocity
- getSkyGradient
- getPlayerBlurLevel
- getZoneName
- isGarageOpen
- removeWorldModel
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetWindVelocity
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setCloudsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorSoundsEnabled
- setMinuteDuration
- setMoonSize
- setOcclusionsEnabled
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setWeather
- setWeatherBlended
- setWindVelocity
- setJetpackMaxHeight
- setPlayerBlurLevel