Skip to content

SetHorseItems

Makes a horse’s saddlebags hold exactly this list.

What was in them is gone, the list’s items are there - in the owner’s copy of the horse (the controller’s, for a horse nobody owns) and in the server’s records, so the inventory audit counts them as the owner’s and taking them out is no cheat. A class is any key of the item catalogue; an unknown one is logged and skipped, money is left out (no saddlebag holds it), and 64 stacks at most. When a saved horse comes back, dress it first (SetHorseGear), then fill it.

SetHorseItems(id, items)
Parameter Type
id number the horse
items table a list of {class=, amount=, health=} (amount 1 and health 100 when left out), as GetHorseItems returns it

boolean - false when it is not a horse

-- a saved horse back at the login: the breed, the gear, then the bags
local x, y, z = GetPlayerPos(pid)
local horse = CreateHorse(x + 3, y, z, 0, pid, nil, saved.breed)
if horse then
SetHorseGear(horse, saved.gear)
SetHorseItems(horse, saved.items)
end

GetHorseItems · SetHorseGear · CreateHorse · the Horses group of the index