IsElementAttached: Difference between revisions
Jump to navigation
Jump to search
Black Dragon (talk | contribs) mNo edit summary |
mNo edit summary |
||
Line 23: | Line 23: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- add a command handler for 'amiattached' to call the function 'consoleIsPlayerAttached': | -- add a command handler for 'amiattached' to call the function 'consoleIsPlayerAttached': | ||
function consoleIsPlayerAttached ( player, command ) | function consoleIsPlayerAttached ( player, command ) | ||
if ( player ) then -- if a player triggered this command | if ( player ) then -- if a player triggered this command | ||
Line 34: | Line 33: | ||
end | end | ||
end | end | ||
addCommandHandler ( "amiattached", consoleIsPlayerAttached ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Element_functions}} | {{Element_functions}} |
Revision as of 15:10, 15 August 2007
This functions checks whether or not an element is attached to another element.
Syntax
bool isElementAttached ( theElement )
Required Arguments
- theElement: The element to check for attachment.
Returns
Returns true if the specified element is attached to another element, false if it is not attached or if an improper argument is passed.
Example
This examples checks if a player is attached to anything when they enter a console command:
-- add a command handler for 'amiattached' to call the function 'consoleIsPlayerAttached': function consoleIsPlayerAttached ( player, command ) if ( player ) then -- if a player triggered this command local status = isElementAttached ( player ) -- call the function and store it's result in the 'status' variable if ( status ) then -- if the function returned true, tell the player he is attached to something outputConsole ( "You are attached to an element!", player ) else -- if the function returned false, tell the player he is not attached to anything outputConsole ( "You are not attached to an element.", player ) end end end addCommandHandler ( "amiattached", consoleIsPlayerAttached )
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