Documentation Shared functions engineFreeModel
Function
engineFreeModel
Frees a model from engineRequestModel . On the server the model is shared: objects, cars and peds using it get the parent model; on the client it frees the local model. A named model keeps its number in model-ids.json unless forgetName = true.
Syntax bool engineFreeModel (int modelID [, bool forgetName = false] )
Arguments
modelIDint Model number.
forgetNamebool, optional = false true = also free the number bound to the name.Not in MTA:SA
Differences from MTA:SA In MTA:SA this function is client-side only. Arguments in a different colour differ from MTA:SA. In MTA:SA
engineFreeModel(int modelID)
Example
server.lua Copy
local id = engineRequestModel ("object" , 1337 )
engineFreeModel (id)
See also engineRequestModelCreates a new model under a new number, shared by every player (also those who join later). An object ("object"/"timed-object", parent 1337 by default) gets a number from the 18631-19999 pool and is a copy of the parent; engineReplaceModel and engineReplaceCOL give it a look and a collision. A vehicle ("vehicle", parent 400), a ped ("ped", parent 7) and a tuning part ("upgrade", parent 1000-1193) get a number 20000-29999 and behave like the parent (seats, sound, handling, tuning), while engineReplaceModel in a client script gives the look. The third argument is a specific number or a name: the same name always gives the same number (stored in the server's model-ids.json), so cars and objects from a database are still that model after a restart, and a named model stays when the resource stops. On the client, the name of a server model returns its shared number. A model requested on the client before the game has loaded its models gets its number at once and is created once loading finishes.