Advertisement
Novohp

#DeadlyHunt 2.2

Nov 5th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.58 KB | None | 0 0
  1. ------------------------
  2. -- @Version: 1.9
  3. -- @OBS1: Bug da flecha para a esquerda corrigido.
  4. -- @OBS2: Corrigido, apenas os Hunters jogam as flechas
  5. -- @OBS3: Adicionado as Abas: Perfil/Help
  6. ------------------------
  7.  
  8.  
  9. -----------------------
  10. -- @Variaveis/Objetos/Tabelas
  11. tfm.exec.chatMessage =print
  12. tfm.exec.disableAutoShaman()
  13. newData = {}
  14. p = {}
  15. teamtime=false
  16.  
  17. ----------------------
  18. -- <procedure>
  19. -- Sistema de teams
  20. -- @Define se o jogador é do time red ou blue.
  21. ----------------------
  22. function eventNewGame()
  23.   for p,n in pairs(tfm.get.room.playerList) do
  24.     if teamtime == false then
  25.       newData[p].Team = "Monster"
  26.       tfm.exec.setNameColor(p, 0xCB546B) -- color red
  27.       tfm.exec.chatMessage("<R><i>Você nasceu como um Monster! Corra dos caçadores!!</i>",p)
  28.       teamtime=true
  29.     else
  30.       newData[p].Team = "Hunter"
  31.       tfm.exec.setNameColor(p, 0x2F7FCC)
  32.       tfm.exec.chatMessage("<BV><i>Você nasceu como um caçador! Vá atrás dos Monsters!!</i>",p)
  33.       teamtime=false
  34.     end
  35.  
  36.   newData[p].Life = 100
  37.   LifeStatus(p)
  38. end
  39. end
  40.  
  41. -------------------------------------------------
  42. -- @Local de armazenamento de dados dos jogadores.
  43. -- @
  44. --------------------------------------------------
  45. function eventNewPlayer(name)
  46. newData[name] = {
  47.   Team = "",
  48.   Xp = 0,
  49.   Life = 100,
  50.   winHunter = 0,
  51.   winMonster = 0,
  52. }  
  53.  
  54. -------------------------------
  55. -- @ Sistema de jogar flechas
  56. -- @ Os caçadores atiram flechas
  57. --------------------------------
  58. function balls(name)
  59.   if k == 32 and tfm.get.room.playerList[p].isFacingRight == true and info[p].time < os.time()-1500 then
  60.             info[p].time = os.time()
  61.             tfm.exec.movePlayer(p,0,0,true,100,0,false)
  62.         elseif k == 32 and tfm.get.room.playerList[p].isFacingRight == false and info[p].time < os.time()-1500 then
  63.             info[p].time = os.time()
  64.             tfm.exec.movePlayer(p,0,0,true,-100,0,false)
  65.         end
  66.  local facingLeft = {}
  67.  
  68. for name in pairs(tfm.get.room.playerList) do
  69. for _,key in pairs{0,2,3,32} do system.bindKeyboard(name, key, true)
  70.     end
  71. end
  72.     function eventKeyboard(name, key, down, x, y)
  73.         if key == 3 then
  74.             if newData[name].Team ~= "Monster" then
  75.         if tfm.get.room.playerList[name].isFacingRight then
  76.           tfm.exec.addShamanObject(35, x+20, y, 0, 20)
  77.         else
  78.           tfm.exec.addShamanObject(35, x-20, y, 0, -20)
  79.         end
  80.       else
  81.          eventKeyboard(name,32,down,x,y)
  82.       end
  83.     end
  84.    
  85.     if key == 32 and newData[name].Team == "Monster" then
  86.       for n,player in pairs(tfm.get.room.playerList) do
  87.         if name ~= n and  newData[n].Team ~= "Monster" and newData[n].Life ~= 0 and x >= player.x - 15 and x <= player.x + 15 and y >= player.y - 15 and y <= player.y + 15 then
  88.           newData[n].Life = newData[n].Life - math.random(1,5)
  89.           tfm.exec.displayParticle(5,x,y,-0.2,-0.2,0,0)
  90.           LifeStatus(n)
  91.           break
  92.         end
  93.       end
  94.     end
  95.   end
  96. end
  97. balls("Hpassos")
  98.  
  99. -----------------------
  100. -- @TextAreas do jogo.
  101. -- @TextAras do Xp/Mana
  102. -----------------------
  103. -- @TextAra dos dados dos player [Profile] / [Help]
  104.    LifeStatus(name)
  105.    ui.addTextArea(2, "", name, 771, 374, 20, 17, 0x006191, 0x006191, 0.8, true)
  106.    ui.addTextArea(3, "<p align='center'><a href='event:help'>H</a></p>", name, 772, 372, 22, 20, 0x324650, 0x324650, 0.4, true)
  107.    ui.addTextArea(4, "", name, 730, 374, 20, 17, 0x006191, 0x006191, 0.8, true)
  108.    ui.addTextArea(5, "<p align='center'><a href='event:profile'>P</a></p>", name, 731, 372, 22, 20, 0x324650, 0x324650, 0.4, true)
  109.  
  110. end
  111. ----
  112. function eventTextAreaCallback(t,p,link)
  113. if link == [[profile]] then
  114.    ui.addTextArea(40, "", p, 226, 37, 306, 205, 0x313a4a, 0x313a4a, 1, true)
  115.    ui.addTextArea(41, "<font size='15'><p align='center'>"..p.."<b></p>", p, 226, 37, 306, 25, 0x2c3438, 0x2c3438, 1, true)
  116.    ui.addTextArea(42, "Ganhas como Hunter", p, 233, 76, 132, 20, 0x313a4a, 0x313a4a, 1, true)
  117.    ui.addTextArea(43, "<font size='15'><p align='center'>"..newData[p].winHunter.."/1000<b></p>", p, 228, 102, 166, 22, 0x375361, 0x2c3438, 1, true)
  118.    ui.addTextArea(44, "Ganhas como Monsters", p, 226, 142, 141, 20, 0x313a4a, 0x313a4a, 1, true)
  119.    ui.addTextArea(45, "<font size='15'><p align='center'>"..newData[p].winMonster.."/1000<b></p>", p, 230, 173, 166, 22, 0x375361, 0x2c3438, 1, true)
  120.    ui.addTextArea(46, "Title", p, 427, 76, 100, 20, 0x313a4a, 0x313a4a, 1, true)
  121.    ui.addTextArea(47, "<font size='15'><p align='center'><b></p>", p, 416, 102, 109, 26, 0x375361, 0x2c3438, 1, true)
  122.    ui.addTextArea(48, "[...]", p, 419, 140, 108, 20, 0x313a4a, 0x313a4a, 1, true)
  123.    ui.addTextArea(49, "<font size='15'><p align='center'><b></p>", p, 418, 173, 108, 24, 0x375361, 0x2c3438, 1, true)
  124.    ui.addTextArea(50, "<font size='15'><a href='event:closeprofile'><b>X</a>", p, 550, 37, 28, 30, 0x2c3438, 0x2c3438, 0, true)
  125. elseif link == [[closeprofile]] then
  126.     for i = 40,50 do --
  127.          ui.removeTextArea(i,p)
  128.       end
  129. elseif link ==[[help]] then
  130.   ui.addTextArea(100, "", p, 139, 95, 520, 207, 0x313a4a, 0x313a4a, 1, true)
  131.   ui.addTextArea(101, "", p, 140, 97, 520, 25, 0x2c3438, 0x2c3438, 1, true)
  132.   ui.addTextArea(102, "", p, 139, 278, 520, 25, 0x2c3438, 0x2c3438, 1, true)
  133.   ui.addTextArea(103, "<font size='15'>Olá sejam bem-vindos ao #DeadlyHunt, sua missão aqui é:\n <R>Se você é um Monstro.:</R>Você deve ir proximo aos caçadores e se abaixar  para tirar o Hp deles, quando o HP chegar a 0 eles morrem.\n<BV>Se você é um Caçador.:</bv> Você deve atirar suas flechas para matar os monstros, antes que eles os matem!! Mas cuidado,\n suas flechas também dão matam seus parceiros de equipe.</font>", nil, 156, 126, 488, 156, 0x2c3438, 0x2c3438, 1, true)
  134.   ui.addTextArea(104, "<a href='event:closehelp'><b>X</a>", p, 628, 98, 28, 30, 0x2c3438, 0x2c3438, 0, true)
  135. elseif link == [[closehelp]] then
  136.       for i = 100,104 do
  137.         ui.removeTextArea(i,p)
  138.       end
  139.       end
  140.    end
  141. ------------------------
  142. -- @Vida
  143. --@
  144. ------------------------
  145. function LifeStatus(name)
  146.   if newData[name].Team ~= "Monster" then
  147.     if newData[name].Life <= 0 then
  148.       newData[name].Life = 0
  149.       tfm.exec.killPlayer(name)
  150.     end
  151.     ui.addTextArea(0, "", name, 254, 372, 220, 10, 0x006191, 0x006191, 1, true)
  152.     ui.addTextArea(1, "<p align='center'>"..(newData[name].Life*100/100).."/100</p>", name, 252, 368, 226, 18, 0x324650, 0x000000, 0.4, true)
  153.   else
  154.     ui.removeTextArea(0,name)ui.removeTextArea(1,name)
  155.   end
  156. end
  157.  
  158. tfm.exec.newGame(7303153)
  159. ui.setMapName("DeadlyHunt")
  160. table.foreach(tfm.get.room.playerList,eventNewPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement