EngineStreamingRequestModel

From Multi Theft Auto: Wiki
Revision as of 09:47, 29 August 2024 by 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ADDED/UPDATED IN VERSION 1.6.1 r22676:
This function sends a loading request to the game model streamer.

Syntax

boolean engineStreamingRequestModel( number modelID [, boolean addRef = false, boolean isBlocking = false ] )

Required Arguments

  • modelID: ID of the model you want to get flags.

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.

Example

Click to collapse [-]
Simple example

This 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