• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Avesta] Add Exhaust for Digging

Eldora

Banned User
Joined
Oct 19, 2009
Messages
604
Reaction score
26
Need help to add exhaustion for using shovel on ground ID: 231
Using Avesta server.


shovel.lua
Code:
local MUD_HOLE        =    482
local duration = 1 * 60000 -- 3 minutes

function doTransformSandHole(parameters)
local thing = getTileItemById(parameters.pos, MUD_HOLE)
local newItem = doTransformItem(thing.uid, parameters.oldType)
end

function onUse(cid, item, frompos, item2, topos)
if item2.itemid == 28 then
  return 0
end
if item2.itemid == 468 then
  doTransformItem(item2.uid,469)
  doDecayItem(item2.uid)
elseif item2.itemid == 481 then
  doTransformItem(item2.uid,482)
  doDecayItem(item2.uid)
elseif (item2.itemid == 231 and item2.actionid == 4000) then
  doSendMagicEffect(topos,2)
  local randd = math.random(1,5)
  if randd < 2 then
  doTransformItem(item2.uid, 482)
  addEvent(doTransformSandHole, duration, {oldType = item2.itemid, pos = topos})
  doDecayItem(item2.uid)
  doSendMagicEffect(topos,2)
   end
elseif item2.itemid == 483 then
  doTransformItem(item2.uid,484)
  doDecayItem(item2.uid)
elseif item2.itemid == 231 then
  rand = math.random(1,35)
  if (rand == 20) then
      doPlayerAddItem(cid,2159,1)
  elseif (rand == 30) then
     doSummonCreature("Scarab", topos)
  else
   doSendMagicEffect(topos,2)
  end
else
  return 0
end
return 1
end
 
try:
Code:
local MUD_HOLE        =    482
local duration = 1 * 60000 -- 3 minutes
local exhaustionStorage = 06660
local time = 15

function doTransformSandHole(parameters)
local thing = getTileItemById(parameters.pos, MUD_HOLE)
local newItem = doTransformItem(thing.uid, parameters.oldType)
end

function onUse(cid, item, frompos, item2, topos)
if not(exhaustion.check(cid,exhaustionStorage)) then
if item2.itemid == 28 then
  return 0
end
if item2.itemid == 468 then
  doTransformItem(item2.uid,469)
  doDecayItem(item2.uid)
   exhaustion.set(cid,exhaustionStorage,time)
elseif item2.itemid == 481 then
  doTransformItem(item2.uid,482)
  doDecayItem(item2.uid)
  exhaustion.set(cid,exhaustionStorage,time)
elseif (item2.itemid == 231 and item2.actionid == 4000) then
  doSendMagicEffect(topos,2)
  local randd = math.random(1,5)
  if randd < 2 then
  doTransformItem(item2.uid, 482)
  addEvent(doTransformSandHole, duration, {oldType = item2.itemid, pos = topos})
  doDecayItem(item2.uid)
  doSendMagicEffect(topos,2)
  exhaustion.set(cid,exhaustionStorage,time)
   end
elseif item2.itemid == 483 then
  doTransformItem(item2.uid,484)
  doDecayItem(item2.uid)
  exhaustion.set(cid,exhaustionStorage,time)
elseif item2.itemid == 231 then
  rand = math.random(1,35)
  if (rand == 20) then
      doPlayerAddItem(cid,2159,1)
      exhaustion.set(cid,exhaustionStorage,time)
  elseif (rand == 30) then
     doSummonCreature("Scarab", topos)
     exhaustion.set(cid,exhaustionStorage,time)
  else
   doSendMagicEffect(topos,2)
  end
else
  return 0
end
return 1
end
 
Back
Top