Uissu

[X-TIBIA][TALKACTION] Change IDs in Area

Feb 5th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. function onSay(cid, words, param)
  2.     local table, config = {
  3.         toClose = {[idportaaberta] = idportafechada}, -- Coloque aqui os ids das portas seguindo o exemplo, a segunda tabela vai ser criada sozinha
  4.         toOpen = {}
  5. }, {
  6.         fromPos = {x=x,y=y,z=z},
  7.          toPos = {x=x,y=y,z=z}
  8. }
  9.  
  10.     for opened,closed in ipairs(table.toClose) do
  11.         table.toOpen[closed] = opened
  12.     end
  13.  
  14.     for x=config.fromPos.x, config.toPos.x do
  15.         for y=config.fromPos.y, config.toPos.y do
  16.             local doorPos = {x=x,y=y,z=config.fromPos.z}
  17.             for stack=1,20 do
  18.                 doorPos.stackpos = stack
  19.                 for _,to in ipairs(table) do
  20.                     door = getThingFromPos(doorPos)
  21.                     if to[door.itemid] then
  22.                         doTransformThing(door.uid, to[door.itemid])
  23.                     end
  24.                 end
  25.             end
  26.         end
  27.     end
  28. return true
  29. end
Advertisement
Add Comment
Please, Sign In to add comment