engineGetModelNameFromID | Multi Theft Auto: Wiki Skip to content

engineGetModelNameFromID

Client-side
Server-side
Shared

Pair: engineGetModelIDFromName

This function gets the model name of an object model from model ID.

OOP Syntax Help! I don't understand this!

  • Method:Engine.getModelNameFromID(...)

Syntax

string|false engineGetModelNameFromID ( ​int modelID )
Required Arguments
  • modelID: The model ID of the object.

Returns

  • string|false: model name

Returns a string with the name of the object model, false otherwise.

Code Examples

client

This example gets the model name of an element you target (doesn't work for San Andreas world).

function getTargetModelName(target)
if (isElement(target) and getElementType(target) == "object") then
outputChatBox(tostring(engineGetModelNameFromID(getElementModel(target))))
end
end
addEventHandler("onClientPlayerTarget", localPlayer, getTargetModelName)

See Also

Engine Functions