fxAddGunshot | Multi Theft Auto: Wiki Skip to content

fxAddGunshot

Client-side
Server-side
Shared

This function creates a gunshot particle effect.

OOP Syntax Help! I don't understand this!

  • Method:Effect.addGunshot(...)

Syntax

bool fxAddGunshot ( ​float posX, ​float posY, ​float posZ, ​float dirX, ​float dirY, ​float dirZ, [ ​bool includeSparks = true ] )
Required Arguments
  • posX: The world X coordinate where the effect originates.
  • posY: The world Y coordinate where the effect originates.
  • posZ: The world Z coordinate where the effect originates.
  • dirX: The direction X coordinate where the bullet is fired.
  • dirY: The direction Y coordinate where the bullet is fired.
  • dirZ: The direction Z coordinate 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.

  • includeSparks (default: true): A bool representing whether the particle effect will generate sparks.

Returns

  • bool: result

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

Code Examples

client

This example adds a gunshot with 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)