SetGravity: Difference between revisions
Jump to navigation
Jump to search
m (Affects also vehicles?) |
No edit summary |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 2: | Line 2: | ||
{{Server client function}} | {{Server client function}} | ||
This function sets the server's gravity level. | This function sets the server's gravity level. | ||
{{Note| | |||
*This will override [[setPedGravity]] applied to peds/players. | |||
*Setting the gravity level to different values on clients can cause animation bugs (players floating across ground because players see different fall animation.)}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">setGravity ( float level )</syntaxhighlight> | <syntaxhighlight lang="lua">bool setGravity ( float level )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''level''': The level of gravity ( default is '''0.008''' ) | *'''level''': The level of gravity (default is '''0.008'''). | ||
===Returns=== | |||
Returns ''true'' if gravity was changed, ''false'' otherwise. | |||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function grav ( sourcePlayer, command, level ) | function grav ( sourcePlayer, command, level ) | ||
local level = tonumber(level) | |||
if (not level) then return end | |||
setGravity ( tonumber(level) ) | setGravity ( tonumber(level) ) | ||
end | end | ||
Line 21: | Line 27: | ||
==See Also== | ==See Also== | ||
{{World functions}} | {{World functions}} | ||
[[ru:setGravity]] |
Latest revision as of 10:37, 8 May 2020
This function sets the server's gravity level.
Syntax
bool setGravity ( float level )
Required Arguments
- level: The level of gravity (default is 0.008).
Returns
Returns true if gravity was changed, false otherwise.
Example
function grav ( sourcePlayer, command, level ) local level = tonumber(level) if (not level) then return end setGravity ( tonumber(level) ) end addCommandHandler ( "setgravity", grav )
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