OnHorseDeath
A horse died.
A blow took its last health (attacker the player), SetHorseHealth 0 did, or its own game killed it (a fall; -1).
It lies on every screen, nobody can mount it, its rider is off it - thrown, where their throws are on (SetPlayerRiderThrow;
OnPlayerThrown follows with THROW_HORSE), else set on foot beside it at once (OnPlayerDismount follows) - and the
body is removed a minute later (DestroyEntity sooner). A mode that keeps horses marks it dead here.
Syntax
Section titled “Syntax”function OnHorseDeath(id, attacker) -- ...end| Parameter | Type | |
|---|---|---|
id |
number | the horse |
attacker |
number | the player whose blow killed it; -1 = nobody |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”function OnHorseDeath(id, attacker) local owner = GetHorseOwner(id) if owner and attacker >= 0 then SendClientMessage(owner, 0xC04040FF, GetPlayerName(attacker) .. " killed your horse.") endendSee also
Section titled “See also”OnHorseDamage · SetHorseHealth · OnPlayerThrown · the Horses group of the index
