getElementType
Shared
Reads an element's type, such as "player", "vehicle" or the type given to createElement.
string getElementType(element element)
Parameters
| Name | Type | Description |
|---|---|---|
| element | element | The element to read. |
Returns
The type's name.
Built-in element types
- Tree and system:
root,resource,console,file,db-connection - World and scene:
player,ped,vehicle,object,colshape,ladder,effect,light,cinematic - Audio:
sound,voice-channel - Rendering and assets:
texture,dx-font,render-target,screen-source,txd,dui,material,shader,model,drawable,col
Example
addEventHandler("onElementDestroy", root, function()
if getElementType(source) == "vehicle" then
outputDebugString("a vehicle was destroyed")
end
end)