EngineGetModelNameFromID

From Multi Theft Auto: Wiki
Revision as of 13:55, 26 September 2011 by Arran Fortuna (talk | contribs) (Created page with "{{Client function}} __NOTOC__ This function gets the model name of an object model from model ID. ==Syntax== <syntaxhighlight lang="lua"> string engineGetModelNameFromID ( int modelID ) </cod...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Syntax

string engineGetModelNameFromID ( int modelID )

Required Arguments

  • modelID: The model ID of the object

Returns

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

Example

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