I need some help to set up this mining system.
1 - If mine something, remove the item that was broken (stones, trees...)
2 - Make the broken item reappear after 5 minutes.
1 - If mine something, remove the item that was broken (stones, trees...)
2 - Make the broken item reappear after 5 minutes.
Lua:
local SKINS = {
-- Normal Pick
[5908] = {
-- Stones
[4259] = {25, 5876},
[4262] = {25, 5876},
[4256] = {25, 5876},
[4256] = {25, 5876},
[4256] = {25, 5876},
-- Blue Cave Crystal
[3104] = {25, 5877},
[2844] = {25, 5877},
-- Green Cave Crystal
[2881] = {25, 5948},
[2881] = {25, 5948},
-- Red Cave Crystal
[2931] = {25, 5893},
[2931] = {25, 5893},
-- Light Blue Cave Crystal
[3031] = {25, 5925}
[3031] = {25, 5925}
},
-- Axe
[5942] = {
-- Trees
[2956] = {25, 5905},
[2956] = {25, 5905},
[2956] = {25, 5905},
[2956] = {25, 5905},
[2956] = {25, 5905},
-- Bushes
[2916] = {25, 5906}
[2916] = {25, 5906}
[2916] = {25, 5906}
[2916] = {25, 5906}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local skin = SKINS[item.itemid][itemEx.itemid]
if(skin == nil) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
local random, effect = math.random(1, 100), CONST_ME_MAGIC_GREEN
if(random <= skin[1]) then
doPlayerAddItem(cid, skin[2], 1)
elseif(skin[3] and random >= skin[3]) then
doPlayerAddItem(cid, skin[4], 1)
else
effect = CONST_ME_POFF
end
doSendMagicEffect(toPosition, effect)
doTransformItem(itemEx.uid, itemEx.itemid + 1)
return true
end
Last edited: