GetObjectModel: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
|||
Line 16: | Line 16: | ||
This example destroys a haystack when a player targets it | This example destroys a haystack when a player targets it | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler ( " | addEventHandler ( "onPlayerTarget", root, "onPlayerTargeted" ) | ||
function onPlayerTargeted ( element ) | function onPlayerTargeted ( element ) | ||
if ( getElementType ( element ) == "object" ) and ( getObjectModel ( element ) == 3374 ) then | if ( getElementType ( element ) == "object" ) and ( getObjectModel ( element ) == 3374 ) then |
Revision as of 15:04, 24 June 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 integer of the object ID.
Example
This example destroys a haystack when a player targets it
addEventHandler ( "onPlayerTarget", root, "onPlayerTargeted" ) function onPlayerTargeted ( element ) if ( getElementType ( element ) == "object" ) and ( getObjectModel ( element ) == 3374 ) then destroyElement ( element ) end end
See Also