GetElementAngularVelocity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(First creation (please check if that info is correct, i am no c++ expert))
 
mNo edit summary
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
{{New feature/item|3.0156|1.5.5|14060|Gets the current angular velocity of a specified, supported element.}}
{{New feature/item|3.0156|1.5.5|14165|Gets the current angular velocity of a specified, supported element.}}


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool getElementAngularVelocity ( element theElement )           
float, float, float getElementAngularVelocity ( element theElement )           
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[element]]:getAngularVelocity|angularVelocity|setElementAngularVelocity}}
{{OOP||[[element]]:getAngularVelocity|angularVelocity|setElementAngularVelocity}}
Line 12: Line 12:


===Returns===
===Returns===
Returns ''true'' if it was succesful, ''false'' otherwise.
Returns three floats describing the x, y and z rotation


==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler("getangularvelocity", function(player)
addCommandHandler("getangularvelocity",  
    --retrieve angular velocity of the player
function(sourcePlayer, commandName)
    local avx, avy, avz = getElementAngularVelocity(player)
local aX, aY, aZ = getElementAngularVelocity(sourcePlayer)
    outputChatBox("Your current angular velocity is: X: "..avx.." Y: "..avy.." Z: "..avz, player, 0, 255, 0, false)
 
end)
outputChatBox("Your current angular velocity is: X: " .. aX .." Y: " .. aY .." Z: " .. aZz, sourcePlayer)
end
)
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|1.5.5-9.14060|1.5.5-9.14060|}}


==See Also==
==See Also==
{{Element functions}}
{{Element functions}}

Latest revision as of 01:34, 11 December 2022

Gets the current angular velocity of a specified, supported element.

Syntax

float, float, float getElementAngularVelocity ( element theElement )           

OOP Syntax Help! I don't understand this!

Method: element:getAngularVelocity(...)
Variable: .angularVelocity
Counterpart: setElementAngularVelocity


Required Arguments

Returns

Returns three floats describing the x, y and z rotation

Example

addCommandHandler("getangularvelocity", 
	function(sourcePlayer, commandName)
		local aX, aY, aZ = getElementAngularVelocity(sourcePlayer)

		outputChatBox("Your current angular velocity is: X: " .. aX .." Y: " .. aY .." Z: " .. aZz, sourcePlayer)
	end
)

Requirements

Minimum server version 1.5.5-9.14060
Minimum client version 1.5.5-9.14060

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.5.5-9.14060" client="1.5.5-9.14060" />

See Also