getElementType | Multi Theft Auto: Wiki Skip to content

getElementType

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function is used to retrieve the type of an element.

Syntax

getElementType ( )

Code Examples

server

This 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

Element Functions