• 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!

Malfunctioning mini script

survivor

New Member
Joined
Mar 20, 2008
Messages
89
Reaction score
4
Dear ppl,

I got this script (credits to ArtOfWork),
but it supossed to remove fences and let them come back and they don't come back..
they disappear but they don't come back they give this error:


[18/12/2014 21:07:27] [Error - Action Interface]
[18/12/2014 21:07:27] In a timer event called from:
[18/12/2014 21:07:27] data/actions/scripts/switch_fence UK1.lua:eek:nUse
[18/12/2014 21:07:27] Description:
[18/12/2014 21:07:27] (luaDoCreateItem) Item not found


I tried everything what did I do wrong :(
help would be appreciated,

this is the script:

Lua:
local config = {
  fence =
  { -- noticed you had more then 1 fence, so this will remove both, change the x y z to match the location of the fences
  {x=1419, y=966, z=13, stackpos=1},
         {x=1419, y=967, z=13, stackpos=1}
  },
  actionid = 801, -- action id of the switch, incase your going to use this for more then 1 switch
  itemid  = {} -- table to hold the items that are removed, incase they are different items
  }
local timer = 3 -- how many seconds until the fence respawns? 1 equals 1 second, change this for how ever many seconds
local exhaust = timer -- this will prevent people from using the switch again while the fences are waiting to spawn
function onUse(cid, item, topos, frompos)
  if item.itemid == 1945 and item.actionid == config.actionid then -- switch off or deactivated position
  if exhaust ~= nil then -- if the fences were not removed already
  exhaust = nil -- set it to nil so they can't use the switch again until the fences reapear
  for i = 1, #config.fence do -- loop for as many fences there are
  config.itemid = getThingfromPos(config.fence).itemid -- update the item id's
  doRemoveItem(getThingfromPos(config.fence).uid) -- remove the item at this location
  end
  doTransformItem(item.uid, 1946) -- switch on or activated position
  addEvent(respawn, timer * 1000) -- this will call the respawn function and resummon the items that were removed
  return true
  end
  else
  doTransformItem(item.uid, 1945)
  end
  return true
end
-- this will respawn the fences or whatever items you removed
function respawn(num)
  for n = 1, #config.fence do
  doCreateItem(config.itemid[n], 1, config.fence[n]) -- resummon the items that were removed
  end
  exhaust = timer -- reset the exhaust
end



yours,


and if I put the fence item id (1546) at "itemid {}" it doesnt work either
 
Last edited:
Code:
config.itemid[i] = getThingfromPos(config.fence).itemid
If there are problems with the stackpos you can use getTileItemById instead.
Next time use code tags.
 
I still get the error.. I don't know what's wrong.
I've got nothing stacked upon the tile.. just the fence.

And i'm a noob so please keep that in mind..

yours,
 
Back
Top