Guest User

Untitled

a guest
Mar 7th, 2015
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. local pos = {
  2.     -- amount of 'fromPosition' indexes must match the amount of 'toPosition'
  3.     ['fromPosition'] = {
  4.         {['x'] = 33331, ['y'] = 44444, ['z'] = 7},
  5.         {['x'] = 33332, ['y'] = 44444, ['z'] = 7},
  6.         {['x'] = 33333, ['y'] = 44444, ['z'] = 7},
  7.         {['x'] = 33334, ['y'] = 44444, ['z'] = 7},
  8.         {['x'] = 33335, ['y'] = 44444, ['z'] = 7},
  9.         {['x'] = 33336, ['y'] = 44444, ['z'] = 7}
  10.     },
  11.     ['toPosition'] = {
  12.         {['x'] = 33331, ['y'] = 44445, ['z'] = 7},
  13.         {['x'] = 33332, ['y'] = 44445, ['z'] = 7},
  14.         {['x'] = 33333, ['y'] = 44445, ['z'] = 7},
  15.         {['x'] = 33334, ['y'] = 44445, ['z'] = 7},
  16.         {['x'] = 33335, ['y'] = 44445, ['z'] = 7},
  17.         {['x'] = 33336, ['y'] = 44445, ['z'] = 7}
  18.     }
  19. }
  20.  
  21. onUse = function(cid, item, fromPosition, itemEx, toPosition)
  22.     if (item.id == 1945) then
  23.         local players = #pos['toPosition']
  24.         local store = {}
  25.         for i = 1, players do
  26.             local pid = getTopCreature(pos['fromPosition'][i]).uid
  27.             if (pid == 0 or not isPlayer(pid)) then
  28.                 return doPlayerSendCancel(cid, 'You need ' .. players .. ' players to use the lever.')
  29.             end
  30.             store[i] = pid
  31.         end
  32.         for i = 1, players do
  33.             doSendMagicEffect(pos['fromPosition'][i], CONST_ME_POFF)
  34.             doTeleportThing(store[i], pos['toPosition'][i], false)
  35.             doSendMagicEffect(pos['toPosition'][i], CONST_ME_TELEPORT)
  36.         end
  37.         return doTransformItem(item.uid, item.itemid + 1)
  38.     elseif (item.id == 1946) then
  39.         return doTransformItem(item.uid, item.itemid - 1)
  40.     end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment