GetObjectModel: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function retrieves the model ID of a specified object | This function retrieves the model ID of a specified object | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
int getObjectModel ( element object ) | int getObjectModel ( element object ) | ||
Line 14: | Line 12: | ||
===Returns=== | ===Returns=== | ||
Returns an ''int'' with the object model id, or ''false'' it's no or an invalid object. | Returns an ''int'' with the object model id, or ''false'' it's no or an invalid object. | ||
==Example== | ==Example== |
Revision as of 15:53, 3 August 2007
This function retrieves the model ID of a specified object
Syntax
int getObjectModel ( element object )
Required Arguments
- object: The object which you wish to retrieve the model ID of
Returns
Returns an int with the object model id, or false it's no or an invalid object.
Example
This example destroys a haystack when a player targets it
function onPlayerTargeted ( element ) if ( getElementType ( element ) == "object" ) and ( getObjectModel ( element ) == 3374 ) then destroyElement ( element ) end end addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargeted )
This example outputs the model id of objects the player is targetting.
function onPlayerTargeted ( element ) if ( getElementType ( element ) == "object") then outputChatBox(getObjectModel ( element )) end end addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTargeted )
See Also