GetObjectModel: Difference between revisions
Jump to navigation
Jump to search
m (GetObjectModel is also working clientside) |
m (fixed typos) |
||
Line 12: | Line 12: | ||
===Returns=== | ===Returns=== | ||
Returns an ''int'' with the object model id, or ''false'' it' | Returns an ''int'' with the object model id, or ''false'' if it isn't a valid object. | ||
==Example== | ==Example== |
Revision as of 18:43, 24 November 2008
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