local config = {
storage = 77778,
item1 = 0, -- Item id of the item to be in the first chest.
amount1 = 0, -- Amount of that item.
item2 = 0, -- Item of the item to be in the second chest.
amount2 = 0 -- Amount of that item.
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (item.uid == 63331) then
if (getCreatureStorage(cid, config.storage) == -1) then
doPlayerAddItem(cid, config.item1, config.amount1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have recieved the item " .. getItemNameById(config.item1) .. ".")
else
doPlayerSendCancel(cid, "This chest is empty.")
end
elseif (item.uid == 63332) then
if (getCreatureStorage(cid, config.storage) == -1) then
doPlayerAddItem(cid, config.item2, config.amount2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have recieved the item " .. getItemNameById(config.item2) .. ".")
else
doPlayerSendCancel(cid, "This chest is empty.")
end
end
return true
end