function onUse(cid, item, fromPosition, itemEx, toPosition)
CreatureEventChecker = function(event, ...) -- Colex
if isCreature(arg[1]) or isCreature(arg[3]) or isCreature(arg[4]) then
event(unpack(arg))
end
end
CreatureEvent = function(event, delay, ...) -- Colex
addEvent(CreatureEventChecker, delay, event, unpack(arg))
end
local txt = {"Crush", "Creeck", "Pihn", "Bosh"}
local effects = {84}
local tempo = 5
local rocks = {
[2712] = {
rockProvides = {
{rew = 2450, count = 1}},
chance = 40},
[8633] = {
rockProvides = {
{rew = 8306, count = 1}},
chance = 50},
[8740] = {
rockProvides = {
{rew = 2143, count = 1},
{rew = 2145, count = 1},
{rew = 5889, count = 1},
{rew = 1294, count = 1}},
chance = 100},
[5750]= {
rockProvides = {
{rew = 2225, count = 1},
{rew = 5880, count = 1},
{rew = 5888, count = 1}},
chance = 10},
[8634] = {
rockProvides = {
{rew = 10169, count = 1},
{rew = 2177, count = 1},
{rew = 2158, count = 1}},
chance = 10},
[8635] = {
rockProvides = {
{rew = 8303, count = 1},
{rew = 2156, count = 1},
{rew = 2147, count = 1}},
chance = 10},
[8636] = {
rockProvides = {
{rew = 2149, count = 1},
{rew = 2155, count = 1}},
chance = 10}
}
-- Blocos de encurtamento --
rocks[5867] = rocks[5866]
rocks[5868] = rocks[5866]
rocks[5920] = rocks[5619]
rocks[5921] = rocks[5619]
rocks[5922] = rocks[5619]
rocks[5923] = rocks[5619]
rocks[5924] = rocks[5619]
rocks[5622] = rocks[5619]
rocks[5623] = rocks[5619]
rocks[5751] = rocks[5750]
rocks[5752] = rocks[5750]
rocks[5753] = rocks[5750]
rocks[5754] = rocks[5750]
rocks[8741] = rocks[8740]
rocks[8742] = rocks[8740]
rocks[8743] = rocks[8740]
rocks[8749] = rocks[8748]
rocks[8750] = rocks[8748]
rocks[8751] = rocks[8748]
-------- fim blocos -------
if itemEx.itemid == 2450 then
if math.random(1, 100) >= 70 then
doTransformItem(itemEx.uid, 1423)
doDecayItem(itemEx.uid)
else
doPlayerSendCancel(cid, "Fail")
return true
end
end
if rocks[itemEx.itemid] then
local provides = rocks[itemEx.itemid].rockProvides
local itemToGive = provides[math.random(#provides)]
function o(cid)
if getPlayerStorageValue(cid, 50030) == 1 then
setPlayerStorageValue(cid, 50030, 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Quest log as been update")
end
end
if getPlayerStorageValue(cid, 21441) >= 1 then
doPlayerSendCancel(cid, "Voce so pode extrair materiais um de cada vez.")
return true
end
if not exhaustion.check(cid, 65866) then
exhaustion.make(cid, 65866, tempo)
doCreatureSetNoMove(cid, 1)
setPlayerStorageValue(cid, 21441, 1)
for i = 1, tempo do
if i ~= tempo then
CreatureEvent(doSendMagicEffect, 1000*i, toPosition, effects[math.random(#effects)], cid)
CreatureEvent(doSendAnimatedText, 1000*i, toPosition, txt[math.random(#txt)], math.random(255), cid)
else
if math.random(100) <= rocks[itemEx.itemid].chance then
CreatureEvent(doCreatureSetNoMove, 1000*tempo, cid, 0)
CreatureEvent(doPlayerAddItem, 1000*tempo, cid, itemToGive.rew,itemToGive.count)
CreatureEvent(doPlayerSendTextMessage, 1000*tempo, cid, 25, "Você encontrou um ".. getItemNameById(itemToGive.rew) ..".")
CreatureEvent(setPlayerStorageValue, 1000*tempo, cid, 21441, -1)
CreatureEvent(o, 1000*tempo, cid)
else
CreatureEvent(doPlayerSendCancel, 1000*tempo, cid, "Você não conseguiu extrair nada.")
CreatureEvent(doCreatureSetNoMove, 1000*tempo, cid, 0)
CreatureEvent(setPlayerStorageValue, 1000*tempo, cid, 21441, -1)
end
end
end
else
doPlayerSendCancel(cid, "Você só pode escavar uma rocha por vez.")
end
elseif(itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355) then
doTransformItem(itemEx.uid, 392)
doDecayItem(itemEx.uid)
doSendMagicEffect(toPosition, CONST_ME_POFF)
else
doPlayerSendCancel(cid, "Sorry not possible.")
end
return true
end
Usa esse (;
Abrços