Advertisement
Boeing747-8

Untitled

Aug 7th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.38 KB | None | 0 0
  1. roles={0,1}
  2. maps={7489629}
  3. data={}
  4. text={}
  5. lang={}
  6. players={}
  7. lang.en={
  8. menu="Menu",
  9. profile2="Profile",
  10. help2="Help",
  11. help="In #bombdeliver",
  12. points="Points",
  13. close="Close",
  14. health=100
  15. }
  16. for _, s in next, {'AutoTimeLeft', 'PhysicalConsumables', 'AfkDeath', 'AutoShaman', 'AutoNewGame'} do
  17. tfm.exec['disable' .. s]()
  18. end
  19. function identifyBomber(n)
  20. if data[n].role==0 then
  21. tfm.exec.setNameColor(n,0x00FF00)
  22. elseif data[n].role==1 then
  23. tfm.exec.setNameColor(n,0xFF0000)
  24. end
  25. end
  26. function insertName(n)
  27. table.insert(players,n)
  28. end
  29. function setLang(n)
  30. text[n]=lang[tfm.get.room.playerList[n].community] or lang.en
  31. end
  32. function setData(n)
  33. data[n]=
  34. {
  35. points=0,
  36. role=0,
  37. health=100
  38. }
  39. end
  40. function chooseRole()
  41. for n,player in pairs(tfm.get.room.playerList) do
  42. data[n].role=0
  43. end
  44. player=players[math.random(#players)]
  45. data[player].role=1
  46. player=""..player
  47. end
  48. function bindKeyboard(n)
  49. for i=0,100 do
  50. tfm.exec.bindKeyboard(n,i,true,true)
  51. end
  52. end
  53. function showMenu(n)
  54. ui.addTextArea(0, "<p align='center'><font face='calibri'><a href='event:menu2'>"..text[n].menu, n, 10, 30, 42, 20, 0x000001, 0xFFFFFF, 1, true)
  55. end
  56. function showMenu2(n)
  57. ui.addTextArea(0, "<p align='center'><font face='calibri'><a href='event:Menu'>"..text[n].menu.." </a>| <a href='event:Help'>"..text[n].help2.."</a> | <a href='event:Profile'>"..text[n].profile2, n, 10, 30, 121, 20, 0x000001, 0xffffff, 1, true)
  58. end
  59. function showHealth(n)
  60. ui.addTextArea(-3, "", n, 319, 27, 100, 18, 0xffffff, 0xffffff, 1, true)
  61. ui.addTextArea(-1, "", n, 319, 27, data[n].health, 18, 0x1aff00, 0x1aff00, 1, true)
  62. ui.addTextArea(-2, "<p align='center'><b><font color='#000000'>"..data[n].health.."%", n, 345, 27, 54, 18, 0x324650, 0x000000, 0, true)
  63. end
  64. function displayTab(n,info,subject)
  65. ui.addTextArea(2, "", n, 262, 72, 360, 290, 0x331f15, 0x331f15, 1, true)
  66. ui.addTextArea(3, "", n, 262, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  67. ui.addTextArea(5, "", n, 295, 72, 290, 4, 0x6b4231, 0x6b4231, 1, true)
  68. ui.addTextArea(4, "", n, 618, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  69. ui.addTextArea(6, "", n, 295, 358, 295, 4, 0x6b4231, 0x6b4231, 1, true)
  70. ui.addTextArea(1, "<p align='center'><font face='calibri'><font size='17'><b>#BOMBDELIVER - "..subject.."</b></font></font><font size='14'>\n\n"..info, n, 271, 80, 342, 270, 0x1b262b, 0x131c21, 1, true)
  71. ui.addTextArea(7, "<p align='center'><font size='13'><a href='event:close'>"..text[n].close.."</a></font>", n, 272, 330, 339, 20, 0x324650, 0x324650, 1, true)
  72. end
  73. function profile(n,info)
  74. ui.addTextArea(2, "", n, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
  75. ui.addTextArea(3, "", n, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  76. ui.addTextArea(5, "", n, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  77. ui.addTextArea(4, "", n, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  78. ui.addTextArea(6, "", n, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  79. ui.addTextArea(1, "<p align='center'><font face='calibri'><font size='17'><b>"..n.."</b></font></font></p><font size='14'>\n<font face='calibri'>\n"..info, n, 270, 82, 252, 270, 0x1b262b, 0x131c21, 1, true)
  80. ui.addTextArea(7, "<p align='center'><font size='13'><a href='event:close'>"..text[n].close.."</a></font>", n, 272, 330, 248, 20, 0x324650, 0x324650, 1, true)
  81. end
  82. function close(n)
  83. for i=1,7 do
  84. ui.removeTextArea(i,n)
  85. end
  86. end
  87. function nearBomber(n,x,y,p)
  88. if ((tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x+50 and tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x) and tfm.get.room.playerList[n].y<tfm.get.room.playerList[p].y+30 and tfm.get.room.playerList[n].y>tfm.get.room.playerList[p].y-30) and not (n==p) and data[p].health>0 and tfm.get.room.playerList[n].isFacingRight==true then
  89. data[p].health=data[p].health-4
  90. tfm.exec.displayParticle(1,x,y,0.2,0,0.2,0,nil)
  91. tfm.exec.displayParticle(1,x,y,0.4,0,0.4,0,nil)
  92. tfm.exec.displayParticle(1,x,y,0.6,0,0.6,0,nil)
  93. tfm.exec.displayParticle(1,x,y,0.8,0,0.8,0,nil)
  94. tfm.exec.displayParticle(1,x,y,1,0,1,0,nil)
  95. tfm.exec.displayParticle(1,x,y-10,0.2,0,0.2,0,nil)
  96. tfm.exec.displayParticle(1,x,y-10,0.4,0,0.4,0,nil)
  97. tfm.exec.displayParticle(1,x,y-10,0.6,0,0.6,0,nil)
  98. tfm.exec.displayParticle(1,x,y-10,0.8,0,0.8,0,nil)
  99. tfm.exec.displayParticle(1,x,y-10,1,0,1,0,nil)
  100. tfm.exec.displayParticle(1,x,y+10,0.2,0,0.2,0,nil)
  101. tfm.exec.displayParticle(1,x,y+10,0.4,0,0.4,0,nli)
  102. tfm.exec.displayParticle(1,x,y+10,0.6,0,0.6,0,nil)
  103. tfm.exec.displayParticle(1,x,y+10,0.8,0,0.8,0,nil)
  104. tfm.exec.displayParticle(1,x,y+10,1,0,1,0,nil)
  105. end
  106. if ((tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x-50 and tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x) and tfm.get.room.playerList[n].y<tfm.get.room.playerList[p].y+30 and tfm.get.room.playerList[n].y>tfm.get.room.playerList[p].y-30) and not (n==p) and data[p].health>0 and tfm.get.room.playerList[n].isFacingRight==false then
  107. data[p].health=data[p].health-4
  108. tfm.exec.displayParticle(1,x,y,-0.2,0,-0.2,0,nil)
  109. tfm.exec.displayParticle(1,x,y,-0.4,0,-0.4,0,nil)
  110. tfm.exec.displayParticle(1,x,y,-0.6,0,-0.6,0,nil)
  111. tfm.exec.displayParticle(1,x,y,-0.8,0,-0.8,0,nil)
  112. tfm.exec.displayParticle(1,x,y,-1,0,-1,0,nil)
  113. tfm.exec.displayParticle(1,x,y-10,-0.2,0,-0.2,0,nil)
  114. tfm.exec.displayParticle(1,x,y-10,-0.4,0,-0.4,0,nil)
  115. tfm.exec.displayParticle(1,x,y-10,-0.6,0,-0.6,0,nil)
  116. tfm.exec.displayParticle(1,x,y-10,-0.8,0,-0.8,0,nil)
  117. tfm.exec.displayParticle(1,x,y-10,-1,0,-1,0,nil)
  118. tfm.exec.displayParticle(1,x,y+10,-0.2,0,-0.2,0,nil)
  119. tfm.exec.displayParticle(1,x,y+10,-0.4,0,-0.4,0,nli)
  120. tfm.exec.displayParticle(1,x,y+10,-0.6,0,-0.6,0,nil)
  121. tfm.exec.displayParticle(1,x,y+10,-0.8,0,-0.8,0,nil)
  122. tfm.exec.displayParticle(1,x,y+10,-1,0,-1,0,nil)
  123. end
  124. if data[p].health<1 then
  125. tfm.exec.killPlayer(p)
  126. end
  127. end
  128. function nearProtector(n,p,x,y)
  129. if (tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x+50 and tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x-50 and tfm.get.room.playerList[n].y<tfm.get.room.playerList[p].y+30 and tfm.get.room.playerList[n].y>tfm.get.room.playerList[p].y-30) and not (n==p) and data[p].health>0 and data[n].health>0 then
  130. data[n].health=data[n].health-4
  131. tfm.exec.explosion(x,y,20,50,false)
  132. tfm.exec.displayParticle(13,x,y,-0.2,0.1,-0.2,0.1,nil)
  133. tfm.exec.displayParticle(13,x,y,-0.4,0,-0.4,0,nil)
  134. tfm.exec.displayParticle(13,x,y,-0.6,0,-0.6,0,nil)
  135. tfm.exec.displayParticle(3,x,y,-0.8,0,-0.8,0,nil)
  136. tfm.exec.displayParticle(3,x,y,-8,0,-1,0,nil)
  137. tfm.exec.displayParticle(3,x,y-10,-0.2,0.1,-0.2,0.1,nil)
  138. tfm.exec.displayParticle(13,x,y-10,-0.4,0,-0.4,0,nil)
  139. tfm.exec.displayParticle(13,x,y-10,-0.6,0,-0.6,0,nil)
  140. tfm.exec.displayParticle(13,x,y-10,-0.8,0,-0.8,0,nil)
  141. tfm.exec.displayParticle(13,x,y-10,-1,0,-1,0,nil)
  142. tfm.exec.displayParticle(13,x,y+10,-0.2,0.1,-0.2,0.1,nil)
  143. tfm.exec.displayParticle(13,x,y+10,-0.4,0,-0.4,0,nli)
  144. tfm.exec.displayParticle(13,x,y+10,-0.6,0,-0.6,0,nil)
  145. tfm.exec.displayParticle(13,x,y+10,-0.8,-0.1,-0.8,-0.1,nil)
  146. tfm.exec.displayParticle(13,x,y+10,-1,0,-1,0,nil)
  147. tfm.exec.displayParticle(13,x,y,0.2,0,0.2,0,nil)
  148. tfm.exec.displayParticle(13,x,y,0.4,0,0.4,0,nil)
  149. tfm.exec.displayParticle(13,x,y,0.6,0,0.6,0,nil)
  150. tfm.exec.displayParticle(13,x,y,0.8,0,0.8,0,nil)
  151. tfm.exec.displayParticle(13,x,y,1,0,1,0,nil)
  152. tfm.exec.displayParticle(13,x,y-10,0.2,0.1,0.2,0.1,nil)
  153. tfm.exec.displayParticle(13,x,y-10,0.4,0,0.4,0,nil)
  154. tfm.exec.displayParticle(13,x,y-10,0.6,0,0.6,0,nil)
  155. tfm.exec.displayParticle(13,x,y-10,0.8,0,0.8,0,nil)
  156. tfm.exec.displayParticle(13,x,y-10,1,0,1,0,nil)
  157. tfm.exec.displayParticle(13,x,y+10,0.2,0,0.2,0,nil)
  158. tfm.exec.displayParticle(13,x,y+10,0.4,0,0.4,0,nli)
  159. tfm.exec.displayParticle(13,x,y+10,0.6,0,0.6,0,nil)
  160. tfm.exec.displayParticle(3,x,y+10,0.8,0,0.8,0,nil)
  161. tfm.exec.displayParticle(3,x,y+10,8,0,1,0,nil)
  162. end
  163. if data[n].health<1 then
  164. tfm.exec.killPlayer(n)
  165. end
  166. end
  167.  
  168. for n,player in pairs(tfm.get.room.playerList) do
  169. bindKeyboard(n)
  170. setLang(n)
  171. insertName(n)
  172. setData(n)
  173. showMenu(n)
  174. end
  175. chooseRole()
  176. for n,player in pairs(tfm.get.room.playerList) do
  177. identifyBomber(n)
  178. end
  179. function allInfo(n)
  180. bindKeyboard(n)
  181. setLang(n)
  182. insertName(n)
  183. setData(n)
  184. showMenu(n)
  185. identifyBomber(n)
  186. end
  187. function eventNewGame()
  188. chooseRole()
  189. for n,player in pairs(tfm.get.room.playerList) do
  190. identifyBomber(n)
  191. data[n].health=100
  192. end
  193. end
  194. function eventTextAreaCallback(txt, n, a)
  195. if a=="Menu" then
  196. showMenu(n)
  197. elseif a=="menu2" then
  198. showMenu2(n)
  199. elseif a=="Help" then
  200. displayTab(n,text[n].help,text[n].help2)
  201. elseif a=="close" then
  202. close(n)
  203. elseif a=="Profile" then
  204. profile(n,text[n].points..": <J>"..data[n].points)
  205. end
  206. end
  207. function eventNewPlayer(n)
  208. allInfo(n)
  209. end
  210. function eventLoop(time,timeRemaining)
  211. for n,player in pairs(tfm.get.room.playerList) do
  212. showHealth(n)
  213. end
  214. if timeRemaining<=0 then
  215. tfm.exec.newGame(maps[math.random(#maps)])
  216. end
  217. end
  218.  
  219. function eventKeyboard(n, k, d, x, y)
  220. if k==32 and data[n].role==0 then
  221. nearBomber(n,x,y,player)
  222. elseif k==32 and data[n].role==1 then
  223. player=player
  224. for n in pairs(tfm.get.room.playerList) do
  225. nearProtector(n,player,tfm.get.room.playerList[player].x,tfm.get.room.playerList[player].y)
  226. end
  227. end
  228. end
  229. function eventPlayerDied(n)
  230. data[n].health=0
  231. if data[n].role==1 then
  232. tfm.exec.setGameTime(5,true)
  233. end
  234. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement