Guest User

Untitled

a guest
Oct 20th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.74 KB | None | 0 0
  1. local poses = {
  2.         [1] = {pos={x = 1236, y = 475, z = 6, stackpos = 1}}, -- pierwsza wajcha
  3.         [2] = {pos={x = 1239, y = 478, z = 6, stackpos = 1}}, -- druga wajcha
  4.         [3] = {pos={x = 1239, y = 475, z = 6, stackpos = 1}}, -- trzecia wajcha
  5.         [4] = {pos={x = 1236, y = 478, z = 6, stackpos = 1}} -- czwarta wajcha
  6.         }
  7.  
  8. local config = {
  9.         key = 4901, -- storage
  10.         newpos = {x = 9, y = 9, z = 9}, -- nie zmieniaj!
  11.         createpos = {x = 1238, y = 480, z = 6}, -- pozycja do stworzenia teleportu
  12.         }
  13. function onUse(cid, item, fromPosition, itemEx, toPosition)
  14.         local id = (item.itemid == 1945 and 1946 or 1945)
  15.         doTransformItem(item.uid, id)
  16.         if(item.actionid == 5001) then
  17.                 if(item.itemid == 1945 and getThingFromPos(poses[2].pos).itemid == 1945 and getThingFromPos(poses[3].pos).itemid == 1945 and getThingFromPos(poses[4].pos).itemid == 1945) then
  18.                         print ('a')
  19.                         return doPlayerSetStorageValue(cid, config.key, 1)
  20.                 end
  21.         elseif(item.actionid == 5002) then
  22.                 if(item.itemid == 1945 and getThingFromPos(poses[1].pos).itemid == 1946 and getThingFromPos(poses[3].pos).itemid == 1945 and getThingFromPos(poses[4].pos).itemid == 1945) then
  23.                         print ('b')
  24.                         return doPlayerSetStorageValue(cid, config.key, getPlayerStorageValue(cid, config.key)+1)
  25.                 end
  26.         elseif(item.actionid == 5003) then
  27.                 if(item.itemid == 1945 and getThingFromPos(poses[1].pos).itemid == 1946 and getThingFromPos(poses[2].pos).itemid == 1946 and getThingFromPos(poses[4].pos).itemid == 1945) then
  28.                         print ('c')
  29.                         return doPlayerSetStorageValue(cid, config.key, getPlayerStorageValue(cid, config.key)+1)
  30.                 end
  31.         elseif(item.actionid == 5004) then
  32.                 if(item.itemid == 1945 and getThingFromPos(poses[1].pos).itemid == 1946 and getThingFromPos(poses[2].pos).itemid == 1946 and getThingFromPos(poses[3].pos).itemid == 1946) then
  33. print ('d')                      
  34.                        doPlayerSetStorageValue(cid, config.key, getPlayerStorageValue(cid, config.key)+1)
  35.                         if(getPlayerStorageValue(cid, config.key) == 4) then
  36.                         print ('f')
  37.                                 doPlayerSetStorageValue(cid, config.key, 0)
  38.                                 for i = 1, 4 do
  39.                                         doTransformItem(getThingFromPos(poses[i].pos).uid, 1945)
  40.                                 end
  41.                                 print ('g')
  42.                                 return doCreateTeleport(1387, config.newpos, config.createpos)
  43.                         end
  44.                 end
  45.         end
  46.         doPlayerSetStorageValue(cid, config.key, 0)
  47.         return true
  48. end
Add Comment
Please, Sign In to add comment