getElementModel | Multi Theft Auto: Wiki Skip to content

getElementModel

Client-side
Server-side
Shared

Pair: setElementModel

Manual Review Required

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


Returns the model ID of a given element. This can be a player/ped skin, a pickup model, an object model or a vehicle model.

OOP Syntax Help! I don't understand this!

  • Method:element:getModel(...)
  • Variable: .model

Syntax

int getElementModel ( element theElement )
Required Arguments
  • theElement: the element to retrieve the model ID of.

Returns

  • int: value

Returns the model ID if successful, false otherwise.

Code Examples

shared

This example destroys a haystack when a player targets it.It only works with elements created by MTA.

addEventHandler ("onPlayerTarget", root,
function(targetElem)
if (isElement(targetElem)) and (getElementType(targetElem)=="object") and (getElementModel(targetElem)==3374) then
destroyElement (targetElem)
end
end
)

See Also

Element Functions