Boeing747-8

Untitled

Aug 8th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.85 KB | None | 0 0
  1. tfm.exec.setGameTime(3,true)
  2. dp={}
  3. roles={0,1}
  4. maps={7489629}
  5. data={}
  6. text={}
  7. lang={}
  8. players={}
  9. alive=0
  10. lang.en={
  11. menu="Menu",
  12. profile2="Profile",
  13. help2="Help",
  14. help="In #kidnapper the goal of the game is for protectors to catch the mouse with the bomb before the mouse gets to the hole. The mouse with the bomb can use attacks to shield off protectors.",
  15. wins="Total Wins",
  16. wins_Bomber="Wins As Kidnapper",
  17. wins_Protector="Wins As Protector",
  18. close="Close",
  19. health=100,
  20. bomber_Wins="Kidnapper Wins!",
  21. protector_Wins="Protectors Win!",
  22. powerups2="Powerups",
  23. powerup1="[Normal Attack]</J> Is activated by pressing space. Only works for Protectors when they are near the bomber.",
  24. powerup2="[Mega Jump]</J> Is activated by the down arrow.",
  25. mouse_Stolen="kidnapped the mouse!"
  26. }
  27. for _, s in next, {'AutoTimeLeft', 'PhysicalConsumables', 'AfkDeath', 'AutoShaman', 'AutoNewGame'} do
  28. tfm.exec['disable' .. s]()
  29. end
  30. function Dp(name)
  31. name = name:sub(1,1):upper()..name:sub(2):lower()
  32. for i,dp in ipairs(dp) do
  33. if name==dp then
  34. return true
  35. end
  36. end
  37. return false
  38. end
  39. function particles(x,y)
  40. tfm.exec.displayParticle(9,x,y+10,-0.4,0.1,0.2,0.3,nil)
  41. tfm.exec.displayParticle(9,x,y+10,-0.6,0.2,0.6,0.2,nil)
  42. tfm.exec.displayParticle(9,x,y+10,-0.8,0.3,0.8,0.1,nil)
  43. tfm.exec.displayParticle(9,x,y+10,0.4,0.4,-0.4,0.3,nil)
  44. tfm.exec.displayParticle(9,x,y+10,0.6,0.5,-0.6,0.2,nil)
  45. tfm.exec.displayParticle(9,x,y+10,0.8,0.6,-0.8,0.1,nil)
  46. end
  47. function bigJump(n,x,y)
  48. tfm.exec.movePlayer(n,0,0,false,0,-80,true)
  49. tfm.exec.displayParticle(3,x-5,y+10,-0.8,0,0,0,n)
  50. tfm.exec.displayParticle(3,x+5,y+10,0.8,0,0,0,n)
  51. tfm.exec.displayParticle(3,x-10,y+10,-1.7,0,0,0,n)
  52. tfm.exec.displayParticle(3,x+10,y+10,1.7,0,0,0,n)
  53. particles(x,y)
  54. end
  55. function identifyBomber(n)
  56. if data[n].role==0 then
  57. tfm.exec.setNameColor(n,0x00FF00)
  58. tfm.exec.movePlayer(n,1023,432,false,0,50,false)
  59. elseif data[n].role==1 then
  60. tfm.exec.setNameColor(n,0xFF0000)
  61. end
  62. end
  63. function countAlive()
  64. alive=0
  65. for n,player in pairs(tfm.get.room.playerList) do
  66. if tfm.get.room.playerList[n].isDead==false then
  67. alive=alive+1
  68. end
  69. end
  70. end
  71. function removeWinner()
  72. ui.removeTextArea(20,nil)
  73. ui.removeTextArea(30,nil)
  74. ui.removeTextArea(40,nil)
  75. ui.removeTextArea(50,nil)
  76. ui.removeTextArea(60,nil)
  77. ui.removeTextArea(19,nil)
  78. end
  79.  
  80. function win(n)
  81. if tfm.get.room.playerList[n].isDead==false and data[n].role==0 then
  82. data[n].wins=data[n].wins+1
  83. data[n].wins_Protector=data[n].wins_Protector+1
  84. end
  85. end
  86. function insertName(n)
  87. table.insert(players,n)
  88. end
  89. function setLang(n)
  90. text[n]=lang[tfm.get.room.playerList[n].community] or lang.en
  91. end
  92. function setData(n)
  93. data[n]=
  94. {
  95. wins=0,
  96. role=0,
  97. health=100,
  98. spawn=1,
  99. wins_Protector=0,
  100. wins_Bomber=0
  101. }
  102. end
  103. function chooseRole()
  104. for n,player in pairs(tfm.get.room.playerList) do
  105. data[n].role=0
  106. end
  107. player=players[math.random(#players)]
  108. data[player].role=1
  109. player=""..player
  110. end
  111. function bindKeyboard(n)
  112. for i=0,150 do
  113. tfm.exec.bindKeyboard(n,i,true,true)
  114. end
  115. end
  116. function showMenu(n)
  117. 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)
  118. end
  119. function showMenu2(n)
  120. 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.."</a> | <a href='event:Powerups'>"..text[n].powerups2, n, 10, 30, 190, 20, 0x000001, 0xffffff, 1, true)
  121. end
  122. function showHealth(n)
  123. ui.addTextArea(-3, "", n, 319, 27, 100, 18, 0xffffff, 0xffffff, 1, true)
  124. ui.addTextArea(-1, "", n, 319, 27, data[n].health, 18, 0x1aff00, 0x1aff00, 1, true)
  125. ui.addTextArea(-2, "<p align='center'><b><font color='#000000'>"..data[n].health.."%", n, 345, 27, 54, 18, 0x324650, 0x000000, 0, true)
  126. end
  127. function displayTab(n,info,subject)
  128. ui.addTextArea(2, "", n, 262, 72, 360, 290, 0x331f15, 0x331f15, 1, true)
  129. ui.addTextArea(3, "", n, 262, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  130. ui.addTextArea(5, "", n, 295, 72, 290, 4, 0x6b4231, 0x6b4231, 1, true)
  131. ui.addTextArea(4, "", n, 618, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  132. ui.addTextArea(6, "", n, 295, 358, 295, 4, 0x6b4231, 0x6b4231, 1, true)
  133. ui.addTextArea(1, "<p align='center'><font face='calibri'><font size='17'><b>#KIDNAPPER - "..subject.."</b></font></font><font size='14'>\n\n"..info, n, 271, 80, 342, 270, 0x1b262b, 0x131c21, 1, true)
  134. 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)
  135. end
  136. function profile(n,info)
  137. ui.addTextArea(2, "", n, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
  138. ui.addTextArea(3, "", n, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  139. ui.addTextArea(5, "", n, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  140. ui.addTextArea(4, "", n, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  141. ui.addTextArea(6, "", n, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  142. 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)
  143. 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)
  144. end
  145. function profile2(n,info,l)
  146. ui.addTextArea(2, "", l, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
  147. ui.addTextArea(3, "", l, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  148. ui.addTextArea(5, "", l, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  149. ui.addTextArea(4, "", l, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  150. ui.addTextArea(6, "", l, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  151. 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, l, 270, 82, 252, 270, 0x1b262b, 0x131c21, 1, true)
  152. ui.addTextArea(7, "<p align='center'><font size='13'><a href='event:close'>"..text[l].close.."</a></font>", l, 272, 330, 248, 20, 0x324650, 0x324650, 1, true)
  153. end
  154. function close(n)
  155. for i=1,7 do
  156. ui.removeTextArea(i,n)
  157. end
  158. end
  159. function nearBomber(n,x,y,p)
  160. if ((tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x+100 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+50 and tfm.get.room.playerList[n].y>tfm.get.room.playerList[p].y-50) and not (n==p) and data[p].health>0 and tfm.get.room.playerList[n].isFacingRight==true then
  161. tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  162. data[p].health=data[p].health-12.5
  163. tfm.exec.displayParticle(1,x,y,0.2,0,0.2,0,nil)
  164. tfm.exec.displayParticle(1,x,y,0.4,0,0.4,0,nil)
  165. tfm.exec.displayParticle(1,x,y,0.6,0,0.6,0,nil)
  166. tfm.exec.displayParticle(1,x,y,0.8,0,0.8,0,nil)
  167. tfm.exec.displayParticle(1,x,y,1,0,1,0,nil)
  168. tfm.exec.displayParticle(1,x,y-10,0.2,0,0.2,0,nil)
  169. tfm.exec.displayParticle(1,x,y-10,0.4,0,0.4,0,nil)
  170. tfm.exec.displayParticle(1,x,y-10,0.6,0,0.6,0,nil)
  171. tfm.exec.displayParticle(1,x,y-10,0.8,0,0.8,0,nil)
  172. tfm.exec.displayParticle(1,x,y-10,1,0,1,0,nil)
  173. tfm.exec.displayParticle(1,x,y+10,0.2,0,0.2,0,nil)
  174. tfm.exec.displayParticle(1,x,y+10,0.4,0,0.4,0,nli)
  175. tfm.exec.displayParticle(1,x,y+10,0.6,0,0.6,0,nil)
  176. tfm.exec.displayParticle(1,x,y+10,0.8,0,0.8,0,nil)
  177. tfm.exec.displayParticle(1,x,y+10,1,0,1,0,nil)
  178. end
  179. if ((tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x-100 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+50 and tfm.get.room.playerList[n].y>tfm.get.room.playerList[p].y-50) and not (n==p) and data[p].health>0 and tfm.get.room.playerList[n].isFacingRight==false then
  180. tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  181. data[p].health=data[p].health-12.5
  182. tfm.exec.displayParticle(1,x,y,-0.2,0,-0.2,0,nil)
  183. tfm.exec.displayParticle(1,x,y,-0.4,0,-0.4,0,nil)
  184. tfm.exec.displayParticle(1,x,y,-0.6,0,-0.6,0,nil)
  185. tfm.exec.displayParticle(1,x,y,-0.8,0,-0.8,0,nil)
  186. tfm.exec.displayParticle(1,x,y,-1,0,-1,0,nil)
  187. tfm.exec.displayParticle(1,x,y-10,-0.2,0,-0.2,0,nil)
  188. tfm.exec.displayParticle(1,x,y-10,-0.4,0,-0.4,0,nil)
  189. tfm.exec.displayParticle(1,x,y-10,-0.6,0,-0.6,0,nil)
  190. tfm.exec.displayParticle(1,x,y-10,-0.8,0,-0.8,0,nil)
  191. tfm.exec.displayParticle(1,x,y-10,-1,0,-1,0,nil)
  192. tfm.exec.displayParticle(1,x,y+10,-0.2,0,-0.2,0,nil)
  193. tfm.exec.displayParticle(1,x,y+10,-0.4,0,-0.4,0,nli)
  194. tfm.exec.displayParticle(1,x,y+10,-0.6,0,-0.6,0,nil)
  195. tfm.exec.displayParticle(1,x,y+10,-0.8,0,-0.8,0,nil)
  196. tfm.exec.displayParticle(1,x,y+10,-1,0,-1,0,nil)
  197. end
  198. if data[p].health<1 then
  199. tfm.exec.killPlayer(p)
  200. end
  201. end
  202. operation={-110,110}
  203. function nearProtector(n,p,x,y)
  204. if not (n==p) and data[p].health>0 and data[n].health>0 then
  205. tfm.exec.displayParticle(13,x,y,-0.2,0.1,-0.2,0.1,nil)
  206. tfm.exec.displayParticle(13,x,y,-0.4,0,-0.4,0,nil)
  207. tfm.exec.displayParticle(13,x,y,-0.6,0,-0.6,0,nil)
  208. tfm.exec.displayParticle(3,x,y,-0.8,0,-0.8,0,nil)
  209. tfm.exec.displayParticle(3,x,y,-8,0,-1,0,nil)
  210. tfm.exec.displayParticle(3,x,y-10,-0.2,0.1,-0.2,0.1,nil)
  211. tfm.exec.displayParticle(13,x,y-10,-0.4,0,-0.4,0,nil)
  212. tfm.exec.displayParticle(13,x,y-10,-0.6,0,-0.6,0,nil)
  213. tfm.exec.displayParticle(13,x,y-10,-0.8,0,-0.8,0,nil)
  214. tfm.exec.displayParticle(13,x,y-10,-1,0,-1,0,nil)
  215. tfm.exec.displayParticle(13,x,y+10,-0.2,0.1,-0.2,0.1,nil)
  216. tfm.exec.displayParticle(13,x,y+10,-0.4,0,-0.4,0,nli)
  217. tfm.exec.displayParticle(13,x,y+10,-0.6,0,-0.6,0,nil)
  218. tfm.exec.displayParticle(13,x,y+10,-0.8,-0.1,-0.8,-0.1,nil)
  219. tfm.exec.displayParticle(13,x,y+10,-1,0,-1,0,nil)
  220. tfm.exec.displayParticle(13,x,y,0.2,0,0.2,0,nil)
  221. tfm.exec.displayParticle(13,x,y,0.4,0,0.4,0,nil)
  222. tfm.exec.displayParticle(13,x,y,0.6,0,0.6,0,nil)
  223. tfm.exec.displayParticle(13,x,y,0.8,0,0.8,0,nil)
  224. tfm.exec.displayParticle(13,x,y,1,0,1,0,nil)
  225. tfm.exec.displayParticle(13,x,y-10,0.2,0.1,0.2,0.1,nil)
  226. tfm.exec.displayParticle(13,x,y-10,0.4,0,0.4,0,nil)
  227. tfm.exec.displayParticle(13,x,y-10,0.6,0,0.6,0,nil)
  228. tfm.exec.displayParticle(13,x,y-10,0.8,0,0.8,0,nil)
  229. tfm.exec.displayParticle(13,x,y-10,1,0,1,0,nil)
  230. tfm.exec.displayParticle(13,x,y+10,0.2,0,0.2,0,nil)
  231. tfm.exec.displayParticle(13,x,y+10,0.4,0,0.4,0,nli)
  232. tfm.exec.displayParticle(13,x,y+10,0.6,0,0.6,0,nil)
  233. tfm.exec.displayParticle(3,x,y+10,0.8,0,0.8,0,nil)
  234. tfm.exec.displayParticle(3,x,y+10,8,0,1,0,nil)
  235. end
  236. if (tfm.get.room.playerList[n].x<tfm.get.room.playerList[p].x+70 and tfm.get.room.playerList[n].x>tfm.get.room.playerList[p].x-70 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
  237. data[n].health=data[n].health-12.5
  238. tfm.exec.movePlayer(n,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  239. end
  240. if data[n].health<1 then
  241. tfm.exec.killPlayer(n)
  242. end
  243. end
  244.  
  245. for n,player in pairs(tfm.get.room.playerList) do
  246. bindKeyboard(n)
  247. setLang(n)
  248. insertName(n)
  249. setData(n)
  250. showMenu(n)
  251. table.insert(dp,n)
  252. end
  253. chooseRole()
  254. for n,player in pairs(tfm.get.room.playerList) do
  255. identifyBomber(n)
  256. end
  257. function allInfo(n)
  258. bindKeyboard(n)
  259. setLang(n)
  260. insertName(n)
  261. setData(n)
  262. showMenu(n)
  263. identifyBomber(n)
  264. table.insert(dp,n)
  265. end
  266. function eventNewGame()
  267. players={}
  268. for n,player in pairs(tfm.get.room.playerList) do
  269. insertName(n)
  270. end
  271. chooseRole()
  272. countAlive()
  273. removeWinner()
  274. for n,player in pairs(tfm.get.room.playerList) do
  275. identifyBomber(n)
  276. data[n].health=100
  277. end
  278. id=tfm.exec.addImage("1651b5bc86d.png","$"..player, -40, -25)
  279. for n,player in pairs(tfm.get.room.playerList) do
  280. tfm.exec.chatMessage("<R>"..player.."<J> "..text[n].mouse_Stolen,n)
  281. end
  282. end
  283. function eventTextAreaCallback(txt, n, a)
  284. if a=="Menu" then
  285. showMenu(n)
  286. elseif a=="menu2" then
  287. showMenu2(n)
  288. elseif a=="Help" then
  289. displayTab(n,text[n].help,text[n].help2)
  290. elseif a=="close" then
  291. close(n)
  292. elseif a=="Profile" then
  293. profile(n,text[n].wins..": <J>"..data[n].wins.."\n\n</J>"..text[n].wins_Bomber..": <J>"..data[n].wins_Bomber.."\n\n</J>"..text[n].wins_Protector..": <J>"..data[n].wins_Protector)
  294. elseif a=="Powerups" then
  295. displayTab(n,"<J>"..text[n].powerup1.."\n\n<J>"..text[n].powerup2,text[n].powerups2)
  296. end
  297. end
  298. function eventNewPlayer(n)
  299. allInfo(n)
  300. end
  301. function eventLoop(time,timeRemaining)
  302. for n,player in pairs(tfm.get.room.playerList) do
  303. data[n].spawn=data[n].spawn+0.5
  304. showHealth(n)
  305. end
  306. if timeRemaining<=0 then
  307. tfm.exec.newGame(maps[math.random(#maps)])
  308. end
  309. end
  310.  
  311. function eventKeyboard(n, k, d, x, y)
  312. if k==32 and data[n].role==0 and data[n].spawn>0 and tfm.get.room.playerList[n].isDead==false then
  313. nearBomber(n,x,y,player)
  314. data[n].spawn=-1
  315. elseif k==32 and data[n].role==1 and data[n].spawn>0 and tfm.get.room.playerList[n].isDead==false then
  316. data[n].spawn=-1.5
  317. player=player
  318. for n in pairs(tfm.get.room.playerList) do
  319. nearProtector(n,player,tfm.get.room.playerList[player].x,tfm.get.room.playerList[player].y)
  320. end
  321. elseif k==3 and data[n].spawn>0 then
  322. data[n].spawn=-2
  323. player=player
  324. bigJump(n,x,y)
  325. elseif k==112 then
  326.  
  327. end
  328. end
  329. function eventPlayerDied(n)
  330. for n,player in pairs(tfm.get.room.playerList) do
  331. win(n)
  332. end
  333. countAlive()
  334. data[n].health=0
  335. if data[n].role==1 then
  336. for n,player in pairs(tfm.get.room.playerList) do
  337. ui.addTextArea(20, "", n, 262, 172, 268, 66, 0x331f15, 0x331f15, 1, true)
  338. ui.addTextArea(30, "", n, 262, 191, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  339. ui.addTextArea(50, "", n, 300, 172, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  340. ui.addTextArea(40, "", n, 526, 192, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  341. ui.addTextArea(60, "", n, 300, 234, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  342. ui.addTextArea(19, "<p align='center'><font size='20'><VP>"..text[n].protector_Wins, n, 270, 182, 252, 44, 0x1b262b, 0x131c21, 1, true)
  343. tfm.exec.setGameTime(5,true)
  344. end
  345. end
  346. end
  347.  
  348. function eventMouse(playerName,x,y)
  349. print("<VP>X</VP><N>:</N><J> "..x.."</J><VP> Y</VP><N>:</N><J> "..y)
  350. end
  351. system.bindMouse("Fuzzyfirsdog#0000", true)
  352. function eventPlayerGetCheese(n)
  353. if data[n].role==1 then
  354. data[n].wins=data[n].wins+1
  355. data[n].wins_Bomber=data[n].wins_Bomber+1
  356. tfm.exec.setGameTime(10,true)
  357. for n,player in pairs(tfm.get.room.playerList) do
  358. ui.addTextArea(20, "", n, 262, 172, 268, 66, 0x331f15, 0x331f15, 1, true)
  359. ui.addTextArea(30, "", n, 262, 191, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  360. ui.addTextArea(50, "", n, 300, 172, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  361. ui.addTextArea(40, "", n, 526, 192, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  362. ui.addTextArea(60, "", n, 300, 234, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  363. ui.addTextArea(19, "<p align='center'><font size='20'><R>"..text[n].bomber_Wins, n, 270, 182, 252, 44, 0x1b262b, 0x131c21, 1, true)
  364. if not (data[n].role==1) then
  365. tfm.exec.killPlayer(n)
  366. end
  367. end
  368. end
  369. end
  370. system.disableChatCommandDisplay("p",true)
  371. function eventChatCommand(l,c)
  372. if c=="p" then
  373. profile(l,text[l].wins..": <J>"..data[l].wins.."\n\n</J>"..text[l].wins_Bomber..": <J>"..data[l].wins_Bomber.."\n\n</J>"..text[l].wins_Protector..": <J>"..data[l].wins_Protector)
  374. end
  375. if c:sub(0,1)=="p" and Dp(c:sub(3))then
  376. n = c:sub(3,3):upper()..c:sub(4):lower()
  377. profile2(n,text[l].wins..": <J>"..data[n].wins.."\n\n</J>"..text[l].wins_Bomber..": <J>"..data[n].wins_Bomber.."\n\n</J>"..text[l].wins_Protector..": <J>"..data[n].wins_Protector,l)
  378. end
  379. end
Advertisement
Add Comment
Please, Sign In to add comment