setEffectDensity | Multi Theft Auto: Wiki Skip to content

setEffectDensity

Client-side
Server-side
Shared

Pair: getEffectDensity

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function sets the density of a specified effect.

Caution

Upper density limit of this function depends on client FX Quality setting. The limit is 1 for Low, 1.5 for Medium, and 2 for High/Very high.

OOP Syntax Help! I don't understand this!

  • Method: effect:setDensity(...)
  • Variable: .density

Syntax

bool setEffectDensity ( effect theEffect, float density )
Required Arguments
  • theEffect: The effect to change the speed of.
  • density: The level of density (from 0 to 2).

Returns

  • bool: value

Returns true if the density was succesfully changed, false otherwise.

Code Examples

shared

This example adds commandsedthat creates spray effect at the player's position and sets its density to 2.

addCommandHandler("sed",
function (cmd)
local x, y, z = getElementPosition(localPlayer)
local effect = createEffect("spraycan", x, y, z)
setEffectDensity(effect, 2)
end)