Advertisement
Dudugz-Contistente

Untitled

Aug 27th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.89 KB | None | 0 0
  1. sys={times={},newTimer=function(callback, tempo, arg1, arg2, arg3, arg4)if arg1 == nil and arg2 == nil and arg3 == nil and arg4 == nil then table.insert(sys.times,{call=callback, tempo=tempo, timer=os.time(), args={}}) end if arg1 ~= nil and arg2 == nil then table.insert(sys.times,{call=callback, tempo=tempo, timer=os.time(), args={arg1}}) end if arg1 ~= nil and arg2 ~= nil and arg3 == nil then table.insert(sys.times,{call=callback, tempo=tempo, timer=os.time(), args={arg1,arg2}}) end if arg1 ~= nil and arg2 ~= nil and arg3 ~= nil and arg4 == nil then table.insert(sys.times,{call=callback, tempo=tempo, timer=os.time(), args={arg1,arg2,arg3}}) end if arg1 ~= nil and arg2 ~= nil and arg3 ~= nil and arg4 ~= nil then table.insert(sys.times,{call=callback, tempo=tempo, timer=os.time(), args={arg1,arg2,arg3,arg4}}) end return #sys.times end, removeTimer=function(id) table.remove(sys.times,id) end, eventLoop=function() for i,v in ipairs(sys.times) do if v.timer < os.time()-(v.tempo) then if v.args[1] == nil then v.call() end if v.args[1] ~= nil and v.args[2] == nil then v.call(v.args[1]) end if v.args[1] ~= nil and v.args[2] ~= nil and v.args[3] == nil then v.call(v.args[1],v.args[2]) end if v.args[1] ~= nil and v.args[2] ~= nil and v.args[3] ~= nil and v.args[4] == nil then v.call(v.args[1],v.args[2],v.args[3]) end if v.args[4] ~= nil then v.call(v.args[1],v.args[2],v.args[3],v.args[4]) end table.remove(sys.times,i) end end end}
  2.  
  3. mapas={7050616,7223062,7054603,7054531,7054546,7054560,7054552,7052544,7052537,7202743,7052522,7051720,7050627,7051652,7051630,7051619,7051569,7051547,7050402,7050558,7050503,7050581,7050580,7050562 ,70505521,7046681,7047815,7047835,7047897,7048753,7049425,7049270,7049421,7049292,7050189,7049463,7050308,7050400,7050402,7049463}
  4.  
  5. data={}
  6.  
  7. vivos = 5
  8. p=0
  9.  
  10. tfm.exec.disableAutoShaman(true)
  11. tfm.exec.disableAutoTimeLeft(true)
  12. tfm.exec.disableAutoNewGame()
  13.  
  14. textarea=ui.addTextArea
  15. function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss,active)
  16. --if not backgroundColor then backgroundColor=0x324650 end
  17. --if not borderColor then borderColor=0x000001 end
  18. if active then
  19. textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
  20. textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
  21. end
  22. textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
  23. end
  24.  
  25. function eventPlayerGetCheese(name)
  26. tfm.exec.killPlayer(name)
  27.  
  28. if tfm.get.room.playerList[name] then
  29. tfm.exec.addShamanObject(tfm.enum.shamanObject.chicken,tfm.get.room.playerList[name].x,tfm.get.room.playerList[name].y)
  30.  
  31. for i=1,20 do
  32. tfm.exec.displayParticle(13, tfm.get.room.playerList[name].x+math.random(-10,10), tfm.get.room.playerList[name].y+math.random(-10,10),math.random(-math.random(5,10),math.random(5,10)),math.random(-math.random(5,10),math.random(5,10)))
  33. end
  34. end
  35. end
  36.  
  37. function eventChatMessage(name,cmd)
  38. local helpMessage=false
  39.  
  40. for _,k in pairs({"ajuda?","!help","!ajuda","ajuda","como joga?","como jogar?","como solta meep?","meep?","jogar?","joga?"}) do
  41. if cmd:lower():find(k) then
  42. helpMessage=true
  43. end
  44. end
  45.  
  46. if helpMessage then
  47. tfm.exec.chatMessage("<CEP>> [bot] [<CE>Guhzumaki</CE>] Olá "..name.." parece que você precisa de ajuda, pois bem vou te ajudar.",name)
  48. sys.newTimer(tfm.exec.chatMessage,500,"<CEP>> [bot] [<CE>Guhzumaki</CE>] O seu objetivo no Meep Attack é ser o último vivo para vencer.",name)
  49. sys.newTimer(tfm.exec.chatMessage,3000,"<CEP>> [bot] [<CE>Guhzumaki</CE>] Mas você tem um inimigo maior, o queijo, tome muito cuidado pois estes queijos estão envenenados e ao pegá-los você vira uma galinha e morre.",name)
  50. sys.newTimer(tfm.exec.chatMessage,6000,"<CEP>> [bot] [<CE>Guhzumaki</CE>] Mate os outros jogadores usando o Meep para vencer, espere a barrinha do meep encher e ao ficar cheia pressione espaço para soltar um meep.",name)
  51. end
  52.  
  53. end
  54.  
  55. function eventNewGame()
  56. tfm.exec.setGameTime(120)
  57. vivos=0
  58. for i,v in pairs(tfm.get.room.playerList) do -- i = nome, v = info
  59. vivos=vivos+1;
  60. tfm.exec.giveMeep(i)
  61. end
  62. end
  63.  
  64. function eventLoop(time,remaining)
  65. sys.eventLoop()
  66. p=time
  67. if remaining < 1000 or vivos <= 0 then -- se o tempo do mapa está menor que 1 ou seja 0, ou não tem nenhum vivo
  68. tfm.exec.newGame(mapas[math.random(#mapas)])
  69.  
  70. if not winner and not (remaining < 1000) then
  71. tfm.exec.chatMessage("<B>Ninguém venceu.</B>")
  72. elseif not winner and remaining < 1000 then
  73. tfm.exec.chatMessage("<N><B>O tempo acabou e ninguém venceu.</B></N>")
  74. end
  75. end
  76.  
  77. if vivos <= 1 then
  78. winner = false
  79. eventPlayerDied()
  80. end
  81. end
  82.  
  83. getPlayers=function()
  84. local k=0
  85. for i,v in pairs(tfm.get.room.playerList) do k=k+1 end
  86. return k
  87. end
  88.  
  89. function eventPlayerDied(name)
  90. vivos=vivos-1;
  91.  
  92. if vivos <= 1 and getPlayers() > 1 then
  93. for i,v in pairs(tfm.get.room.playerList) do
  94. if not v.isDead then -- verefica se o jogador não morreu
  95. tfm.exec.giveCheese(i)
  96. tfm.exec.playerVictory(i)
  97. name = i
  98. tfm.exec.displayParticle(29, tfm.get.room.playerList[name].x-12, tfm.get.room.playerList[name].y,0,-5)
  99. tfm.exec.displayParticle(29, tfm.get.room.playerList[name].x, tfm.get.room.playerList[name].y-7,0,-5)
  100. tfm.exec.displayParticle(29, tfm.get.room.playerList[name].x+12, tfm.get.room.playerList[name].y,0,-5)
  101. tfm.exec.displayParticle(34, tfm.get.room.playerList[name].x, tfm.get.room.playerList[name].y-7,0,-5)
  102. end
  103. end
  104. else
  105. tfm.exec.newGame(mapas[math.random(#mapas)])
  106. end
  107. end
  108.  
  109. function eventPlayerWon(name)
  110. vivos=vivos-1;
  111. winner = true
  112.  
  113. data[name].wins = data[name].wins+1;
  114.  
  115. tfm.exec.chatMessage("<B>"..name.."</B> venceu.")
  116. ui.addTextArea(-5,"<B><font size='75' color='#7F7F7F' face='Berlin Sans FB Demi'>"..name.." venceu</font>",nil,100,250,nil,nil,0,0,0,true)
  117. ui.addTextArea(-8,"<B><font size='75' color='#F7F7F7' face='Berlin Sans FB Demi'>"..name.." venceu</font>",nil,100-3,250-2,nil,nil,0,0,0,true)
  118. sys.newTimer(ui.removeTextArea,1000,-5,nil)sys.newTimer(ui.removeTextArea,1000,-8,nil)
  119. end
  120.  
  121. function eventNewPlayer(name)
  122. if not data[name] then
  123. data[name]={
  124. wins=0
  125. }
  126. end
  127.  
  128. for _,msg in pairs({"Olá <B>"..name.."</B> bem-vindo ao New Meep Attack.","<VP><B>Para aprender a jogar utilize <B>!help</B>.</B></VP>"}) do
  129. tfm.exec.chatMessage(msg,name)
  130. end
  131.  
  132. ui.addTextArea(-10,"<B><font size='75' color='#7F7F7F' face='Berlin Sans FB Demi'>Meep Attack</font>",name,200,100,nil,nil,0,0,0,true)
  133. ui.addTextArea(-15,"<B><font size='75' color='#F7F7F7' face='Berlin Sans FB Demi'>Meep Attack</font>",name,200-3,100-2,nil,nil,0,0,0,true)
  134. sys.newTimer(ui.removeTextArea,2000,-10,name)sys.newTimer(ui.removeTextArea,2000,-15,name)
  135. end
  136.  
  137. tfm.exec.setRoomMaxPlayers(30)
  138. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  139. tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement