MTA:Eir/functions/engineGetModelRefCount: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Renamed template) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{ | {{MTA:Eir/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). | ||
Line 12: | Line 12: | ||
===Returns=== | ===Returns=== | ||
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== | ==Example== |
Latest revision as of 08:07, 28 September 2023
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 );