fxAddSparks | Multi Theft Auto: Wiki Skip to content

fxAddSparks

Client-side
Server-side
Shared

Creates a number of sparks originating from a point or along a line.

OOP Syntax Help! I don't understand this!

  • Method:Effect.addSparks(...)

Syntax

bool fxAddSparks ( ​float posX, ​float posY, ​float posZ, ​float dirX, ​float dirY, ​float dirZ, [ ​float force = 1.0, ​int count = 1, ​float acrossLineX = 0.0, ​float acrossLineY = 0.0, ​float acrossLineZ = 0.0, ​bool blur = false, ​float spread = 1.0, ​float life = 1.0 ] )
Required Arguments
  • posX: The world X coordinate where the effect originates.
  • posY: The world Y coordinate where the effect originates.
  • posZ: The world Z coordinate where the effect originates.
  • dirX: The direction X coordinate of the effect. The longer the distance from position is, the faster sparks fly.
  • dirY: The direction Y coordinate of the effect. The longer the distance from position is, the faster sparks fly.
  • dirZ: The direction Z coordinate of the effect. The longer the distance from position is, the faster sparks fly.
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • force (default: 1.0): The higher this value, the faster and further the sparks fly.
  • count (default: 1): The number of effects to create.
  • acrossLineX (default: 0.0): If specified, the sparks will be created along a line going from pos to pos - acrossLine. If not specified, all sparks originate from the point at pos.
  • acrossLineY (default: 0.0): If specified, the sparks will be created along a line going from pos to pos - acrossLine. If not specified, all sparks originate from the point at pos.
  • acrossLineZ (default: 0.0): If specified, the sparks will be created along a line going from pos to pos - acrossLine. If not specified, all sparks originate from the point at pos.
  • blur (default: false): if false, creates standard bullet impact-like sparks. If true, adds motion blur to the sparks.
  • spread (default: 1.0): determines how strongly the particles deviate from each other. With low values the particles will stay quite close together, high values will make them fly in all directions. Also affects their speed.
  • life (default: 1.0): the higher this value, the longer the sparks survive before they disappear.

Returns

  • bool: result

Returns a true if the operation was successful, false otherwise.

Code Examples

client

This example will add Fire Bins to all locations added in the table.

local fires = {
{0, 0, 3} --Middle of SA
}
for i = 1, #fires do
local bin = createObject(1362, fires[i][1], fires[i][2], fires[i][3]-0.5)
local torch = createObject(3461, fires[i][1]-0.1, fires[i][2]-0.1, fires[i][3]-2)
local light = createMarker(fires[i][1], fires[i][2], fires[i][3]+0.2, "corona", 1, 255, 170, 0, 80, root)
local fireCol = createColSphere(fires[i][1], fires[i][2], fires[i][3]+0.5, 0.8)
setTimer(fxAddSparks, math.random(4000, 5000), 0, fires[i][1]+math.random(0.1, 0.3), fires[i][2]+math.random(0.1, 0.2), fires[i][3]+0.2, 1, 1, 1)
addEventHandler("onClientColShapeHit", fireCol, function(theElement)
if (getElementType(theElement) == "player") then
setPedOnFire(theElement, true)
end
end)
end