M MY Multiplayer: Wiki
Side
Kind

getElementType

Shared

Reads an element's type, such as "player", "vehicle" or the type given to createElement.

string getElementType(element element)

Parameters

NameTypeDescription
elementelementThe 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)

See also