Advertisement
Boeing747-8

Untitled

Aug 8th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. mouseStolen="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. p=0,
  102. stolen=""
  103. }
  104. end
  105. function chooseRole()
  106. for n,player in pairs(tfm.get.room.playerList) do
  107. data[n].role=0
  108. end
  109. player=players[math.random(#players)]
  110. data[player].role=1
  111. player=""..player
  112. end
  113. function bindKeyboard(n)
  114. for i=0,150 do
  115. tfm.exec.bindKeyboard(n,i,true,true)
  116. end
  117. end
  118. function showMenu(n)
  119. 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)
  120. end
  121. function showMenu2(n)
  122. 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)
  123. end
  124. function showHealth(n)
  125. ui.addTextArea(-3, "", n, 319, 27, 100, 18, 0xffffff, 0xffffff, 1, true)
  126. ui.addTextArea(-1, "", n, 319, 27, data[n].health, 18, 0x1aff00, 0x1aff00, 1, true)
  127. ui.addTextArea(-2, "<p align='center'><b><font color='#000000'>"..data[n].health.."%", n, 345, 27, 54, 18, 0x324650, 0x000000, 0, true)
  128. end
  129. function displayTab(n,info,subject)
  130. ui.addTextArea(2, "", n, 262, 72, 360, 290, 0x331f15, 0x331f15, 1, true)
  131. ui.addTextArea(3, "", n, 262, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  132. ui.addTextArea(5, "", n, 295, 72, 290, 4, 0x6b4231, 0x6b4231, 1, true)
  133. ui.addTextArea(4, "", n, 618, 125, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  134. ui.addTextArea(6, "", n, 295, 358, 295, 4, 0x6b4231, 0x6b4231, 1, true)
  135. 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)
  136. 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)
  137. end
  138. function profile(n,info)
  139. ui.addTextArea(2, "", n, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
  140. ui.addTextArea(3, "", n, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  141. ui.addTextArea(5, "", n, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  142. ui.addTextArea(4, "", n, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  143. ui.addTextArea(6, "", n, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  144. 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)
  145. 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)
  146. end
  147. function profile2(n,info,l)
  148. ui.addTextArea(2, "", l, 262, 72, 268, 290, 0x331f15, 0x331f15, 1, true)
  149. ui.addTextArea(3, "", l, 262, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  150. ui.addTextArea(5, "", l, 295, 72, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  151. ui.addTextArea(4, "", l, 526, 120, 4, 180, 0x6b4231, 0x6b4231, 1, true)
  152. ui.addTextArea(6, "", l, 295, 358, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  153. 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)
  154. 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)
  155. end
  156. function close(n)
  157. for i=1,7 do
  158. ui.removeTextArea(i,n)
  159. end
  160. end
  161. function nearBomber(n,x,y,p)
  162. 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
  163. tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  164. data[p].health=data[p].health-12.5
  165. tfm.exec.displayParticle(1,x,y,0.2,0,0.2,0,nil)
  166. tfm.exec.displayParticle(1,x,y,0.4,0,0.4,0,nil)
  167. tfm.exec.displayParticle(1,x,y,0.6,0,0.6,0,nil)
  168. tfm.exec.displayParticle(1,x,y,0.8,0,0.8,0,nil)
  169. tfm.exec.displayParticle(1,x,y,1,0,1,0,nil)
  170. tfm.exec.displayParticle(1,x,y-10,0.2,0,0.2,0,nil)
  171. tfm.exec.displayParticle(1,x,y-10,0.4,0,0.4,0,nil)
  172. tfm.exec.displayParticle(1,x,y-10,0.6,0,0.6,0,nil)
  173. tfm.exec.displayParticle(1,x,y-10,0.8,0,0.8,0,nil)
  174. tfm.exec.displayParticle(1,x,y-10,1,0,1,0,nil)
  175. tfm.exec.displayParticle(1,x,y+10,0.2,0,0.2,0,nil)
  176. tfm.exec.displayParticle(1,x,y+10,0.4,0,0.4,0,nli)
  177. tfm.exec.displayParticle(1,x,y+10,0.6,0,0.6,0,nil)
  178. tfm.exec.displayParticle(1,x,y+10,0.8,0,0.8,0,nil)
  179. tfm.exec.displayParticle(1,x,y+10,1,0,1,0,nil)
  180. end
  181. 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
  182. tfm.exec.movePlayer(p,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  183. data[p].health=data[p].health-12.5
  184. tfm.exec.displayParticle(1,x,y,-0.2,0,-0.2,0,nil)
  185. tfm.exec.displayParticle(1,x,y,-0.4,0,-0.4,0,nil)
  186. tfm.exec.displayParticle(1,x,y,-0.6,0,-0.6,0,nil)
  187. tfm.exec.displayParticle(1,x,y,-0.8,0,-0.8,0,nil)
  188. tfm.exec.displayParticle(1,x,y,-1,0,-1,0,nil)
  189. tfm.exec.displayParticle(1,x,y-10,-0.2,0,-0.2,0,nil)
  190. tfm.exec.displayParticle(1,x,y-10,-0.4,0,-0.4,0,nil)
  191. tfm.exec.displayParticle(1,x,y-10,-0.6,0,-0.6,0,nil)
  192. tfm.exec.displayParticle(1,x,y-10,-0.8,0,-0.8,0,nil)
  193. tfm.exec.displayParticle(1,x,y-10,-1,0,-1,0,nil)
  194. tfm.exec.displayParticle(1,x,y+10,-0.2,0,-0.2,0,nil)
  195. tfm.exec.displayParticle(1,x,y+10,-0.4,0,-0.4,0,nli)
  196. tfm.exec.displayParticle(1,x,y+10,-0.6,0,-0.6,0,nil)
  197. tfm.exec.displayParticle(1,x,y+10,-0.8,0,-0.8,0,nil)
  198. tfm.exec.displayParticle(1,x,y+10,-1,0,-1,0,nil)
  199. end
  200. if data[p].health<1 then
  201. tfm.exec.killPlayer(p)
  202. end
  203. end
  204. operation={-110,110}
  205. function nearProtector(n,p,x,y)
  206. if not (n==p) and data[p].health>0 and data[n].health>0 then
  207. tfm.exec.displayParticle(13,x,y,-0.2,0.1,-0.2,0.1,nil)
  208. tfm.exec.displayParticle(13,x,y,-0.4,0,-0.4,0,nil)
  209. tfm.exec.displayParticle(13,x,y,-0.6,0,-0.6,0,nil)
  210. tfm.exec.displayParticle(3,x,y,-0.8,0,-0.8,0,nil)
  211. tfm.exec.displayParticle(3,x,y,-8,0,-1,0,nil)
  212. tfm.exec.displayParticle(3,x,y-10,-0.2,0.1,-0.2,0.1,nil)
  213. tfm.exec.displayParticle(13,x,y-10,-0.4,0,-0.4,0,nil)
  214. tfm.exec.displayParticle(13,x,y-10,-0.6,0,-0.6,0,nil)
  215. tfm.exec.displayParticle(13,x,y-10,-0.8,0,-0.8,0,nil)
  216. tfm.exec.displayParticle(13,x,y-10,-1,0,-1,0,nil)
  217. tfm.exec.displayParticle(13,x,y+10,-0.2,0.1,-0.2,0.1,nil)
  218. tfm.exec.displayParticle(13,x,y+10,-0.4,0,-0.4,0,nli)
  219. tfm.exec.displayParticle(13,x,y+10,-0.6,0,-0.6,0,nil)
  220. tfm.exec.displayParticle(13,x,y+10,-0.8,-0.1,-0.8,-0.1,nil)
  221. tfm.exec.displayParticle(13,x,y+10,-1,0,-1,0,nil)
  222. tfm.exec.displayParticle(13,x,y,0.2,0,0.2,0,nil)
  223. tfm.exec.displayParticle(13,x,y,0.4,0,0.4,0,nil)
  224. tfm.exec.displayParticle(13,x,y,0.6,0,0.6,0,nil)
  225. tfm.exec.displayParticle(13,x,y,0.8,0,0.8,0,nil)
  226. tfm.exec.displayParticle(13,x,y,1,0,1,0,nil)
  227. tfm.exec.displayParticle(13,x,y-10,0.2,0.1,0.2,0.1,nil)
  228. tfm.exec.displayParticle(13,x,y-10,0.4,0,0.4,0,nil)
  229. tfm.exec.displayParticle(13,x,y-10,0.6,0,0.6,0,nil)
  230. tfm.exec.displayParticle(13,x,y-10,0.8,0,0.8,0,nil)
  231. tfm.exec.displayParticle(13,x,y-10,1,0,1,0,nil)
  232. tfm.exec.displayParticle(13,x,y+10,0.2,0,0.2,0,nil)
  233. tfm.exec.displayParticle(13,x,y+10,0.4,0,0.4,0,nli)
  234. tfm.exec.displayParticle(13,x,y+10,0.6,0,0.6,0,nil)
  235. tfm.exec.displayParticle(3,x,y+10,0.8,0,0.8,0,nil)
  236. tfm.exec.displayParticle(3,x,y+10,8,0,1,0,nil)
  237. end
  238. 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
  239. data[n].health=data[n].health-12.5
  240. tfm.exec.movePlayer(n,0,0,false,operation[math.random(#operation)],operation[math.random(#operation)],true)
  241. end
  242. if data[n].health<1 then
  243. tfm.exec.killPlayer(n)
  244. end
  245. end
  246.  
  247. for n,player in pairs(tfm.get.room.playerList) do
  248. bindKeyboard(n)
  249. setLang(n)
  250. insertName(n)
  251. setData(n)
  252. showMenu(n)
  253. table.insert(dp,n)
  254. end
  255. chooseRole()
  256. for n,player in pairs(tfm.get.room.playerList) do
  257. identifyBomber(n)
  258. end
  259. function allInfo(n)
  260. bindKeyboard(n)
  261. setLang(n)
  262. insertName(n)
  263. setData(n)
  264. showMenu(n)
  265. identifyBomber(n)
  266. table.insert(dp,n)
  267. end
  268. function eventNewGame()
  269. players={}
  270. for n,player in pairs(tfm.get.room.playerList) do
  271. insertName(n)
  272. end
  273. chooseRole()
  274. countAlive()
  275. removeWinner()
  276. for n,player in pairs(tfm.get.room.playerList) do
  277. identifyBomber(n)
  278. data[n].health=100
  279. end
  280. id=tfm.exec.addImage("1651b5bc86d.png","$"..player, -40, -25)
  281. for n,player in pairs(tfm.get.room.playerList) do
  282. data[n].stolen="<R>"..data[n].p.."<J> "..text[n].mouseStolen
  283. tfm.exec.chatMessage(data[n].stolen,n)
  284. end
  285. end
  286. function eventTextAreaCallback(txt, n, a)
  287. if a=="Menu" then
  288. showMenu(n)
  289. elseif a=="menu2" then
  290. showMenu2(n)
  291. elseif a=="Help" then
  292. displayTab(n,text[n].help,text[n].help2)
  293. elseif a=="close" then
  294. close(n)
  295. elseif a=="Profile" then
  296. 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)
  297. elseif a=="Powerups" then
  298. displayTab(n,"<J>"..text[n].powerup1.."\n\n<J>"..text[n].powerup2,text[n].powerups2)
  299. end
  300. end
  301. function eventNewPlayer(n)
  302. allInfo(n)
  303. end
  304. function eventLoop(time,timeRemaining)
  305. for n,player in pairs(tfm.get.room.playerList) do
  306. data[n].spawn=data[n].spawn+0.5
  307. showHealth(n)
  308. end
  309. if timeRemaining<=0 then
  310. tfm.exec.newGame(maps[math.random(#maps)])
  311. end
  312. end
  313.  
  314. function eventKeyboard(n, k, d, x, y)
  315. if k==32 and data[n].role==0 and data[n].spawn>0 and tfm.get.room.playerList[n].isDead==false then
  316. nearBomber(n,x,y,player)
  317. data[n].spawn=-1
  318. elseif k==32 and data[n].role==1 and data[n].spawn>0 and tfm.get.room.playerList[n].isDead==false then
  319. data[n].spawn=-1.5
  320. player=player
  321. for n in pairs(tfm.get.room.playerList) do
  322. nearProtector(n,player,tfm.get.room.playerList[player].x,tfm.get.room.playerList[player].y)
  323. end
  324. elseif k==3 and data[n].spawn>0 then
  325. data[n].spawn=-2
  326. player=player
  327. bigJump(n,x,y)
  328. elseif k==112 then
  329.  
  330. end
  331. end
  332. function eventPlayerDied(n)
  333. for n,player in pairs(tfm.get.room.playerList) do
  334. win(n)
  335. end
  336. countAlive()
  337. data[n].health=0
  338. if data[n].role==1 then
  339. for n,player in pairs(tfm.get.room.playerList) do
  340. ui.addTextArea(20, "", n, 262, 172, 268, 66, 0x331f15, 0x331f15, 1, true)
  341. ui.addTextArea(30, "", n, 262, 191, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  342. ui.addTextArea(50, "", n, 300, 172, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  343. ui.addTextArea(40, "", n, 526, 192, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  344. ui.addTextArea(60, "", n, 300, 234, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  345. ui.addTextArea(19, "<p align='center'><font size='20'><VP>"..text[n].protector_Wins, n, 270, 182, 252, 44, 0x1b262b, 0x131c21, 1, true)
  346. tfm.exec.setGameTime(5,true)
  347. end
  348. end
  349. end
  350.  
  351. function eventMouse(playerName,x,y)
  352. print("<VP>X</VP><N>:</N><J> "..x.."</J><VP> Y</VP><N>:</N><J> "..y)
  353. end
  354. system.bindMouse("Fuzzyfirsdog#0000", true)
  355. function eventPlayerGetCheese(n)
  356. if data[n].role==1 then
  357. data[n].wins=data[n].wins+1
  358. data[n].wins_Bomber=data[n].wins_Bomber+1
  359. tfm.exec.setGameTime(10,true)
  360. for n,player in pairs(tfm.get.room.playerList) do
  361. ui.addTextArea(20, "", n, 262, 172, 268, 66, 0x331f15, 0x331f15, 1, true)
  362. ui.addTextArea(30, "", n, 262, 191, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  363. ui.addTextArea(50, "", n, 300, 172, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  364. ui.addTextArea(40, "", n, 526, 192, 4, 26, 0x6b4231, 0x6b4231, 1, true)
  365. ui.addTextArea(60, "", n, 300, 234, 198, 4, 0x6b4231, 0x6b4231, 1, true)
  366. ui.addTextArea(19, "<p align='center'><font size='20'><R>"..text[n].bomber_Wins, n, 270, 182, 252, 44, 0x1b262b, 0x131c21, 1, true)
  367. if not (data[n].role==1) then
  368. tfm.exec.killPlayer(n)
  369. end
  370. end
  371. end
  372. end
  373. system.disableChatCommandDisplay("p",true)
  374. function eventChatCommand(l,c)
  375. if c=="p" then
  376. 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)
  377. end
  378. if c:sub(0,1)=="p" and Dp(c:sub(3))then
  379. n = c:sub(3,3):upper()..c:sub(4):lower()
  380. 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)
  381. end
  382. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement