local noob_item = {2466,2467} -- put here id of most items to be won
local semi_item = {2494,2495} -- put here id of semi won items
local best_item = {2470,2471} --put id of rare items
function onUse(cid, item, fromPosition, itemEx, toPosition)
local r = math.random(100)
local noob = noob_item[math.random(1, #noob_item)]
local semi = semi_item[math.random(1, #semi_item)]
local best = best_item[math.random(1, #best_item)]
if r >= 1 and r < 51 then
doPlayerAddItem(cid,noob,1)
doPlayerSendTextMessage(cid,25,"Lottery bird : you have won ["..getItemNameById(noob)..".")
doSendMagicEffect(getThingPos(cid),27)
elseif r >= 51 and r < 85 then
doPlayerAddItem(cid,semi,1)
doPlayerSendTextMessage(cid,25,"Lottery bird : you have won ["..getItemNameById(semi)..".")
doSendMagicEffect(getThingPos(cid),27)
elseif r >= 85 then
doPlayerAddItem(cid,best,1)
doSendMagicEffect(getThingPos(cid),27)
doPlayerSendTextMessage(cid,25,"Lottery bird : you have won ["..getItemNameById(best)..".")
doBroadcastMessage("Lottery bird : Congratulations! "..getCreatureName(cid).." have won a ["..getItemNameById(best).."].")
end
return doRemoveItem(item.uid)
end