SetEffectDensity: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added OOP syntax)
Line 9: Line 9:
bool setEffectDensity ( effect theEffect, float density )
bool setEffectDensity ( effect theEffect, float density )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[effect]]:setDensity|density|getEffectDensity}}


===Required Arguments===  
===Required Arguments===  

Revision as of 16:43, 26 November 2014

This function sets the density of a specified effect.

Syntax

bool setEffectDensity ( effect theEffect, float density )

OOP Syntax Help! I don't understand this!

Method: effect:setDensity(...)
Variable: .density
Counterpart: getEffectDensity


Required Arguments

  • theEffect: The effect to change the speed of.
  • density: The level of density (from 0 to 2).

Returns

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

Example

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

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

See also