Skip to content

addModel2DFX

Client-side

Available in Neon, not standard MTA

Adds a resource-owned 2DFX effect to a GTA model.

Syntax

bool addModel2DFX(int model, float x, float y, float z, string type, table properties)

Arguments

modelint

Model ID from 0 through 65535.

xfloat

Effect X, local to the model.

yfloat

Effect Y, local to the model.

zfloat

Effect Z, local to the model.

typestring

light, particle, roadsign, escalator or sun_glare.

propertiestable

Property table for that type. light requires all fifteen fields; sun_glare takes none.

Table keys

light

drawDistancefloatrequired

Draw distance. 0 or greater.

lightRangefloatrequired

Point light radius. 0 or greater.

coronaSizefloatrequired

Corona size. 0 or greater.

shadowSizefloatrequired

Shadow size. 0 or greater.

shadowMultiplierintrequired

Shadow intensity, 0 through 255.

showModestringrequired

Blink behavior: default, on_off_at_5, warnlight, trafficlight, traincrosslight, random_flashing, random_at_wet_weather, at_rain_only or lines.

coronaReflectionboolrequired

Whether the corona reflects on wet roads.

flareTypeintrequired

0 or 1.

flagstablerequired

Effect flags.

shadowDistanceintrequired

Signed byte, -128 through 127.

offsetVector3required

Offset from the effect position. Each axis is a signed byte, -128 through 127.

colorcolorrequired

Light colour.

coronaNamestringrequired

Corona texture name. Cannot be empty.

shadowNamestringrequired

Shadow texture name. Cannot be empty.

particle

namestringrequired

Native particle name, 1 to 23 characters. Native storage is char[24].

roadsign

sizetablerequired

Board size as {x, y}. Both greater than zero.

rotationVector3required

Board rotation.

flagstablerequired

Effect flags.

colorcolorrequired

Text colour.

text1stringrequired

First line, at most 16 characters.

text2stringrequired

Second line, at most 16 characters.

text3stringrequired

Third line, at most 16 characters.

text4stringrequired

Fourth line, at most 16 characters.

escalator

bottomVector3required

Bottom of the escalator.

topVector3required

Top of the escalator.

endVector3required

End of the escalator run.

directionintrequired

0 or 1.

Returns

true when the effect was added; false for an invalid model, position, type or property table.

Ownership and lifecycle

Custom effects belong to the resource that added them. Overrides and removals of original GTA effects are stacked per resource, so two resources editing the same model do not clobber each other, and stopping one rolls back only its own layer.

Important behavior
  • The effect belongs to the model, not to a placed object, so every instance of that model gets it.
  • Already-streamed instances need a restream before the change is visible.
  • The effect is owned by the calling resource and removed when that resource stops.

Example

addModel2DFX(1337, 0, 0, 1.2, "particle", { name = "smoke_flare" })

Where this comes from

RELATED NEON APIS

Continue exploring

Read the system guide →