M MY Multiplayer: Wiki
Side
Kind

createEffect

Shared

Creates a particle effect in the world. On the server every client sees it; on a client, only that client does.

effect|false createEffect(string name, float x, y, z [, float rx, ry, rz = 0, 0, 0])

Parameters

NameTypeDescription
namestringThe effect's name, as a pack or engineAddEffects registered it. From 1 to 255 bytes.
x, y, zfloatPosition in the world, three numbers or a vec3.
rx, ry, rzfloatRotation in degrees, three numbers or a vec3.default 0, 0, 0

Returns

The created effect element, or false if it could not be created. On a client, also false when no effect has that name.

To make the effect follow an element, attach it with attachElements; the socket can be a ped's bone or a vehicle's or object's part. While the target is streamed out or the effect is outside the focused dimension, it waits and plays again with the same colour, scale and evolutions.

An effect a client created is destroyed once it is over or its target is gone. A server's effect stays until the server destroys it; a client joining later does not see a one-shot effect that is already over.

Example

addCommandHandler("fogo", function()
    local pos = getElementPosition(localPlayer)
    local fire = createEffect("fire_large", pos.x, pos.y + 3, pos.z - 1)
    setTimer(stopEffect, 5000, 1, fire)
end)
Coming from MTATakes only the name, position and rotation. Colour, scale and evolutions are changed afterwards with setEffectColor, setEffectScale and setEffectEvolution.

See also