Skip to content

setObjectMaterial

Client-side

Available in Neon, not standard MTA

Applies an SA-MP-style texture and/or color override to one DFF material slot on a client object.

Syntax

bool setObjectMaterial(object theObject, int slot, int sourceModel, string txdName, string textureName [, int materialColor = 0])

Arguments

theObjectobject

Client object to modify.

slotint

Material slot from 0 through 15.

sourceModelint

Model that owns the source TXD, or 0/-1 for color-only behavior.

txdNamestring

Source TXD name.

textureNamestring

Source texture name; none may be used for color-only behavior.

materialColorintoptional · default 0

SA-MP ARGB material color; 0 preserves the target color.

Returns

true when the material definition and source texture were accepted; false otherwise.

Ownership and lifecycle

Parsing creates inert data. Objects, custom models, material overrides, removals, and any temporary streaming-limit split remain owned by the calling client resource and must be cleaned up when that resource stops.

Important behavior
  • The override survives object stream-out and is reapplied when the GTA object is recreated.
  • Slot N is applied to material N on every atomic in the model, matching SA-MP indexing.

OOP aliases

  • object:setMaterial(slot, sourceModel, txdName, textureName, materialColor)

Where this comes from

RELATED NEON APIS

Continue exploring

Read the system guide →