Serginov
Onkonkoronkonk
I want the text to be like "You found a that, a that, a that and a that" and to get the cap out of all items(I don't know if it will work as I have it now) when you open the chest depending how many items there is configured. Here's the script so far(Please correct any misstakes too or stuff that won't work
);
Code:
local chests = {
[8560] = {storage = 1000, items = {1234, 1235, 1236}},
[8561] = {storage = 1001, items = {2412, 3431}},
[8562] = {storage = 1002, items = {3531, 9481, 3987, 9313}},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = chests[item.uid]
for _,c in ipairs(v.items) do
if v then
if getCreatureStorage(cid, v.storage) ~= 1 then
if getPlayerFreeCap(cid) >= getItemWeightById(c) then
doCreatureSetStorage(cid, v.storage, 1)
doPlayerAddItem(cid, c, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You found a that a that a that a that and a that!")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have enough capiticity!")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
end
end
end
return true
end