Skip to content

OnHorseItemsChange

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

The server’s record of the saddlebags changed because the player whose game holds them (the owner, else the rider, else the one whose game simulates the horse) moved something between their bag and the saddlebags and the server accepted it, or that player’s game reported 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 holder’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