SetPlayerGravity: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Deprecated function) |
||
(7 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{Deprecated|setPedGravity}} | |||
__NOTOC__ | __NOTOC__ | ||
==Description== | ==Description== | ||
This function sets the gravity level of a player. | This function sets the gravity level of a player. | ||
Line 11: | Line 13: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | |||
This example allows the user to type a command to change their gravity: | This example allows the user to type a command to change their gravity: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function consoleSetPlayerGravity ( thePlayer, commandName, level ) | |||
if ( thePlayer and level ) then | |||
end</syntaxhighlight> | local success = setPedGravity ( thePlayer, tonumber ( level ) ) -- Sets the gravity | ||
if (not success) then --Check if setPlayerGravity was false (not successful) | |||
outputConsole( "Failed to set player gravity", thePlayer ) -- If success is false, meaning gravity could not be set, this message will show | |||
end | |||
end | |||
end | |||
addCommandHandler ( "setplayergravity", consoleSetPlayerGravity )</syntaxhighlight></section> | |||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} | ||
{{Server function}} |
Latest revision as of 17:17, 30 August 2016
This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. | |
Please use setPedGravity instead. |
Description
This function sets the gravity level of a player.
Syntax
setPlayerGravity ( player thePlayer, float level )
Required Arguments
- thePlayer: The player whose gravity to change.
- level: The level of gravity ( default is 0.008 )
Example
Click to collapse [-]
ServerThis example allows the user to type a command to change their gravity:
function consoleSetPlayerGravity ( thePlayer, commandName, level ) if ( thePlayer and level ) then local success = setPedGravity ( thePlayer, tonumber ( level ) ) -- Sets the gravity if (not success) then --Check if setPlayerGravity was false (not successful) outputConsole( "Failed to set player gravity", thePlayer ) -- If success is false, meaning gravity could not be set, this message will show end end end addCommandHandler ( "setplayergravity", consoleSetPlayerGravity )
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState