Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. local config = {
  2. gsto = 21216, -- Não precisa mexer
  3. tempo = 30, -- Tempo em Segundos para Resetar
  4. rockID = 1497, -- ID da Pedra
  5. rockPos = {x=000, y=000, z=0}, -- Posição da Pedra
  6. ordem = {
  7. [1] = {posX = 1234}, -- PosX da Primeira Alavanca
  8. [2] = {posX = 1235}, -- PosX da Segunda Alavanca
  9. [3] = {posX = 1236}, -- PosX da Terceira Alavanca
  10. },
  11. msg = {
  12. [1] = "Primeira alavanca liberada",
  13. [2] = "Segunda alavanca liberada",
  14. [3] = "A pedra foi removida, você tem 2 minutos até a pedra aparecer",
  15. },
  16. }
  17.  
  18. function onUse(cid, item, fromPosition, itemEx, toPosition)
  19. getOrder = getLeverOrdemBySwatt(getThingPosition(item.uid))
  20. if getGlobalStorageValue(config.gsto) < 0 then setGlobalStorageValue(config.gsto, 0) end
  21. gstorage = getGlobalStorageValue(config.gsto)
  22. if getOrder == (gstorage+1) and (gstorage+1) < 4 then
  23. setGlobalStorageValue(config.gsto, getOrder+1)
  24. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msg[getOrder])
  25. if getGlobalStorageValue(config.gsto) == 4 then
  26. rock = getTileItemById(config.rockPos, config.rockID)
  27. if rock.uid > 0 then
  28. doRemoveItem(rock.uid)
  29. doSendMagicEffect(config.rockPos, CONST_ME_POFF)
  30. addEvent(function()
  31. doSendMagicEffect(config.rockPos, CONST_ME_POFF)
  32. doCreateItem(config.rockID, 1, config.rockPos)
  33. setGlobalStorageValue(config.gsto, 0)
  34. end, config.tempo * 1000)
  35. end
  36. end
  37. if(item.itemid == 1946) then
  38. doTransformItem(item.uid, item.itemid - 1)
  39. else
  40. doTransformItem(item.uid, item.itemid + 1)
  41. end
  42. else
  43. doPlayerSendCancel(cid, "You need follow the lever's order or wait the block rock reset.")
  44. return false
  45. end
  46. end
  47.  
  48. function getLeverOrdemBySwatt(pos)
  49. local order = 0
  50. for a = 1, #config.ordem do
  51. if config.ordem[a].posX == pos.x then
  52. order = a
  53. end
  54. end
  55. return order
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement