OnClientPlayerWasted: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Grammar correction)
m (n)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client event}}
{{Client event}}
{{New feature/item|3.0161|1.6.0|22620|
This event is triggered whenever a player, including those remote, dies.
This event is triggered whenever a player, including those remote, dies.
}}


==Parameters==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
element killer, int weapon, int bodypart, bool stealth
element killer, int weapon, int bodypart, bool stealth, int animGroup, int animID
</syntaxhighlight>  
</syntaxhighlight>


*'''killer''': A [[player]], [[ped]] or [[vehicle]] [[element]] representing the killer.
*'''killer''': A [[player]], [[ped]] or [[vehicle]] [[element]] representing the killer.
Line 13: Line 15:
{{BodyParts}}
{{BodyParts}}
*'''stealth''': A [[boolean]] representing whether or not this was a stealth kill.
*'''stealth''': A [[boolean]] representing whether or not this was a stealth kill.
*'''animGroup''': An [[int|integer]] representing the player's current animation group.
{{New feature/item|3.0161|1.6.0|22620|
*'''animID''': An [[int|integer]] representing the player's current animation ID.
*'''animGroup''': an [[int|integer]] representing the player's current animation group.
}}
{{New feature/item|3.0161|1.6.0|22620|
*'''animID''': an [[int|integer]] representing the player's current animation ID.
}}


==Source==
==Source==

Latest revision as of 12:23, 1 June 2025

ADDED/UPDATED IN VERSION 1.6.0 r22620:

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

Parameters

element killer, int weapon, int bodypart, bool stealth, int animGroup, int animID
  • killer: A player, ped or vehicle element representing the killer.
  • weapon: An integer representing the killer weapon or the damage types.
  • bodypart: An integer representing the bodypart the player was damaged.
    • 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.
ADDED/UPDATED IN VERSION 1.6.0 r22620:
  • animGroup: an integer representing the player's current animation group.
ADDED/UPDATED IN VERSION 1.6.0 r22620:
  • animID: an integer representing the player's current animation ID.

Source

The source of this event is the player that died.

Example

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
end)

See Also

Client player events


Client event functions