engineRequestModel
Server-side
Allocates a stable, resource-owned logical model for an object, vehicle, or ped.
Syntax
int|false engineRequestModel(string type, int parentID [, string name = ""])Arguments
typestringobject, vehicle, or ped.
parentIDintNative GTA model used for gameplay behavior and legacy fallback.
namestringoptional · default ""Optional resource-local registry name.
Returns
A logical model ID from 42341 through 65534, or false when validation, naming, quota, parent, or registry-capacity checks fail.
Ownership and lifecycle
The server keeps logical IDs stable, but each client chooses its own GTA slot. When a resource stops, Neon moves surviving elements back to their parent model before freeing those slots.
Important behavior
- Logical IDs are not reused during the server process.
- The server qualifies a non-empty name with the owning resource.
- Commit ac3a54f57 moved the range above Neon's complete FileID layout; 65535 remains the invalid-model sentinel.
Example
local model = assert(engineRequestModel("vehicle", 411, "mission_infernus"))local vehicle = createVehicle(model, 0, 0, 3)Where this comes from
SOURCECLuaModelDefs.cppServer/mods/deathmatch/logic/luadefs/CLuaModelDefs.cpp INTRODUCED / EXTENDEDa7a20d32bRead the commit and why the change was made RELATED CATEGORY HARNESS server-model-registry-test Category-level coverage · test-resources/server-model-registry-test
RELATED NEON APIS
Read the system guide → Continue exploring
← Back to the Neon Lua API · How Server-authoritative models works →