GetPlayerGravity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
m (Changed "DeprecatedWithAlt" template to "Deprecated")
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Deprecated|getPedGravity|}}
This function returns a float that contains the current gravity for the specified [[player]].
This function returns a float that contains the current gravity for the specified [[player]].


Line 8: Line 11:


===Required Arguments===
===Required Arguments===
*'''thePlayer''': The [[player]] whose gravity you want to check
*'''thePlayer:''' The [[player]] whose gravity you want to check


===Returns===
===Returns===
Line 16: Line 19:
This example outputs the gravity of the player who entered the 'showGravity' command.
This example outputs the gravity of the player who entered the 'showGravity' command.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function showGravity( player )
function showGravity ( thePlayer )
local gravity = getPlayerGravity(player)
local gravity = getPlayerGravity ( thePlayer )
outputChatBox("Your gravity: "..tostring(gravity),player)
outputChatBox ( "Your gravity: " .. tostring(gravity), thePlayer )
end
end
addCommandHandler("showGravity", showGravity)
addCommandHandler ( "showGravity", showGravity )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Latest revision as of 16:30, 13 February 2015

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getPedGravity instead.


This function returns a float that contains the current gravity for the specified player.

Syntax

float getPlayerGravity ( player thePlayer )

Required Arguments

  • thePlayer: The player whose gravity you want to check

Returns

Returns a float indicating the player's gravity, or false if the player is invalid. Default value is 0.008.

Example

This example outputs the gravity of the player who entered the 'showGravity' command.

function showGravity ( thePlayer )
	local gravity = getPlayerGravity ( thePlayer )
	outputChatBox ( "Your gravity: " .. tostring(gravity), thePlayer )
end
addCommandHandler ( "showGravity", showGravity )

See Also

Shared