engineGetModelIDFromName | Multi Theft Auto: Wiki Skip to content

engineGetModelIDFromName

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 gets the model ID of an object model from object name. This function is the counterpart of engineGetModelNameFromID.

Syntax

engineGetModelIDFromName ( )

Code Examples

client

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

function getTargetModelNameAndID(target)
if ( isElement(target) and getElementType(target) == "object" ) then
local modelName = tostring(engineGetModelNameFromID(getElementModel(target)))
outputChatBox("Name: "..modelName)
-- Although we could just use getElementModel(target) for this example we will use modelName
outputChatBox("ID: "..tostring(engineGetModelIDFromName(modelName)))
end
end
addEventHandler("onClientPlayerTarget", localPlayer, getTargetModelNameAndID)

See Also

Engine Functions
Engine Elements