OnClientWeaponFire: Difference between revisions
Jump to navigation
Jump to search
m (→Example: No point of section as it's already only client-sided) |
No edit summary |
||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
This event will be triggered once a client fires his weapon. | This event will be triggered once a client fires his weapon. | ||
{{Note|This event is only for custom weapons that were created with [[createWeapon]], for player held weapons use [[onClientPlayerWeaponFire]].}} | |||
==Parameters== | ==Parameters== |
Revision as of 17:09, 2 September 2013
This event will be triggered once a client fires his weapon.
Parameters
element hitElement, float posX, float posY, float posZ, float normalX, float normalY, float normalZ, int materialType, int lighting, int pieceHit
- 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 )
Source
The source of this event is the weapon that was fired.
Cancel Effect
If this event was canceled, then the weapon will not fire.
Example
This example prevents the player from firing a Deagle.
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.
See Also
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled