GetObjectModel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(added example)
Line 2: Line 2:


__NOTOC__  
__NOTOC__  
This fake function retrieves the model ID of a specified object
This function retrieves the model ID of a specified object


==Syntax==  
==Syntax==  
Line 16: Line 16:


==Example==  
==Example==  
This example does...
This example destroys a haystack when a player targets it
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
addEventHandler ( onPlayerTargeted, root, onPlayerTargeted )
blabhalbalhb --abababa
function onPlayerTargeted ( element )
--This line does this...
    if getElementType ( element ) == "object" and getObjectModel ( element ) == 3374 then
mooo
        destroyElement ( element )
    end
end     
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Object Functions}}
{{Object functions}}

Revision as of 15:42, 13 August 2006


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 ( onPlayerTargeted, root, onPlayerTargeted )
function onPlayerTargeted ( element )
    if getElementType ( element ) == "object" and getObjectModel ( element ) == 3374 then
        destroyElement ( element )
    end
end      

See Also