engineStreamingReleaseModel | Multi Theft Auto: Wiki Skip to content

engineStreamingReleaseModel

Client-side
Server-side
Shared

Pair: engineStreamingRequestModel

Added in 1.6.0 r22676

This function sends a unloading request to the game model streamer.

Important

If the model was loaded using engineStreamingRequestModel with the addRef argument set to true, then when calling this function you should also set the second argument (removeRef) to true.

Syntax

bool engineStreamingReleaseModel ( ​number modelID, [ ​bool removeRef = false ] )
Required Arguments
  • modelID: ID of the model you want to unload.
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • removeRef (default: false): Decrease references counter.

Returns

  • bool: result

Returns true if the model was unloaded, false otherwise or throws error if invalid model ID is passed.

Code Examples

client

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

Engine Functions