GetElementRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
{{Client function}}
{{Server client function}}
__NOTOC__  
__NOTOC__  
Retrieve the rotation of elements.
Retrieve the rotation of elements.
'''Only clientside before 1.0.4'''


==Syntax==
==Syntax==

Revision as of 18:16, 24 June 2010

Retrieve the rotation of elements.

Only clientside before 1.0.4

Syntax

float float float getElementRotation ( element theElement )       

Required Arguments

  • theElement: The element whose rotation will be retrieved

Returns

Returns three floats if element exists and is a valid element, false in if it's invalid.

Example

If a player points at a player element with a gun, its rotation will appear in the chat box.

Click to collapse [-]
Client
function onPlayerTargeted ( targetElem )
    if ( isElement(targetElem) and getElementType (targetElem) == "player" ) then
        local x,y,z = getElementRotation ( targetElem )
        outputChatBox ( "Target player rotation: " .. x .. " " .. y .. " " .. z )
    end
end
addEventHandler ( "onClientPlayerTarget", getRootElement(), onPlayerTargeted )

See Also