addModel2DFX
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
modelintModel ID from 0 through 65535.
xfloatEffect X, local to the model.
yfloatEffect Y, local to the model.
zfloatEffect Z, local to the model.
typestringlight, particle, roadsign, escalator or sun_glare.
propertiestableProperty table for that type. light requires all fifteen fields; sun_glare takes none.
Table keys
light
drawDistancefloatrequiredDraw distance. 0 or greater.
lightRangefloatrequiredPoint light radius. 0 or greater.
coronaSizefloatrequiredCorona size. 0 or greater.
shadowSizefloatrequiredShadow size. 0 or greater.
shadowMultiplierintrequiredShadow intensity, 0 through 255.
showModestringrequiredBlink behavior: default, on_off_at_5, warnlight, trafficlight, traincrosslight, random_flashing, random_at_wet_weather, at_rain_only or lines.
coronaReflectionboolrequiredWhether the corona reflects on wet roads.
flareTypeintrequired0 or 1.
flagstablerequiredEffect flags.
shadowDistanceintrequiredSigned byte, -128 through 127.
offsetVector3requiredOffset from the effect position. Each axis is a signed byte, -128 through 127.
colorcolorrequiredLight colour.
coronaNamestringrequiredCorona texture name. Cannot be empty.
shadowNamestringrequiredShadow texture name. Cannot be empty.
particle
namestringrequiredNative particle name, 1 to 23 characters. Native storage is char[24].
roadsign
sizetablerequiredBoard size as {x, y}. Both greater than zero.
rotationVector3requiredBoard rotation.
flagstablerequiredEffect flags.
colorcolorrequiredText colour.
text1stringrequiredFirst line, at most 16 characters.
text2stringrequiredSecond line, at most 16 characters.
text3stringrequiredThird line, at most 16 characters.
text4stringrequiredFourth line, at most 16 characters.
escalator
bottomVector3requiredBottom of the escalator.
topVector3requiredTop of the escalator.
endVector3requiredEnd of the escalator run.
directionintrequired0 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.
- 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" })