local rusty =
{
[9808] = {{1, 400, 2464}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}}, -- Common
[9809] = {{1, 250, 2464}, {250, 400, 2465}, {400, 600, 2483}, {600, 850, 2463}, {850, 950, 2476}, {950, 1000, 8891}}, -- Semi-Rare
[9810] = {{1, 250, 2465}, {250, 450, 2483}, {450, 600, 2463}, {600, 750, 2476}, {750, 850, 8891}, {850, 930, 2487}, {930, 970, 2466}, {970, 1000, 2472}}, -- Rare
[9811] = {{1, 400, 2464}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}}, -- Common
[9812] = {{1, 250, 2464}, {250, 400, 2465}, {400, 600, 2483}, {600, 850, 2463}, {850, 950, 2476}, {950, 1000, 8891}}, -- Semi-Rare
[9813] = {{1, 250, 2465}, {250, 450, 2483}, {450, 600, 2463}, {600, 750, 2476}, {750, 850, 8891}, {850, 930, 2487}, {930, 970, 2466}, {970, 1000, 2472}}, -- Rare
}
function removeAndEffect(item, itemEx, effectType)
doRemoveItem(item.uid, 1)
doRemoveItem(itemEx.uid, 1)
doSendMagicEffect(getThingPos(item.uid), effectType)
return TRUE
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local random = math.random(1, 1300)
if(isInArray({9808, 9809, 9810, 9811, 9812, 9813}, itemEx.itemid) ~= TRUE) then
doPlayerSendCancel(cid, "Sorry, not possible.")
return TRUE
end
if(random > 1000) then
removeAndEffect(item, itemEx, CONST_ME_BLOCKHIT)
return TRUE
end
for i, v in pairs(rusty) do
if(itemEx.itemid == i) then
for i = 1, table.maxn(v) do
if(random >= v[i][1] and random < v[i][2]) then
items = doCreateItemEx(v[i][3])
end
end
doPlayerAddItemEx(cid, items)
removeAndEffect(item, itemEx, CONST_ME_POFF)
end
end
return TRUE
end