EngineStreamingRequestModel: Difference between revisions
Jump to navigation
Jump to search
TheNormalnij (talk | contribs) (Created page with "__NOTOC__ {{Client function}} {{New feature/item|4|1.6.1|22676|This function sends a loading request to the game model streamer.}} ==Syntax== <syntaxhighlight lang="lua"> boolean engineStreamingRequestModel( number modelID [, boolean addRef = false, boolean isBlocking = false ] ) </syntaxhighlight> ===Required Arguments=== * '''modelID''': ID of the model you want to get flags. ===Optional Arguments=== {{OptionalArg}} * '''addRef''': increase references counter to pr...") |
TheNormalnij (talk | contribs) (References counter) |
||
(One intermediate revision by the same user not shown) | |||
Line 10: | Line 10: | ||
===Required Arguments=== | ===Required Arguments=== | ||
* '''modelID''': ID of the model you want to | * '''modelID''': ID of the model you want to load | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
Line 19: | Line 19: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if a new request was created, '''false''' otherwise. | Returns ''true'' if a new request was created, '''false''' otherwise. | ||
===References counter=== | |||
This function has individual references counter for each resource. If you called '''engineStreamingRequestModel''' with increasing the counter twice, you should call '''engineStreamingReleaseModel''' twice to decrease the counter. | |||
MTA resets the counter after stopping a resource and calling [[engineFreeModel]]. | |||
==Example== | ==Example== |
Latest revision as of 10:55, 29 August 2024
Syntax
boolean engineStreamingRequestModel( number modelID [, boolean addRef = false, boolean isBlocking = false ] )
Required Arguments
- modelID: ID of the model you want to load
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- addRef: increase references counter to prevent the model from unloading.
- isBlocking: load model immediately or use async loading.
Returns
Returns true if a new request was created, false otherwise.
References counter
This function has individual references counter for each resource. If you called engineStreamingRequestModel with increasing the counter twice, you should call engineStreamingReleaseModel twice to decrease the counter. MTA resets the counter after stopping a resource and calling engineFreeModel.
Example
Click to collapse [-]
Simple exampleThis example draws a model
local modelId = 1337 local function drawMyModel() dxDrawModel3D(modelId, 0, 0, 4, 0, 0, 0) end local function startDraw() engineStreamingRequestModel(modelId, true, true) addEventHandler("onClientPreRender", root, drawMyModel) end local function stopDraw() engineStreamingReleaseModel(modelId, true) removeEventHandler("onClientPreRender", root, drawMyModel) end
See Also
- engineAddImage
- engineApplyShaderToWorldTexture
- engineFreeModel
- engineGetModelFlags
- engineGetModelIDFromName
- engineGetModelLODDistance
- engineGetModelNameFromID
- engineGetModelPhysicalPropertiesGroup
- engineGetModelTextureNames
- engineGetModelTextures
- engineGetModelTXDID
- engineGetModelVisibleTime
- engineGetObjectGroupPhysicalProperty
- engineGetSurfaceProperties
- engineGetVisibleTextureNames
- engineImageGetFilesCount
- engineImageGetFiles
- engineImageGetFile
- engineImageLinkDFF
- engineImageLinkTXD
- engineImportTXD
- engineLoadCOL
- engineLoadDFF
- engineLoadIMG
- engineLoadIFP
- engineLoadTXD
- engineRemoveImage
- engineRemoveShaderFromWorldTexture
- engineReplaceAnimation
- engineReplaceCOL
- engineReplaceModel
- engineRequestModel
- engineResetModelFlags
- engineResetModelLODDistance
- engineResetSurfaceProperties
- engineRestoreAnimation
- engineRestoreCOL
- engineRestoreDFFImage
- engineRestoreModel
- engineRestoreModelPhysicalPropertiesGroup
- engineRestoreObjectGroupPhysicalProperties
- engineRestoreTXDImage
- engineRestreamWorld
- engineSetAsynchronousLoading
- engineSetModelFlag
- engineSetModelFlags
- engineSetModelLODDistance
- engineSetModelPhysicalPropertiesGroup
- engineSetModelVisibleTime
- engineSetObjectGroupPhysicalProperty
- engineSetSurfaceProperties
- engineStreamingFreeUpMemory
- engineStreamingGetUsedMemory