CreateEffect: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
m (→Example) |
||
Line 25: | Line 25: | ||
== Example == | == Example == | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler("effect", | addCommandHandler("effect", | ||
Line 39: | Line 37: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
This example synchronize cam flash effect (without this only local player can see this). | This example synchronize cam flash effect (without this only local player can see this). | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Line 54: | Line 49: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== See Also == | == See Also == |
Revision as of 15:05, 18 March 2014
Syntax
effect createEffect ( string name, float x, float y, float z, [ float rX, float rY, float rZ ] )
Required Arguments
- name: A string contains effect name.
- x: A floating point number representing the X coordinate on the map.
- y: A floating point number representing the Y coordinate on the map.
- z: A floating point number representing the Z coordinate on the map.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- rX: A floating point number representing the rotation about the X axis in degrees.
- rY: A floating point number representing the rotation about the Y axis in degrees.
- rZ: A floating point number representing the rotation about the Z axis in degrees.
Returns
Returns the effect element if creation was successful, false otherwise.
Example
addCommandHandler("effect", function(cmd, name) local x, y, z = getElementPosition(localPlayer) if createEffect(name, x, y, z) then outputChatBox("Effect created!") else outputChatBox("Bad effect name.") end end )
This example synchronize cam flash effect (without this only local player can see this).
addEventHandler("onClientPlayerWeaponFire", root, function(weapon) if weapon == 43 and source ~= localPlayer then local x, y, z = getPedWeaponMuzzlePosition(source) createEffect("camflash", x, y, z) end end )