ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. engineReplaceModel

Function

engineReplaceModel

ClientGame engineIdentical to MTA:SA

Replaces the look of a model number: with an engine asset (engineLoadAsset) or a model from a file (engineLoadMesh). Objects, vehicles and peds (skins 0-312; a file model without a skeleton is static) with that number show the new model. An object without its own collision gets one from the .dff or from the model triangles; engineReplaceCOL gives a custom collision. It works for this player, so call it in a client script. Replacing a new engineRequestModel model that the game has not created yet (the player is just joining, a resource restart) waits for it; a model number that does not exist gives false.

Syntax

bool engineReplaceModel(mesh|asset asset, int modelID [, bool alphaTransparency])

Arguments

assetmesh|asset
A file model or an engine asset.
modelIDint
Model number.
alphaTransparencybool, optional
Accepted for compatibility with existing scripts.

Returns

true on success.

Example

local mesh = engineLoadMesh("modele/skrzynka.obj")
if mesh then engineReplaceModel(mesh, 1271) end

See also