Advertisement
Guest User

Lua Npc Plus Pos

a guest
Aug 17th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. --[[----- Inicio de Configurações -------
  2. Obs: Está tudo em ordem! Ex
  3. Nome da Pos {x = 1869, y = 655, z = 7} é Mystic e o valor do item gastado é 1
  4. Caso for Editar, Peça ajuda a alguem, caso você não saiba oque mecher! uma virgula errada pode bugar o script todo!
  5. -]]
  6. local item = 10523 -- ItemID
  7. local pos = { -- Pos dos locais em name
  8. {x = 1869, y = 655, z = 7},
  9. {x = 1333, y = 1150, z = 7},
  10. {x = 143, y = 828, z = 7},
  11. {x = 384, y = 240, z = 7},
  12. {x = 1162, y = 940, z = 7},
  13. {x = 1420, y = 711, z = 7},
  14. {x = 1432, y = 615, z = 7},
  15. {x = 711, y = 133, z = 7},
  16. {x = 432, y = 97, z = 7},
  17. {x = 363, y = 379, z = 7}
  18. }
  19. local namepos = { -- Nome das Pos
  20. "Mystic",
  21. "King",
  22. "Mantasin",
  23. "Little",
  24. "Pincher",
  25. "Master I",
  26. "Master II",
  27. "Crystal",
  28. "Ice",
  29. "Boss"
  30. }
  31.  
  32. local valor = { -- Quantidade dos Items Gastados
  33. Mystic = 1,
  34. King = 2,
  35. mantasin = 3,
  36. Little = 4,
  37. Pincher = 5,
  38. Master I = 6,
  39. Master II = 7,
  40. Crystal = 8,
  41. Ice = 9,
  42. Boss = 10
  43. }
  44.  
  45. --- Fim de Configurações -----
  46.  
  47. local keywordHandler = KeywordHandler:new()
  48. local npcHandler = NpcHandler:new(keywordHandler)
  49. NpcSystem.parseParameters(npcHandler)
  50. local talkState = {}
  51.  
  52. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  53. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  54. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  55. function onThink() npcHandler:onThink() end
  56.  
  57. function creatureSayCallback(cid, type, msg)
  58. if (not npcHandler:isFocused(cid)) then
  59. return false
  60. end
  61. if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then
  62. selfSay('Você gostaria de viajar para '..namepos[1]..', '..namepos[2]..', '..namepos[3]..', '..namepos[4]..', '..namepos[5]..', '..namepos[6]..', '..namepos[7]..', '..namepos[8]..', '..namepos[9]..' ou '..namepos[10]..' por 1x '..getItemNameById(item)..'???', cid)
  63. if (getPlayerItemCount(cid, item) == valor[1] or getPlayerItemCount(cid, item) == valor[2] or getPlayerItemCount(cid, item) == valor[3] or getPlayerItemCount(cid, item) == valor[4] or getPlayerItemCount(cid, item) == valor[5] or getPlayerItemCount(cid, item) == valor[6] or getPlayerItemCount(cid, item) == valor[7] or getPlayerItemCount(cid, item) == valor[8] or getPlayerItemCount(cid, item) == valor[9] or getPlayerItemCount(cid, item) == valor[10]) then
  64. if msgcontains(msg, 'Mystic') or msgcontains(msg, 'mystic') then
  65. doPlayerRemoveItem(cid, item, valor[1])
  66. doTeleportThing(cid, pos[1])
  67. selfSay('Você acaba de ser levado(a) para '..namepos[1]..'', cid)
  68. elseif msgcontais(msg, 'King') or msgcontais(msg, 'king') then
  69. doTeleportThing(cid, pos[2])
  70. doPlayerRemoveItem(cid, item, valor[2])
  71. selfSay('Você acaba de ser levado(a) para '..namepos[2]..'', cid)
  72. elseif msgcontais(msg, 'Mantasin') or msgcontais(msg, 'mantasin') then
  73. doTeleportThing(cid, pos[3])
  74. doPlayerRemoveItem(cid, item, valor[3])
  75. selfSay('Você acaba de ser levado(a) para '..namepos[3]..'', cid)
  76. elseif msgcontais(msg, 'Little') or msgcontais(msg, 'little') then
  77. doTeleportThing(cid, pos[4])
  78. doPlayerRemoveItem(cid, item, valor[4])
  79. selfSay('Você acaba de ser levado(a) para '..namepos[4]..'', cid)
  80. elseif msgcontais(msg, 'Pincher') or msgcontais(msg, 'pincher') then
  81. doTeleportThing(cid, pos[5])
  82. doPlayerRemoveItem(cid, item, valor[5])
  83. selfSay('Você acaba de ser levado(a) para '..namepos[5]..'', cid)
  84. elseif msgcontais(msg, 'Master I') or msgcontais(msg, 'master i') or msgcontais(msg, 'Master 1') or msgcontais(msg, 'master 1') then
  85. doTeleportThing(cid, pos[6])
  86. doPlayerRemoveItem(cid, item, valor[6])
  87. selfSay('Você acaba de ser levado(a) para '..namepos[6]..'', cid)
  88. elseif msgcontais(msg, 'Master II') or msgcontais(msg, 'Master ii') or msgcontais(msg, 'Master 2') or msgcontais(msg, 'master 2') then ----------------------- ///// -------------------
  89. doTeleportThing(cid, pos[7])
  90. doPlayerRemoveItem(cid, item, valor[7])
  91. selfSay('Você acaba de ser levado(a) para '..namepos[7]..'', cid)
  92. elseif msgcontais(msg, 'Crystal') or msgcontais(msg, 'crystal') then
  93. doTeleportThing(cid, pos[8])
  94. doPlayerRemoveItem(cid, item, valor[8])
  95. selfSay('Você acaba de ser levado(a) para '..namepos[8]..'', cid)
  96. elseif msgcontais(msg, 'Ice') or msgcontais(msg, 'ice') then
  97. doTeleportThing(cid, pos[9])
  98. doPlayerRemoveItem(cid, item, valor[9])
  99. selfSay('Você acaba de ser levado(a) para '..namepos[9]..'', cid)
  100. elseif msgcontais(msg, 'Boss') or msgcontais(msg, 'boss') then
  101. doTeleportThing(cid, pos[10])
  102. doPlayerRemoveItem(cid, item, valor[10])
  103. selfSay('Você acaba de ser levado(a) para '..namepos[10]..'', cid)
  104. end
  105. end
  106. elseif msgcontains(msg, 'no') or msgcontains(msg, 'nao') or msgcontains(msg, 'não') then
  107. selfSay('Caso você queira viajar fale comigo novamente!', cid)
  108. else
  109. selfSay('Você não tem dinheiro suficiente!', cid)
  110. end
  111. return 0
  112. end
  113.  
  114. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  115. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement