From Multi Theft Auto: Wiki
This event will be triggered once a client fires his weapon.
- hitElement: the element that was hit
- posX: the position it will hit
- posY: the position it will hit
- posZ: the position it will hit
- normalX: the normal it hit ( see processLineOfSight )
- normalY: the normal it hit ( see processLineOfSight )
- normalZ: the normal it hit ( see processLineOfSight )
- materialType: the material type it hit ( see processLineOfSight )
- lighting: the lighting of the entity it hit ( see processLineOfSight )
- pieceHit: the piece of the entity it hit ( see processLineOfSight )
The source of this event is the weapon that was fired.
If this event was canceled, then the show will be canceled.
This example prevents the player from firing a Deagle.
Click to collapse [-]Client
function noDeagle() local weaponID = getElementModel(source) -- Gets the ID of the weapon. if weaponID == 24 then -- If the weapon ID is of the Deagle's then cancel the event. cancelEvent() end end addEventHandler("onClientWeaponFire", getRootElement(), noDeagle) -- Attach the event 'onClientWeaponFire' to the function.
Client event functions
FROM VERSION 1.4 r4973 ONWARDS