GetElementType
From Multi Theft Auto: Wiki
This function is used to retrieve the type of an element.
Syntax
string getElementType ( element theElement )
OOP Syntax Help! I don't understand this!
- Method: element:getType(...)
- Variable: .type
Required Arguments
- theElement: The element you wish to get the type of.
Returns
Returns a string containing the element type, false if invalid arguments were passed.
Example
Click to collapse [-]
ServerThis example destroys a haystack when a player targets it
function onPlayerTarget ( targetElem ) -- if the targeted object is a haystack (an object with model ID 3374) remove it from the game if getElementType ( targetElem ) == "object" and getElementModel ( targetElem ) == 3374 then destroyElement ( targetElem ) end end addEventHandler ( "onPlayerTarget", root, onPlayerTarget ) -- add above function as handler for targeting event
See Also
- attachElements
- clearElementVisibleTo
- cloneElement
- createElement
- destroyElement
- detachElements
- getAllElementData
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementCollisionsEnabled
- getElementByID
- getElementByIndex
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementColShape
- getElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementSyncer
- getElementType
- getElementVelocity
- getElementZoneName
- getElementsByType
- getElementsWithinColShape
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementVisibleTo
- isElementWithinColShape
- isElementWithinMarker
- removeElementData
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementSyncer
- setElementVelocity
- setElementVisibleTo
- setLowLODElement