GetElementType
Jump to navigation
Jump to search
This function is used to retrieve the type of an Element.
Syntax
string getElementType ( element theElement )
Required Arguments
- theElement: The element you wish to get the type of.
Returns
There are a total of 11 strings this function returns:
- "player": A player connected to the server
- "vehicle":: A vehicle
- "object": An object
- "pickup": A pickup
- "blip": A blip
- "marker": A marker
- "spawnpoint": A spawnpoint
- "remoteclient": A remote client connected to the server
- "colshape": A collision shape
- "console": The server Console
- "unknown": Unknown element type
This function will return false if theElement is invalid.
Example
This example destroys a haystack when a player targets it
--Add an event, so the server knows to wait for someone to start targeting stuff addEventHandler ( "onPlayerTargeted", root, "onPlayerTargeted" ) --Add the function that runs when the event is tripped function onPlayerTargeted ( element ) --If the targetted object is a haystack remove it from the game. if ( getElementType ( element ) == "object" ) and ( getObjectModel ( element ) == 3374 ) then destroyElement ( element ) end end
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