- Documentation
- Server events
- onPedWasted
Event
onPedWasted
A ped (NPC) died.
Handler
addEventHandler("onPedWasted", root, function(totalAmmo, killer, killerWeapon, bodypart, stealth) ... end)Parameters
totalAmmoint- Ammo.
killerelement- The killer or
false. killerWeaponint- Weapon.
bodypartint- Body part.
stealthbool- Stealth kill.
Differences from MTA:SA
- These MTA:SA parameters are not here:
int animGroup,int animID
In MTA:SA
function(int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth, int animGroup, int animID)Source
source is the ped.
Example
addEventHandler("onPedWasted", root, function(_, killer)
if killer and getElementType(killer) == "player" then givePlayerMoney(killer, 25) end
setTimer(destroyElement, 5000, 1, source)
end)
See also
onPedDamageA ped (NPC) took damage.createPedCreates a new NPC ped on the server (a pedestrian driven by the game, not by a player) and shows it right away to every player nearby. The ped gets 100 health, a random appearance variant (clothes and skin tone, seesetPedVariant) and belongs to the resource that created it, so it disappears together with that resource onstop. Optionally it can be made aggressive straight away or told to attack a chosen target.