Advertisement
Boeing747-8

Untitled

Aug 8th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.86 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. for n,player in pairs(tfm.get.room.playerList) do
  62. tfm.exec.chatMessage("<R>"..player.."<J> "..text[n].mouse_Stolen,n)
  63. end
  64. end
  65. end
  66. function countAlive()
  67. alive=0
  68. for n,player in pairs(tfm.get.room.playerList) do
  69. if tfm.get.room.playerList[n].isDead==false then
  70. alive=alive+1
  71. end
  72. end
  73. end
  74. function removeWinner()
  75. ui.removeTextArea(20,nil)
  76. ui.removeTextArea(30,nil)
  77. ui.removeTextArea(40,nil)
  78. ui.removeTextArea(50,nil)
  79. ui.removeTextArea(60,nil)
  80. ui.removeTextArea(19,nil)
  81. end
  82.  
  83. function win(n)
  84. if tfm.get.room.playerList[n].isDead==false and data[n].role==0 then
  85. data[n].wins=data[n].wins+1
  86. data[n].wins_Protector=data[n].wins_Protector+1
  87. end
  88. end
  89. function insertName(n)
  90. table.insert(players,n)
  91. end
  92. function setLang(n)
  93. text[n]=lang[tfm.get.room.playerList[n].community] or lang.en
  94. end
  95. function setData(n)
  96. data[n]=
  97. {
  98. wins=0,
  99. role=0,
  100. health=100,
  101. spawn=1,
  102. wins_Protector=0,
  103. wins_Bomber=0
  104. }
  105. end
  106. function chooseRole()
  107. for n,player in pairs(tfm.get.room.playerList) do
  108. data[n].role=0
  109. end
  110. player=players[math.random(#players)]
  111. data[player].role=1
  112. player=""..player
  113. end
  114. function bindKeyboard(n)
  115. for i=0,150 do
  116. tfm.exec.bindKeyboard(n,i,true,true)
  117. end
  118. end
  119. function showMenu(n)
  120. 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)
  121. end
  122. function showMenu2(n)
  123. 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)
  124. end
  125. function showHealth(n)
  126. ui.addTextArea(-3, "", n, 319, 27, 100, 18, 0xffffff, 0xffffff, 1, true)
  127. ui.addTextArea(-1, "", n, 319, 27, data[n].health, 18, 0x1aff00, 0x1aff00, 1, true)
  128. ui.addTextArea(-2, "<p align='center'><b><font color='#000000'>"..data[n].health.."%", n, 345, 27, 54, 18, 0x324650, 0x000000, 0, true)
  129. end
  130. function displayTab(n,info,subject)
  131. ui.addTextArea(2, "", n, 262, 72, 360, 290, 0x331f15, 0x331f15, 1, true)
  132. ui.addTextArea(3, "", n, 262, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  133. ui.addTextArea(5, "", n, 295, 72, 290, 4, 0x6b4231, 0x6b4231, 1, true)
  134. ui.addTextArea(4, "", n, 618, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  135. ui.addTextArea(6, "", n, 295, 358, 295, 4, 0x6b4231, 0x6b4231, 1, true)
  136. 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)
  137. 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)
  138. end
  139. function profile(n,info)
  140. ui.addTextArea(2, "", n, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
  141. ui.addTextArea(3, "", n, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  142. ui.addTextArea(5, "", n, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  143. ui.addTextArea(4, "", n, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  144. ui.addTextArea(6, "", n, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  145. 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)
  146. 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)
  147. end
  148. function profile2(n,info,l)
  149. ui.addTextArea(2, "", l, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
  150. ui.addTextArea(3, "", l, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  151. ui.addTextArea(5, "", l, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  152. ui.addTextArea(4, "", l, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  153. ui.addTextArea(6, "", l, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  154. 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)
  155. 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)
  156. end
  157. function close(n)
  158. for i=1,7 do
  159. ui.removeTextArea(i,n)
  160. end
  161. end
  162. function nearBomber(n,x,y,p)
  163. 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
  164. tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  165. data[p].health=data[p].health-12.5
  166. tfm.exec.displayParticle(1,x,y,0.2,0,0.2,0,nil)
  167. tfm.exec.displayParticle(1,x,y,0.4,0,0.4,0,nil)
  168. tfm.exec.displayParticle(1,x,y,0.6,0,0.6,0,nil)
  169. tfm.exec.displayParticle(1,x,y,0.8,0,0.8,0,nil)
  170. tfm.exec.displayParticle(1,x,y,1,0,1,0,nil)
  171. tfm.exec.displayParticle(1,x,y-10,0.2,0,0.2,0,nil)
  172. tfm.exec.displayParticle(1,x,y-10,0.4,0,0.4,0,nil)
  173. tfm.exec.displayParticle(1,x,y-10,0.6,0,0.6,0,nil)
  174. tfm.exec.displayParticle(1,x,y-10,0.8,0,0.8,0,nil)
  175. tfm.exec.displayParticle(1,x,y-10,1,0,1,0,nil)
  176. tfm.exec.displayParticle(1,x,y+10,0.2,0,0.2,0,nil)
  177. tfm.exec.displayParticle(1,x,y+10,0.4,0,0.4,0,nli)
  178. tfm.exec.displayParticle(1,x,y+10,0.6,0,0.6,0,nil)
  179. tfm.exec.displayParticle(1,x,y+10,0.8,0,0.8,0,nil)
  180. tfm.exec.displayParticle(1,x,y+10,1,0,1,0,nil)
  181. end
  182. 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
  183. tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  184. data[p].health=data[p].health-12.5
  185. tfm.exec.displayParticle(1,x,y,-0.2,0,-0.2,0,nil)
  186. tfm.exec.displayParticle(1,x,y,-0.4,0,-0.4,0,nil)
  187. tfm.exec.displayParticle(1,x,y,-0.6,0,-0.6,0,nil)
  188. tfm.exec.displayParticle(1,x,y,-0.8,0,-0.8,0,nil)
  189. tfm.exec.displayParticle(1,x,y,-1,0,-1,0,nil)
  190. tfm.exec.displayParticle(1,x,y-10,-0.2,0,-0.2,0,nil)
  191. tfm.exec.displayParticle(1,x,y-10,-0.4,0,-0.4,0,nil)
  192. tfm.exec.displayParticle(1,x,y-10,-0.6,0,-0.6,0,nil)
  193. tfm.exec.displayParticle(1,x,y-10,-0.8,0,-0.8,0,nil)
  194. tfm.exec.displayParticle(1,x,y-10,-1,0,-1,0,nil)
  195. tfm.exec.displayParticle(1,x,y+10,-0.2,0,-0.2,0,nil)
  196. tfm.exec.displayParticle(1,x,y+10,-0.4,0,-0.4,0,nli)
  197. tfm.exec.displayParticle(1,x,y+10,-0.6,0,-0.6,0,nil)
  198. tfm.exec.displayParticle(1,x,y+10,-0.8,0,-0.8,0,nil)
  199. tfm.exec.displayParticle(1,x,y+10,-1,0,-1,0,nil)
  200. end
  201. if data[p].health<1 then
  202. tfm.exec.killPlayer(p)
  203. end
  204. end
  205. operation={-110,110}
  206. function nearProtector(n,p,x,y)
  207. if not (n==p) and data[p].health>0 and data[n].health>0 then
  208. tfm.exec.displayParticle(13,x,y,-0.2,0.1,-0.2,0.1,nil)
  209. tfm.exec.displayParticle(13,x,y,-0.4,0,-0.4,0,nil)
  210. tfm.exec.displayParticle(13,x,y,-0.6,0,-0.6,0,nil)
  211. tfm.exec.displayParticle(3,x,y,-0.8,0,-0.8,0,nil)
  212. tfm.exec.displayParticle(3,x,y,-8,0,-1,0,nil)
  213. tfm.exec.displayParticle(3,x,y-10,-0.2,0.1,-0.2,0.1,nil)
  214. tfm.exec.displayParticle(13,x,y-10,-0.4,0,-0.4,0,nil)
  215. tfm.exec.displayParticle(13,x,y-10,-0.6,0,-0.6,0,nil)
  216. tfm.exec.displayParticle(13,x,y-10,-0.8,0,-0.8,0,nil)
  217. tfm.exec.displayParticle(13,x,y-10,-1,0,-1,0,nil)
  218. tfm.exec.displayParticle(13,x,y+10,-0.2,0.1,-0.2,0.1,nil)
  219. tfm.exec.displayParticle(13,x,y+10,-0.4,0,-0.4,0,nli)
  220. tfm.exec.displayParticle(13,x,y+10,-0.6,0,-0.6,0,nil)
  221. tfm.exec.displayParticle(13,x,y+10,-0.8,-0.1,-0.8,-0.1,nil)
  222. tfm.exec.displayParticle(13,x,y+10,-1,0,-1,0,nil)
  223. tfm.exec.displayParticle(13,x,y,0.2,0,0.2,0,nil)
  224. tfm.exec.displayParticle(13,x,y,0.4,0,0.4,0,nil)
  225. tfm.exec.displayParticle(13,x,y,0.6,0,0.6,0,nil)
  226. tfm.exec.displayParticle(13,x,y,0.8,0,0.8,0,nil)
  227. tfm.exec.displayParticle(13,x,y,1,0,1,0,nil)
  228. tfm.exec.displayParticle(13,x,y-10,0.2,0.1,0.2,0.1,nil)
  229. tfm.exec.displayParticle(13,x,y-10,0.4,0,0.4,0,nil)
  230. tfm.exec.displayParticle(13,x,y-10,0.6,0,0.6,0,nil)
  231. tfm.exec.displayParticle(13,x,y-10,0.8,0,0.8,0,nil)
  232. tfm.exec.displayParticle(13,x,y-10,1,0,1,0,nil)
  233. tfm.exec.displayParticle(13,x,y+10,0.2,0,0.2,0,nil)
  234. tfm.exec.displayParticle(13,x,y+10,0.4,0,0.4,0,nli)
  235. tfm.exec.displayParticle(13,x,y+10,0.6,0,0.6,0,nil)
  236. tfm.exec.displayParticle(3,x,y+10,0.8,0,0.8,0,nil)
  237. tfm.exec.displayParticle(3,x,y+10,8,0,1,0,nil)
  238. end
  239. 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
  240. data[n].health=data[n].health-12.5
  241. tfm.exec.movePlayer(n,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  242. end
  243. if data[n].health<1 then
  244. tfm.exec.killPlayer(n)
  245. end
  246. end
  247.  
  248. for n,player in pairs(tfm.get.room.playerList) do
  249. bindKeyboard(n)
  250. setLang(n)
  251. insertName(n)
  252. setData(n)
  253. showMenu(n)
  254. table.insert(dp,n)
  255. end
  256. chooseRole()
  257. for n,player in pairs(tfm.get.room.playerList) do
  258. identifyBomber(n)
  259. end
  260. function allInfo(n)
  261. bindKeyboard(n)
  262. setLang(n)
  263. insertName(n)
  264. setData(n)
  265. showMenu(n)
  266. identifyBomber(n)
  267. table.insert(dp,n)
  268. end
  269. function eventNewGame()
  270. players={}
  271. for n,player in pairs(tfm.get.room.playerList) do
  272. insertName(n)
  273. end
  274. chooseRole()
  275. countAlive()
  276. removeWinner()
  277. for n,player in pairs(tfm.get.room.playerList) do
  278. identifyBomber(n)
  279. data[n].health=100
  280. end
  281. id=tfm.exec.addImage("1651b5bc86d.png","$"..player, -40, -25)
  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
Advertisement