Skip to content

engineReplaceEncryptedModel

Client-side

Authenticates, decrypts, validates, and applies a protected DFF, TXD, or COL file without exposing its key or plaintext to client Lua.

Complete example

local model = 411
local txd = assert(engineReplaceEncryptedModel("models/taxi.txd.neonasset", model))
local dff = assert(engineReplaceEncryptedModel("models/taxi.dff.neonasset", model))
local col = assert(engineReplaceEncryptedModel("models/taxi.col.neonasset", model))

Syntax

element|false engineReplaceEncryptedModel(string path, string|int model [, bool alphaTransparency = false, bool filteringEnabled = true])

Arguments

pathstring

Canonical .neonasset path declared by this resource with neon_asset="true".

modelstring|int

GTA model name or valid model ID to replace.

alphaTransparencybooloptional · default false

Enable alpha transparency when applying a DFF.

filteringEnabledbooloptional · default true

Enable texture filtering when applying a TXD.

Returns

The resource-owned DFF, TXD, or COL element after a successful authenticated replacement; false when authentication, loading, validation, or replacement fails.

Ownership and lifecycle

The server keeps the package key outside downloadable resource files and sends it as resource-scoped capability state. The client revokes and wipes that key when the resource stops; the TXD, DFF, and COL replacement elements belong to the calling resource and are cleaned up with it.

Important behavior
  • The file must belong to the calling resource, be auto-downloaded, end in .neonasset, and match that resource name and exact path used during encryption.
  • TXD should be applied before the matching DFF and COL. Clothing-model targets are intentionally rejected in format version 1.
  • The package key is transported as native resource capability state and is never passed to Lua. Resource stop revokes the key and destroys the owned replacement elements.
  • This protects cached files from trivial reuse; it cannot prevent a determined user from inspecting data while the running client is rendering it.

Where this comes from

RELATED SA:O APIS

Continue exploring

Read the system guide →