FLLEERP

DODGE SURVIVOR

Jun 4th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.01 KB | None | 0 0
  1. winners={}
  2. banned={}
  3. data={}
  4.  
  5. vivos=0;
  6. tempoMapa=0;
  7. cannons=false;
  8. sobreviventes=0;
  9. face="Soopafresh";
  10. size="120";
  11. game="#Dodge";
  12. color="#BABD2F";
  13.  
  14. tfm.exec.disableAfkDeath(true)
  15. tfm.exec.disableAutoScore(true)
  16. tfm.exec.disableAutoShaman(true)
  17. tfm.exec.disableAutoNewGame(true)
  18. tfm.exec.disableAutoTimeLeft(true)
  19.  
  20. function Data(playerName)
  21. data[playerName] = {
  22. tempoBanner=0;
  23. bannerOn=false;
  24. vitorias=0;
  25. alive=false;
  26. }
  27. end
  28.  
  29. function isBanned(p)
  30. for _,player in pairs(banned) do
  31. if (player == p) then
  32. return true;
  33. end
  34. end
  35. return false;
  36. end
  37.  
  38. function unBan(p)
  39. for num,k in ipairs(banned) do
  40. if (p == banned[num]) then
  41. table.remove(banned, num)
  42. end
  43. end
  44. end
  45.  
  46. function Delete(p)
  47. for num,k in ipairs(winners) do
  48. if (p == winners[num]) then
  49. table.remove(winners, num)
  50. end
  51. end
  52. end
  53.  
  54. function showBanner(p)
  55. data[p].tempoBanner=0;
  56. data[p].bannerOn=true;
  57. ui.addTextArea(1, "<BR><B><p align='center'><font face='"..face.."' size='"..size.."' color='#000000'><BR>"..game, p, 10, -30, 790, 400, 1, 1, 0.0, false)
  58. ui.addTextArea(2, "<BR><B><p align='center'><font face='"..face.."' size='"..size.."' color='#000000'><BR>"..game, p, 0, -30, 790, 400, 1, 1, 0.0, false)
  59. ui.addTextArea(3, "<BR><B><p align='center'><font face='"..face.."' size='"..size.."' color='#000000'><BR>"..game, p, 5, -35, 790, 400, 1, 1, 0.0, false)
  60. ui.addTextArea(4, "<BR><B><p align='center'><font face='"..face.."' size='"..size.."' color='#000000'><BR>"..game, p, 5, -25, 790, 400, 1, 1, 0.0, false)
  61. ui.addTextArea(5, "<BR><B><p align='center'><font face='"..face.."' size='"..size.."' color='"..color.."'><BR>"..game, p, 5, -30, 790, 400, 1, 1, 0.0, false)
  62. end
  63.  
  64. function nextRound()
  65. for p in pairs(tfm.get.room.playerList) do
  66. data[p].alive=true;
  67. end
  68. vivos=0;
  69. cannons=false;
  70. tfm.exec.newGame('<C><P /><Z><S><S H="3000" L="60" o="FFFFFFFF" X="830" c="3" Y="200" T="12" P="0,0,0,0,0,0,0,0" /><S L="800" H="200" X="400" Y="480" T="0" P="0,0,0.3,0.2,0,0,0,0" /><S H="34" L="760" o="0" X="400" c="4" Y="25" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="18" o="0" X="18" c="4" Y="24" T="13" H="10" /><S c="4" L="18" o="0" X="782" H="10" Y="24" T="13" P="0,0,0.3,0.2,0,0,0,0" /><S c="4" L="800" o="0" H="10" X="400" Y="20" T="12" P="0,0,0.3,0.2,0,0,0,0" /></S><D><DS Y="365" X="400" /></D><O /></Z></C>')
  71. end
  72.  
  73. function eventNewPlayer(p)
  74. Data(p)
  75. showBanner(p)
  76. end
  77.  
  78. for p in pairs(tfm.get.room.playerList) do
  79. eventNewPlayer(p)
  80. end
  81.  
  82. function eventNewGame()
  83. if sobreviventes == 1 then
  84. if data[winners[math.random(#winners)]].vitorias == 1 then
  85. ui.addTextArea(0, "<p align='center'><font size='14'><J>Último vencedor: <V>"..winners[#winners].."<J>, com <VP>"..data[winners[#winners]].vitorias.."<J> vitória!", NIL, 5, 22, 790, NIL, 1, 1, 0.0, true)
  86. elseif data[winners[math.random(#winners)]].vitorias >= 2 then
  87. ui.addTextArea(0, "<p align='center'><font size='14'><J>Último vencedor: <V>"..winners[#winners].."<J>, com <VP>"..data[winners[#winners]].vitorias.."<J> vitórias!", NIL, 5, 22, 790, NIL, 1, 1, 0.0, true)
  88. end
  89. elseif sobreviventes >= 2 then
  90. ui.removeTextArea(0, NIL)
  91. end
  92. for p in pairs(tfm.get.room.playerList) do
  93. vivos=vivos+1;
  94. end
  95. tfm.exec.setGameTime(180)
  96. tempoMapa=0;
  97. end
  98.  
  99. function eventPlayerDied(p)
  100. data[p].alive=false;
  101. vivos=vivos-1;
  102. if vivos == 1 then
  103. for p in pairs(tfm.get.room.playerList) do
  104. if data[p].alive == true then
  105. data[p].vitorias=data[p].vitorias+1;
  106. ui.addTextArea(0, "<p align='center'><font size='14'><J>Parabéns, <V>"..p.."<J>! Você é o único sobrevivente!", NIL, 5, 22, 790, NIL, 1, 1, 0.0, true)
  107. table.insert(winners, p)
  108. cannons=false;
  109. sobreviventes=1;
  110. tfm.exec.setGameTime(5)
  111. end
  112. end
  113. end
  114. end
  115.  
  116. function eventPlayerLeft(p)
  117. if data[p].alive == true then
  118. data[p].alive=false;
  119. vivos=vivos-1;
  120. end
  121. end
  122.  
  123. function eventChatCommand(p, c)
  124. local args={}
  125. for arg in c:gmatch("[^%s]+") do
  126. table.insert(args,arg:lower())
  127. end
  128. if args[1] == "ban" then
  129. table.insert(banned, args[2])
  130. elseif args[1] == "unban" then
  131. unBan(args[2])
  132. ui.removeTextArea(9999, args[2])
  133. end
  134. system.disableChatCommandDisplay(c, true)
  135. end
  136.  
  137. function eventLoop(ct, tr)
  138. for p in pairs(tfm.get.room.playerList) do
  139. if data[p].bannerOn == true then
  140. data[p].tempoBanner=data[p].tempoBanner+1;
  141. end
  142. end
  143. for p in pairs(tfm.get.room.playerList) do
  144. if data[p].tempoBanner == 10 then
  145. for i = 1,5 do
  146. ui.removeTextArea(i, p)
  147. end
  148. data[p].tempoBanner=0;
  149. data[p].bannerOn=false;
  150. end
  151. end
  152. if tr <= 0 then
  153. nextRound()
  154. elseif tr == 5 then
  155. if vivos > 1 then
  156. sobreviventes=2;
  157. end
  158. end
  159. for _,p in pairs(banned) do
  160. tfm.exec.killPlayer(p)
  161. ui.addTextArea(9999, "", p, -3000, -3000, 6800, 6400, 0x6A7495, 0x6A7495, 1.0, true)
  162. end
  163. if cannons == true then
  164. tfm.exec.addShamanObject(17, 820, math.random(150,380), math.random(-135, -45), 0, 0, false)
  165. end
  166. if tempoMapa == 5 then
  167. Delete(p)
  168. cannons=true;
  169. end
  170. if vivos == 1 then
  171. tfm.exec.setUIMapName("<J>#Dodge <G>| <N>Vivo: <V>"..vivos.."")
  172. else
  173. tfm.exec.setUIMapName("<J>#Dodge <G>| <N>Vivos: <V>"..vivos.."")
  174. end
  175. tempoMapa=tempoMapa+0.5;
  176. end
  177.  
  178. nextRound()
Add Comment
Please, Sign In to add comment