From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This event is triggered whenever a player, including those remote, dies.


element killer, int weapon, int bodypart, bool stealth
  • 3: Torso
  • 4: Ass
  • 5: Left Arm
  • 6: Right Arm
  • 7: Left Leg
  • 8: Right Leg
  • 9: Head
  • stealth: A boolean representing whether or not this was a stealth kill.


The source of this event is the player that died.


This example outputs a mocking message when the local player dies.

local messages = {
	"Better luck next time",
	"Don't think you're so cool now, do you?",
	"Nice one, pal",
	"Your opinion is void"

-- add an event for the local player only
addEventHandler("onClientPlayerWasted", localPlayer, function(killer, weapon, bodyPart)
	local randomMessage = messages[math.random(#messages)] -- get a random message from the table
	outputChatBox(randomMessage, 255, 0, 0) -- output the message

See Also

Client player events

Client event functions