Skip to content

OnPlayerLoadHorse

A player lays the body they carry across a horse - return false to refuse.

Only while the players’ own grab is on with the rule horses (SetCarrying). The server has checked that the player carries the body, that the horse stands still within reach with nothing across it and in front of no cart; the mode has the last word. Returning false refuses - they keep carrying the body and are told they cannot - anything else lays it across the horse, and the carry ends with "loaded" (OnPlayerCarryEnd). Not run for the mode’s own orders (LoadPlayerOnHorse, LoadEntityOnHorse). kind, id and victim are as in OnPlayerCarry.

function OnPlayerLoadHorse(pid, horse, kind, id, victim)
-- ...
end
Parameter Type
pid number the player who carries the body
horse number the horse’s entity id
kind string "player", "corpse" or "actor"
id number the player’s id, or the entity id
victim number the player a corpse was; -1 otherwise

false refuses; nothing, nil or true lays the body across the horse

-- only the horse's owner may load it
function OnPlayerLoadHorse(pid, horse, kind, id, victim)
if GetHorseOwner(horse) ~= pid then
SendClientMessage(pid, COLOR_RED, "That is not your horse.")
return false
end
end

SetCarrying · OnPlayerUnloadHorse · OnHorseUnload · LoadPlayerOnHorse · the Carrying group of the index