MTA:Eir/functions/engineGetModelRefCount
Jump to navigation
Jump to search
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 the model reference count 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 );