Advertisement
Boeing747-8

Untitled

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