FxAddBulletImpact: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
 
[[Image:Fxbulletimpact.png|thumb|200px|Bullet impact]]
Creates a bullet impact particle effect.
Creates a bullet impact particle effect, consisting of a small smoke cloud and a number of sparks.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool fxAddBulletImpact ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ, [int smokeSize=1, int sparkCount=1, float smokeIntensity=1.0] )
bool fxAddBulletImpact ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ [, int smokeSize = 1, int sparkCount = 1, float smokeIntensity = 1.0 ] )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[Effect]].addBulletImpact}}


===Required Arguments===
===Required Arguments===
Line 14: Line 15:


===Optional Arguments===
===Optional Arguments===
{{OptionalArg}}
*'''smokeSize:''' the size of the smoke cloud.
*'''smokeSize:''' the size of the smoke cloud.
*'''sparkCount:''' the number of sparks to create.
*'''sparkCount:''' the number of sparks to create.
*'''smokeIntensity:''' the amount/transparency of smoke, ranges from 0 to 1.
*'''smokeIntensity:''' the amount/transparency of smoke, ranges from 0 to 1.
===Returns===
Returns a true if the operation was successful, false otherwise.
==Example==
<section name="Client" class="client" show="true">
This example will create a Bullet Impact Effect on the position of the bullet impact.
<syntaxhighlight lang="lua">
addEventHandler("onClientPlayerWeaponFire", root, function(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement)
    if weapon == 0 then return end -- If the player is unarmed, return end.
    fxAddBulletImpact(hitX, hitY, hitZ, 0, 0, 0, math.random(1, 2), math.random(2, 5), 1.0)
end)
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client Effects functions}}
{{Client Effects functions}}

Latest revision as of 10:01, 21 June 2019

Bullet impact

Creates a bullet impact particle effect, consisting of a small smoke cloud and a number of sparks.

Syntax

bool fxAddBulletImpact ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ [, int smokeSize = 1, int sparkCount = 1, float smokeIntensity = 1.0 ] )

OOP Syntax Help! I don't understand this!

Method: Effect.addBulletImpact(...)


Required Arguments

  • posX, posY, posZ: the world coordinates where the effect originates.
  • dirX, dirY, dirZ: a vector indicating the direction of the effect.

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.

  • smokeSize: the size of the smoke cloud.
  • sparkCount: the number of sparks to create.
  • smokeIntensity: the amount/transparency of smoke, ranges from 0 to 1.

Returns

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

Example

Click to collapse [-]
Client

This example will create a Bullet Impact Effect on the position of the bullet impact.

addEventHandler("onClientPlayerWeaponFire", root, function(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement)
    if weapon == 0 then return end -- If the player is unarmed, return end.
    fxAddBulletImpact(hitX, hitY, hitZ, 0, 0, 0, math.random(1, 2), math.random(2, 5), 1.0)
end)

See Also