M MY Multiplayer: Wiki
Side
Kind

engineCreateModel

Client

Makes a new model under a name, on this client only. It is used by its name, like any other model.

element engineCreateModel(string name, string kind [, string|element parent = nil])

Parameters

NameTypeDescription
namestringThe model's name. No other resource may have made a model of this name.
kindstringobject, vehicle, ped or weapon.
parentstring|elementA model of the same kind (by name, or a model element) whose model info the new one copies: handling, vehicle type, frames, txds, flags. Required for every kind but object.default nil

Returns

The new model element. Raises an error if the arguments are wrong or the model could not be made.

Until engineSetModelDrawable and engineSetModelCol give it files, a model with a parent draws and collides as its parent does. Destroying the element or stopping the resource removes the model, and the elements using it are destroyed with it. The server never learns of it.

Example

local model = engineCreateModel("u6car", "vehicle", "infernus")
engineSetModelDrawable(model, engineLoadDrawable("models/u6car.kdr"))
engineSetModelCol(model, engineLoadCol("models/u6car.kbn"))
Coming from MTATakes the place of MTA's engineRequestModel: the model gets a name instead of a free id.

See also