FxAddGunshot: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 21: Line 21:


==Example==
==Example==
This example adds a sparks in front of your face
<section name="Client" class="client" show="true">
This example adds a sparks in front of your face.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler("fshot", function()
addCommandHandler("sshot", function()
     local x, y, z = getElementPosition(localPlayer)
     local x, y, z = getElementPosition(localPlayer)
     fxAddGunshot(x, y+0.5, z+0.5, 0, 0, 0, true)
     fxAddGunshot(x, y+0.5, z+0.5, 0, 0, 0, true)
end)
end)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client Effects functions}}
{{Client Effects functions}}
[[Category:Needs_Example]]
[[Category:Needs_Example]]

Revision as of 00:51, 9 June 2012

Gunshot

This function creates a gunshot particle effect.

Syntax

bool fxAddGunshot ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ, [bool includeSparks=true] )

Required Arguments

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

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.

  • includeSparks: A bool representing whether the particle effect will generate sparks.

Returns

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

Example

Click to collapse [-]
Client

This example adds a sparks in front of your face.

addCommandHandler("sshot", function()
    local x, y, z = getElementPosition(localPlayer)
    fxAddGunshot(x, y+0.5, z+0.5, 0, 0, 0, true)
end)

See Also