ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client events
  3. onClientWeaponFire

Event

onClientWeaponFire

A script weapon fired (fireWeapon on the server). Arguments: the weapon number, the weapon position and the target point.

Handler

addEventHandler("onClientWeaponFire", root, function(weapon, x, y, z, targetX, targetY, targetZ) ... end)

Parameters

weaponint
Weapon number.Different type in MTA:SA: element hitElement
x, y, zfloat
Weapon position.
targetX, targetY, targetZfloat
Target point.

Differences from MTA:SA

  • Parameters in a different colour differ from MTA:SA.
  • These MTA:SA parameters are not here: int materialType, float lighting, int pieceHit

In MTA:SA

function(element hitElement, float posX, float posY, float posZ, float normalX, float normalY, float normalZ, int materialType, float lighting, int pieceHit)

Source

source is the script weapon.

Example

addEventHandler("onClientWeaponFire", root, function(weapon, x, y, z, tx, ty, tz)
    fxAddBulletImpact(tx, ty, tz, 0, 0, 1)
end)

Notes

No hit element. The event does not get the hit element, the hit point or the normal.

See also