GetElementVelocity

From Multi Theft Auto: Wiki
Revision as of 11:55, 22 July 2006 by MrJax (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

This function returns three floats containing the velocity (movement speeds) along the X, Y, and Z axis respectively. This function can fail if the element is a player in a car. Use the vehicle element in this case. If this function does fail, the first argument will be set to 'false'

Syntax

float float float getElementVelocity ( element theElement )

Required Arguments

  • theElement: The element you wish to retrieve the velocity of.

Example

speedx, speedy, speedz = getElementVelocity ( findPlayer ( "someguy" ) )
actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) 
--Raising something to the exponent of 0.5 is the same thing as taking a square root.
outputChatBox ( "Someguy's current Velocity: ", actualspeed, " arbitrary units." )

See Also