GetElementAttachedTo: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (fix oop syntax) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | {{Server client function}} | ||
This function | __NOTOC__ | ||
This function determines the element that the specified element is attached to. | |||
==Syntax== | ==Syntax== | ||
Line 6: | Line 7: | ||
element getElementAttachedTo ( element theElement ) | element getElementAttachedTo ( element theElement ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[element]]:getAttachedTo||}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 14: | Line 16: | ||
==Example== | ==Example== | ||
This example | <section name="Server" class="server" show="true"> | ||
This example defines a console command that outputs the type of the element that the player is attached to. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function getAttached ( thePlayer ) | |||
function | local attached = getElementAttachedTo ( thePlayer ) | ||
if ( attached ) then | |||
outputConsole ( getPlayerName(thePlayer) .. " is attached to a " .. getElementType(attached) ) | |||
else | |||
outputConsole ( getPlayerName(thePlayer) .. " is not attached to an element" ) | |||
outputConsole ( " | |||
outputConsole ( "not attached to an element" ) | |||
end | end | ||
end | end | ||
addCommandHandler ( "getattached", getAttached ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Element_functions}} | {{Element_functions}} |
Latest revision as of 22:53, 1 January 2015
This function determines the element that the specified element is attached to.
Syntax
element getElementAttachedTo ( element theElement )
OOP Syntax Help! I don't understand this!
- Method: element:getAttachedTo(...)
Required Arguments
- theElement: The element you require the information for.
Returns
Returns the element that the chosen element is attached to, or false if the element isn't attached to another element.
Example
Click to collapse [-]
ServerThis example defines a console command that outputs the type of the element that the player is attached to.
function getAttached ( thePlayer ) local attached = getElementAttachedTo ( thePlayer ) if ( attached ) then outputConsole ( getPlayerName(thePlayer) .. " is attached to a " .. getElementType(attached) ) else outputConsole ( getPlayerName(thePlayer) .. " is not attached to an element" ) end end addCommandHandler ( "getattached", getAttached )
See Also
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement