MTA:Eir/functions/engineGetModelRefCount: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ This function returns the reference count of a GTA:SA model info. The reference count describes how often a model info is used by the game (including MTA). ==Syntax==...") |
No edit summary |
||
Line 1: | Line 1: | ||
{{*Client_function}} | |||
__NOTOC__ | __NOTOC__ | ||
This function returns the reference count of a GTA:SA model info. The reference count describes how often a model info is used by the game (including MTA). | This function returns the reference count of a GTA:SA model info. The reference count describes how often a model info is used by the game (including MTA). |
Revision as of 01:42, 12 January 2014
This function returns the reference count of a GTA:SA model info. The reference count describes how often a model info is used by the game (including MTA).
Syntax
int engineGetModelRefCount ( int modelIndex )
Arguments
- modelIndex: value ranging from [0..19999] that denotes an internal model info
Returns
Returns a true if modelIndex is a valid model info index and the model info that it points to is allocated, false otherwise.
Example
Click to collapse [-]
ClientThis snippet destroys every MTA object whose model is used more than twice.
addEvent( "onClientElementModelSweep", true ); addEventHandler( "onClientElementModelSweep", root, function() for m,n in ipairs( getElementsByType( "object" ) ) do local refCount = engineGetModelRefCount( getElementModel( n ) ); if ( refCount > 2 ) then destroyElement( n ); end end end );