GetObjectModel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (fixed typos)
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server client function}}
{{Server client function}}
{{Deprecated}}
This function retrieves the model ID of a specified object
This function retrieves the model ID of a specified object



Revision as of 17:03, 3 April 2009

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be a more generic way to perform what it does.

This function retrieves the model ID of a specified object

Syntax

int getObjectModel ( object theObject )

Required Arguments

  • theObject: The object which you wish to retrieve the model ID of

Returns

Returns an int with the object model id, or false if it isn't a valid object.

Example

This example destroys a haystack when a player targets it.

function onPlayerTargeted ( targetElem )
    if ( getElementType ( targetElem ) == "object" ) and ( getObjectModel ( targetElem ) == 3374 ) then
        destroyElement ( targetElem )
    end
end
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargeted )


This example outputs the model id of objects the player is targeting.

function onPlayerTargeted ( targetElem )
    if ( getElementType ( targetElem ) == "object") then
        outputChatBox ( getObjectModel(targetElem) )
    end
end
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargeted )

See Also