M MY Multiplayer: Wiki
Side
Kind

engineRequestModel

Client

Asks the streamer to load a model and keeps it loaded for this resource until it is released.

bool engineRequestModel(string|element model [, bool blocking = false])

Parameters

NameTypeDescription
modelstring|elementThe model's name, or a model element made with engineCreateModel.
blockingbooltrue loads the model right away, holding the game until it is done.default false

Returns

true when the request was made. With blocking, whether the model is loaded when the function returns.

Each resource holds its own request. The model stays loaded until every resource that asked for it calls engineReleaseModel or stops.

Example

engineRequestModel("infernus")

setTimer(function()
    if engineHasModelLoaded("infernus") then
        outputDebugString("infernus is ready")
    end
end, 1000, 1)
Coming from MTAIn MTA, engineRequestModel creates a new model. Here it loads an existing one, as SA's REQUEST_MODEL opcode does. To create a model, use engineCreateModel.
NoteA name no model has, or a model without a drawable (collision only, for example), raises an error.

See also