M MY Multiplayer: Wiki
Side
Kind

onClientAssetLoad

ClientEvent

Fired once when an asset a script started loading in the background is ready, or has failed.

addEventHandler("onClientAssetLoad", root, function(bool loaded) … end)

Handler parameters

NameTypeDescription
loadedbooltrue if it loaded, false if it could not be read, decoded or compiled.

Source

The asset: a txd from engineLoadTxd, a texture from engineCreateTexture, or a shader from engineCreateShader.

It fires only for the first load. Changing a texture's pixels later does not fire it again.

Example

local txd = engineLoadTxd("models/u6car.ktd")

addEventHandler("onClientAssetLoad", txd, function(loaded)
    if not loaded then
        outputDebugString("u6car.ktd could not be read")
        return
    end
    engineSetModelTxd("infernus", source)
end)

See also