onClientPlayerHitByWaterCannon | Multi Theft Auto: Wiki Skip to content

onClientPlayerHitByWaterCannon

Client-side
Server-side
Shared

This event is fired when a player is hit by a water cannon.

This event is only triggered for players that are streamed in

Parameters

player playerHit
  • playerHit: the player which got shot by the water cannon

Source

element: The source of this event is the vehicle who shot the water cannon.

Canceling

If this event is canceled, the player will not be knocked down.

Code Examples

client

This example outputs a message when you are hit by a water cannon

addEventHandler("onClientPlayerHitByWaterCannon",getRootElement(),
function(player)
local driver = getVehicleOccupant(source)
if isElement(driver) then
outputChatBox(getPlayerName(player).." is hit by the cannon of "..getPlayerName(driver).."'s vehicle.")
end
end
)

See Also