OnPlayerWeaponFire: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (fix version) |
||
Line 1: | Line 1: | ||
{{Server event}} | {{Server event}} | ||
__NOTOC__ | __NOTOC__ | ||
{{New feature/item|3. | {{New feature/item|3.0153|1.5.3|9921| | ||
This event is called when a player fires a weapon. This does not trigger for projectiles, melee weapons, or camera. | This event is called when a player fires a weapon. This does not trigger for projectiles, melee weapons, or camera. | ||
}} | }} |
Revision as of 17:17, 22 October 2016
This event is called when a player fires a weapon. This does not trigger for projectiles, melee weapons, or camera.
Parameters
int weapon, float endX, float endY, float endZ, element hitElement, float startX, float startY, float startZ
- weapon: an int representing weapon used for making a shot.
- endX, endY, endZ: float world coordinates representing an end point.
- hitElement: an element which was hit by a shot.
- startX, startY, startZ: float world coordinates representing the start of the bullet. Note: This is not the gun muzzle.
Example
This code outputs the information on debug screen when a player shoots.
addEventHandler ("onPlayerWeaponFire", root, function (weapon, endX, endY, endZ, hitElement, startX, startY, startZ) iprint (getPlayerName(source).. " just shot a " .. getElementType (hitElement) .. " at X: ".. endX .. " Y: " .. endY .. " Z: " .. endZ .. " from X: " .. startX .. " Y: ".. startY .. " Z: " .. startZ .. " with a ".. getWeaponNameFromID (weapon)) end )
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled