OnPedWasted: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Add beta header)
 
(11 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server event}}
{{Server event}}
{{Needs Example}}
This event is triggered when a ped is killed or dies. It is not triggered for players.
This event is triggered when a ped is killed or dies. It is not triggered for players.


==Parameters==
==Parameters==
<syntaxhighlight lang="lua">int totalAmmo, element killer, int killerWeapon, int bodypart [, bool stealth ]
{{New feature/item|3.0161|1.6.0|22620|
<syntaxhighlight lang="lua">
int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth, int animGroup, int animID
</syntaxhighlight>
}}
 
{{Deprecated_feature|3|1.0|<syntaxhighlight lang="lua">
int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth
</syntaxhighlight>
</syntaxhighlight>
}}


*'''totalAmmo''': an integer representing the total ammo the victim had when he died.
*'''totalAmmo''': an [[int]] representing the total ammo the victim had when he died.
*'''killer''': an [[element]] representing the player or vehicle who was the killer.  If there was no killer this is ''false''.
*'''killer''': an [[element]] representing the [[player]], [[ped]] or [[vehicle]] who was the killer.  If there was no killer this is ''false''.
*'''killerWeapon''': an integer representing the [[Weapons|killer weapon]] or the [[Death Reasons|death reason]].
*'''killerWeapon''': an [[int]] representing the [[Weapons|killer weapon]] or the [[Damage Types|damage types]].
*'''bodypart''': an integer representing the bodypart ID the victim was hit on when he died.
*'''bodypart''': an [[int]] representing the bodypart ID the victim was hit on when he died.
{{BodyParts}}
{{BodyParts}}
*'''stealth''': boolean value representing whether or not this was a stealth kill
*'''stealth''': a [[boolean]] representing whether or not this was a stealth kill.
{{New feature/item|3.0161|1.6.0|22620|
*'''animGroup''': an [[int|integer]] representing the ped's current animation group.
}}
{{New feature/item|3.0161|1.6.0|22620|
*'''animID''': an [[int|integer]] representing the ped's current animation ID.
}}


==Source==
==Source==
Line 19: Line 32:


==Example==
==Example==
This example outputs to the console that the ped is now dead.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
ped1 = createPed(112, 0, 0, 0) --Create our Ped
ped1 = createPed(112, 0, 0, 0) --Create our Ped
function died()
function died()
     outputChatBox("Your Ped is dead now!", player)
     outputConsole("Your Ped is dead now!")
end
end
addEventHandler("onPedWasted", ped1, died) --Add the Event when ped1 dies
addEventHandler("onPedWasted", ped1, died) --Add the Event when ped1 dies
</syntaxhighlight>
</syntaxhighlight>


==See Also==
{{See also/Server event|Ped events}}
{{Ped_events}}

Latest revision as of 21:02, 15 July 2024

This event is triggered when a ped is killed or dies. It is not triggered for players.

Parameters

ADDED/UPDATED IN VERSION 1.6.0 r22620:
int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth, int animGroup, int animID
  • totalAmmo: an int representing the total ammo the victim had when he died.
  • killer: an element representing the player, ped or vehicle who was the killer. If there was no killer this is false.
  • killerWeapon: an int representing the killer weapon or the damage types.
  • bodypart: an int representing the bodypart ID the victim was hit on when he died.
  • 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 ped's current animation group.
ADDED/UPDATED IN VERSION 1.6.0 r22620:
  • animID: an integer representing the ped's current animation ID.

Source

The source of this event is the ped that died or got killed.

Example

This example outputs to the console that the ped is now dead.

ped1 = createPed(112, 0, 0, 0) --Create our Ped
function died()
    outputConsole("Your Ped is dead now!")
end
addEventHandler("onPedWasted", ped1, died) --Add the Event when ped1 dies

See Also

Ped events


Event functions