GetPedGravity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: {{Server function}} __NOTOC__ This function returns the current gravity for the specified ped. The default gravity is 0.008. ==Syntax== <syntaxhighlight lang="lua"> float getPedGravity ( ped thePed ...)
 
(Added OOP syntax)
Line 7: Line 7:
float getPedGravity ( ped thePed )
float getPedGravity ( ped thePed )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[ped]]:getGravity|gravity|setPedGravity}}


===Required Arguments===
===Required Arguments===

Revision as of 17:12, 26 November 2014

This function returns the current gravity for the specified ped. The default gravity is 0.008.

Syntax

float getPedGravity ( ped thePed )

OOP Syntax Help! I don't understand this!

Method: ped:getGravity(...)
Variable: .gravity
Counterpart: setPedGravity


Required Arguments

  • thePed: The ped whose gravity you want to check.

Returns

Returns a float indicating the ped's gravity, or false if the ped 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 = getPedGravity ( thePlayer )
	outputChatBox ( "Your gravity: " .. tostring(gravity), thePlayer )
end
addCommandHandler ( "showGravity", showGravity )

See Also