local config = {
items = {
{2148, 50}, -- {id, ilosc},
{2148, 80},
{9808, 1},
{7618, 1},
{9811, 1},
{2213, 1},
{2671, 5},
{2789, 5},
{2145, 2},
{5710, 1}
},
storage = 19378, -- storage
onePer = 86400 -- raz na ile (w sekundach)
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) > os.time()) then
doCreatureSay(cid, "It's empty.", TALKTYPE_ORANGE_1)
return true
end
local chanceOfItem = math.random(1, #config.items + 3)
local itemId, itemCount = config.items[chanceOfItem][1], config.items[chanceOfItem][2]
local oneItem, moreItems = "You found a ".. getItemNameById(config.items[chanceOfItem][1]) ..".", "You found a ".. itemCount .." ".. getItemNameById(config.items[chanceOfItem][1]) .."."
if(chanceOfItem > #config.items) then
doCreatureSay(cid, "You found nothing useful.", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, itemCount == 1 and oneItem or moreItems, TALKTYPE_ORANGE_1)
doPlayerAddItem(cid, config.items[chanceOfItem][1], config.items[chanceOfItem][2])
end
setPlayerStorageValue(cid, config.storage, os.time()+config.onePer)
return true
end