• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Compact Script?

bomba

Member
Joined
Feb 26, 2008
Messages
635
Reaction score
7
Location
Brazil
Someone help me compress this script.

Code:
local baup = {x=7528, y=7386, z=8}
local bauup = {x=7528, y=7390, z=9}
local bauuup = {x=7528, y=7390, z=10}

function campFireOn(item)
  local w1p = {x=7530, y=7391, z=8}
  local w1 = getTileItemById(w1p, 1426)
    if doRemoveItem(w1.uid, 1) == true then
      doCreateItem(1425, 1, w1p)
    end
  return true
end

function campFireOnn(item)
  local w2p = {x=7530, y=7395, z=9}
  local w2 = getTileItemById(w2p, 1426)
    if doRemoveItem(w2.uid, 1) == true then
      doCreateItem(1425, 1, w2p)
    end
  return true
end

function campFireOnnn(item)
  local w3p = {x=7530, y=7395, z=10}
  local w3 = getTileItemById(w3p, 1426)
    if doRemoveItem(w3.uid, 1) == true then
      doCreateItem(1425, 1, w3p)
    end
  return true
end

function remBau(item)
  local bauu1 = getTileItemById(baup, 1746)
    if doRemoveItem(bauu1.uid, 1) == true then
      return true
    end
  return true
end

function remBauu(item)
  local bauu2 = getTileItemById(bauup, 1746)
    if doRemoveItem(bauu2.uid, 1) == true then
      return true
    end
  return true
end

function remBauuu(item)
  local bauu3 = getTileItemById(bauuup, 1746)
    if doRemoveItem(bauu3.uid, 1) == true then
      return true
    end
  return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if ((itemEx.actionid == 11109) and (itemEx.itemid == 1425)) then
      doTransformItem(itemEx.uid, 1426)
      addEvent(campFireOn, 2*60*1000, item)
      doSendMagicEffect(baup, CONST_ME_FIREWORK_BLUE)
      local bau = doCreateItem(1746, 1, baup)
      doSetItemActionId(bau, 11110)
      addEvent(remBau, 1*60*1000, item)

    elseif ((itemEx.actionid == 11111) and (itemEx.itemid == 1425)) then
      doTransformItem(itemEx.uid, 1426)
      addEvent(campFireOnn, 2*60*1000, item)
      doSendMagicEffect(bauup, CONST_ME_FIREWORK_BLUE)
      local bauu = doCreateItem(1746, 1, bauup)
      doSetItemActionId(bauu, 11110)
      addEvent(remBauu, 1*60*1000, item)

    elseif ((itemEx.actionid == 11112) and (itemEx.itemid == 1425)) then
      doTransformItem(itemEx.uid, 1426)
      addEvent(campFireOnnn, 2*60*1000, item)
      doSendMagicEffect(bauuup, CONST_ME_FIREWORK_BLUE)
      local bauuu = doCreateItem(1746, 1, bauuup)
      doSetItemActionId(bauuu, 11110)
      addEvent(remBauuu, 1*60*1000, item)
    end
  doDecayItem(doCreateItem(POOL, 0, toPosition))
  doRemoveItem(item.uid, 1)

  return true
end
 
Code:
function campFireOn(pos)
   if doRemoveItem(getTileItemById(pos, 1426).uid, 1) then
     doCreateItem(1425, 1, pos)
     return true
   end
   return false
end

function remBau(pos)
doRemoveItem(getTileItemById(pos, 1746).uid, 1)
return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
   local actionids = {
     [11109] = {{x=7528, y=7386, z=8}, {x=7530, y=7391, z=8}},
     [11111] = {{x=7528, y=7390, z=9}, {x=7530, y=7395, z=9}},
     [11112] = {{x=7528, y=7390, z=10}, {x=7530, y=7395, z=10}}
   }

   if(not itemEx.itemid == 1425) then
     return false
   end

   if actionids[itemEx.actionid] == nil then
    return false
   end

  local baup = actionids[itemEx.actionid]
  doSendMagicEffect(baup[1], CONST_ME_FIREWORK_BLUE)
  doTransformItem(itemEx.uid, 1426)
  doSetItemActionId(doCreateItem(1746, 1, baup[1]), 11110)
  addEvent(campFireOn, 120000, baup[2])
  addEvent(remBau, 120000, baup[1])
  doDecayItem(doCreateItem(POOL, 0, toPosition))
  doRemoveItem(item.uid, 1)
  return true
end
 
Back
Top