Skip to content

OnHorseItemsChange

What a horse’s saddlebags hold or what it wears changed - the moment to save it.

The owner’s game (the controller’s, for a horse nobody owns) reported a change: something put in or taken out of the saddlebags, a saddle or bridle put on or taken off. Read the new state with GetHorseItems and GetHorseGear. It does not run for the mode’s own SetHorseItems / SetHorseGear, nor while a fill of the server’s is still landing on the owner’s screen. A mode that saves horses writes on this and on OnPlayerDisconnect instead of on a timer.

function OnHorseItemsChange(id)
-- ...
end
Parameter Type
id number the horse

nothing

function OnHorseItemsChange(id)
local owner = GetHorseOwner(id)
if not owner then return end
local stacks = #(GetHorseItems(id) or {})
Log(GetPlayerName(owner) .. "'s horse now carries " .. stacks .. " stacks")
end

GetHorseItems · GetHorseGear · SetHorseItems · the Horses group of the index