M MY Multiplayer: Wiki
Side
Kind

engineSetModelTexture

Client

Swaps a texture on every instance of a model. Only that model's materials change, not the txd the texture comes from.

bool engineSetModelTexture(string|element model, string name, texture|dui|bool source [, int priority = 0])

Parameters

NameTypeDescription
modelstring|elementThe model's name, or a model element from engineCreateModel. It need not be loaded yet.
namestringThe texture name its materials use, or a glob pattern.
sourcetexture|dui|boolA texture, a dui, or false to hide the texture.
priorityintAmong several swaps for the same texture, the highest priority answers; among equals, the newest.default 0

Returns

true once the swap is set. Raises an error if no model has that name or the source is not an image or false.

A model's swaps answer under an element's (engineSetElementTexture) and over the world's (engineSetWorldTexture).

Example

local lights = engineCreateTexture("images/lights.png")
engineSetModelTexture("infernus", "vehiclelights128", lights)

See also