Skip to content

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.

function OnHorseDeath(id, attacker)
-- ...
end
Parameter Type
id number the horse
attacker number the player whose blow killed it; -1 = nobody

nothing

function OnHorseDeath(id, attacker)
local owner = GetHorseOwner(id)
if owner and attacker >= 0 then
SendClientMessage(owner, 0xC04040FF, GetPlayerName(attacker) .. " killed your horse.")
end
end

OnHorseDamage · SetHorseHealth · OnPlayerThrown · the Horses group of the index