random_items = {
{10,2160,1}, -- 0.1% do 1cc
{10,2160,2}, -- 0.1% do 2cc
{10,2160,3}, -- 0.1% do 3cc
{10,2160,4}, -- 0.1% do 4cc
{10,2160,5}, -- 0.1% do 5cc
{10,2160,6}, -- 0.1% do 6cc
{10,2160,7}, -- 0.1% do 7cc
{10,2160,8}, -- 0.1% do 8cc
{10,5741,10}, -- 0.3% do skul helmet
{120,2798,1}, -- % do blood herb
{20,2152,6}, -- 2% do 6 platinum coins
{20,2056,1}, -- 2% do wypalonej pochodni
{40,2152,3}, -- 4% do 3 platinum coins
{20,2361,1}, -- 8% do orzeszkow
{80,2146,4}, -- 8% do 4 small sapphires
{80,7759,2}, -- 8% do enchanted small sapphire
{80,2643,1}, -- 8% do butow xd
{80,2152,1}, -- 8% do platinum coin
{250,2131,1}, -- 10% do star amulet
{150,2139,1}, -- 15% do tira
{150,2229,1}, -- 15% do smieci
{150,2230,1}, -- 15% do smieci
{150,2233,1}, -- 15% do smieci
{400,2148,60}, -- 20% do 60 gold coins
{400,2153,1}, -- 30% do 2 small sapphires
{400,2148,40}, -- 40% do 40 gold coins
{1000,2148,21} -- 100% do 20 gold coins
}
function onUse(cid, item, frompos, itemEx, topos)
if isInArray({8633,8634,8635,8636}, itemEx.itemid) and item.itemid == 4874 then
if getPlayerLevel(cid) >= 5 then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
local item = random_items[i]
if (math.random(0,999) < item[1]) then
reward = item[2]
subtype = item[3]
if subtype > 1 then
count = subtype .. " "
end
break
end
end
doPlayerAddItem(cid, reward, subtype)
doSendMagicEffect(topos,34)
doCreatureAddHealth(cid,-math.random(0,15))
doPlayerAddExp(cid,100)
if math.random(1,5) == 1 then
doTransformItem(itemEx.uid, itemEx.itemid+4)
end
end
end
return true
end