Boeing747-8

Untitled

Dec 20th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.34 KB | None | 0 0
  1.  
  2. tfm.exec.disableAfkDeath(true)
  3. tfm.exec.disableAutoShaman(true)
  4.  
  5.  
  6.  
  7.  
  8. tfm.exec.disableAutoNewGame(true)
  9. maps={6946086,6354056,6373101,6947670,6973435}
  10.  
  11. function eventLoop(time,remaining)
  12. if remaining<=0 then
  13. tfm.exec.newGame(maps[math.random(#maps)])
  14. end
  15. end
  16.  
  17. function eventPlayerDied()
  18. local i=0
  19. for n,player in pairs(tfm.get.room.playerList) do
  20. if not player.isDead then
  21. i=i+1
  22. tfm.exec.respawnPlayer(n)
  23. end
  24. end
  25. if i==0 then
  26. tfm.exec.newGame(maps[math.random(#maps)])
  27. end
  28. end
  29.  
  30. function eventPlayerWon(name)
  31. tfm.exec.respawnPlayer(name)
  32. tfm.exec.chatMessage("<VP>You just completed the level!",name)
  33. tfm.exec.chatMessage("<VP>Your score: "..tfm.get.room.playerList[name].score,name)
  34. end
  35.  
  36. DOWN0 = string.byte("W")
  37. DOWN3 = string.byte("O")
  38. DOWN4 = 38
  39. DOWN1 = 40 --keycode of down arrow
  40. DOWN2 = string.byte("S") --keycode of S
  41.  
  42. for name, player in pairs(tfm.get.room.playerList) do
  43. system.bindKeyboard(name, DOWN1, true)
  44. system.bindKeyboard(name, DOWN2, true)
  45. system.bindKeyboard(name, DOWN4, true)
  46. system.bindKeyboard(name, DOWN3, true)
  47. system.bindKeyboard(name, DOWN0, true)
  48. end
  49.  
  50. function eventKeyboard(name, keyCode, down, x, y)
  51. if keyCode == DOWN1 or keyCode == DOWN2 then
  52. tfm.exec.explosion(x, y + 20, 10, 60, true) -- spark(?) explosion
  53. tfm.exec.displayParticle(tfm.enum.particle.spirit, x, y + 30) -- spark(?) spirit particle
  54. elseif keyCode == DOWN3 or keyCode == DOWN4 or keyCode == DOWN0 then
  55. tfm.exec.explosion(x, y - 20, 10, 60, true) -- spark(?) explosion
  56. tfm.exec.displayParticle(tfm.enum.particle.spirit, x, y - 30) -- spark(?) spirit particle
  57. end
  58. end
  59.  
  60. for name,player in pairs(tfm.get.room.playerList) do
  61. system.bindMouse(name)
  62. end
  63.  
  64. function pythag(x1,y1,x2,y2)
  65. return math.sqrt((y2-y1)^2+(x2-x1)^2)
  66. end
  67.  
  68. function eventMouse(n,x,y)
  69. for n,p in pairs(tfm.get.room.playerList) do
  70. if pythag(x,y,p.x,p.y) <= 15 then
  71. tfm.exec.movePlayer(n,100,100,true,0,50,false)
  72. tfm.exec.addShamanObject(27,x,tfm.get.room.playerList,45,50,-20,false)
  73. end
  74. end
  75. end
  76.  
  77. ui.addTextArea(1,"<a href='event:example' align='center'><font size='11' color='#FF0000'><p'>Vampire</a>",nil,5,175,70,20,0x000001,0x000001,1,true)
  78. ui.addTextArea(2,"<a href='event:p' align='center'><font size='11' color='#00FF57'><p'>Help</a>",nil,5,195,70,20,0x000001,0x000001,1,true)
  79. ui.addTextArea(4,"<a href='event:4' align='center'><font size='11' color='#00FF57'><p'>Credits</a>",nil,5,215,70,20,0x000001,0x000001,1,true)
  80. ui.addTextArea(30,"<a href='event:99' align='center'><font size='11' color='#00FF57'><p'>Commands</a>",nil,5,235,70,20,0x000001,0x000001,1,true)
  81. ui.addTextArea(31,"<a href='event:59' align='center'><font size='11' color='#0000FF'><p'>Move Tabs</a>",nil,5,155,70,20,0x000001,0x000001,1,true)
  82. function eventTextAreaCallback(textAreaID, playerName, callback)
  83. if callback=="example" then
  84. tfm.exec.setVampirePlayer(playerName)
  85. elseif callback=="999" then
  86. ui.addTextArea(1000,"<a align='center'><font size='25' color='#00FF57'><p'> <a align='center'><font size='15' color='#0000FF'><p'> ",playerName,-500,-100,3000,3000,0x000001,0x000001,0.5,true)
  87. ui.addTextArea(7,"<a href='event:7' align='center'><font size='11' color='#00FF57'><p'>Close</a>",playerName,730,235,70,20,0x000001,0x000001,1,true)
  88. ui.addTextArea(3,"<a align='center'><font size='25' color='#00FF57'><p'> Commands <a align='center'><font size='20' color='#0000FF'><p'> <J>!maps - Shows the maps that are in the rotation of #Zerogravity. <V>",playerName,180,100,500,200,0x272727,0x000001,1,true)
  89. elseif callback=="44" then
  90. ui.addTextArea(1000,"<a align='center'><font size='25' color='#00FF57'><p'> <a align='center'><font size='15' color='#0000FF'><p'> ",playerName,-500,-100,3000,3000,0x000001,0x000001,0.5,true)
  91. ui.addTextArea(3,"<a align='center'><font size='25' color='#00FF57'><p'> Credits <a align='center'><font size='20' color='#0000FF'><p'> <J>Fuzzyfirsdog - Coding the minigame. <V>Tohpy - Working on BR translate. <VI> Bibsho - Gave ideas for the minigame. <T>Tortuegreen - Showed Fuzzyfirsdog how to use some coding stuff. <CH> Suprodo - Gave ideas for the minigame. <BV>Pinyxzyaj - Makes sure that there are no bugs. <R>Hidskills - Tests new updates and reports bugs.",playerName,180,100,500,260,0x272727,0x000001,1,true)
  92. ui.addTextArea(7,"<a href='event:7' align='center'><font size='11' color='#00FF57'><p'>Close</a>",playerName,730,215,70,20,0x000001,0x000001,1,true)
  93. elseif callback=="p0" then
  94. ui.addTextArea(1000,"<a align='center'><font size='25' color='#00FF57'><p'> <a align='center'><font size='15' color='#0000FF'><p'> ",playerName,-500,-100,3000,3000,0x000001,0x000001,0.5,true)
  95. ui.addTextArea(3,"<a align='center'><font size='25' color='#00FF57'><p'> #Zerogravity <a align='center'><font size='15' color='#FFD000'><p'> The aim in #Zerogravity is to get through obstacles in no gravity maps. There are many easy maps, and at the same time, many hard maps! The creator of this minigame is Fuzzyfirsdog. In #Zerogravity, you can do some tricks, click next to see! ",playerName,180,100,500,190,0x272727,0x000001,1,true)
  96. ui.addTextArea(9,"<a href='event:9' align='center'><font size='11' color='#00FF57'><p'>Next</a>",playerName,300,265,70,20,0x000001,0x000001,1,true)
  97. ui.addTextArea(5,"<a href='event:5' align='center'><font size='11' color='#00FF57'><p'>Close</a>",playerName,730,195,70,20,0x000001,0x000001,1,true)
  98. elseif callback=="59" then
  99. ui.addTextArea(1,"<a href='event:example' align='center'><font size='11' color='#FF0000'><p'>Vampire</a>",playerName,730,175,70,20,0x000001,0x000001,1,true)
  100. ui.addTextArea(2,"<a href='event:p0' align='center'><font size='11' color='#00FF57'><p'>Help</a>",playerName,730,195,70,20,0x000001,0x000001,1,true)
  101. ui.addTextArea(4,"<a href='event:44' align='center'><font size='11' color='#00FF57'><p'>Credits</a>",playerName,730,215,70,20,0x000001,0x000001,1,true)
  102. ui.addTextArea(30,"<a href='event:999' align='center'><font size='11' color='#00FF57'><p'>Commands</a>",playerName,730,235,70,20,0x000001,0x000001,1,true)
  103. ui.addTextArea(31,"<a href='event:69' align='center'><font size='11' color='#0000FF'><p'>Move Tabs</a>",playerName,730,155,70,20,0x000001,0x000001,1,true)
  104. elseif callback=="69" then
  105. ui.addTextArea(1,"<a href='event:example' align='center'><font size='11' color='#FF0000'><p'>Vampire</a>",playerName,5,175,70,20,0x000001,0x000001,1,true)
  106. ui.addTextArea(2,"<a href='event:p' align='center'><font size='11' color='#00FF57'><p'>Help</a>",playerName,5,195,70,20,0x000001,0x000001,1,true)
  107. ui.addTextArea(4,"<a href='event:4' align='center'><font size='11' color='#00FF57'><p'>Credits</a>",playerName,5,215,70,20,0x000001,0x000001,1,true)
  108. ui.addTextArea(30,"<a href='event:99' align='center'><font size='11' color='#00FF57'><p'>Commands</a>",playerName,5,235,70,20,0x000001,0x000001,1,true)
  109. ui.addTextArea(31,"<a href='event:59' align='center'><font size='11' color='#0000FF'><p'>Move Tabs</a>",playerName,5,155,70,20,0x000001,0x000001,1,true)
  110.  
  111. elseif callback=="99" then
  112. ui.addTextArea(1000,"<a align='center'><font size='25' color='#00FF57'><p'> <a align='center'><font size='15' color='#0000FF'><p'> ",playerName,-500,-100,3000,3000,0x000001,0x000001,0.5,true)
  113. ui.addTextArea(7,"<a href='event:7' align='center'><font size='11' color='#00FF57'><p'>Close</a>",playerName,5,235,70,20,0x000001,0x000001,1,true)
  114. ui.addTextArea(3,"<a align='center'><font size='25' color='#00FF57'><p'> Commands <a align='center'><font size='20' color='#0000FF'><p'> <J>!maps - Shows the maps that are in the rotation of #Zerogravity. !help - Gives you some of the help and then gives you a larger Help button to draw your attention.<V>",playerName,180,100,500,200,0x272727,0x000001,1,true)
  115. elseif callback=="4" then
  116. ui.addTextArea(1000,"<a align='center'><font size='25' color='#00FF57'><p'> <a align='center'><font size='15' color='#0000FF'><p'> ",playerName,-500,-100,3000,3000,0x000001,0x000001,0.5,true)
  117. ui.addTextArea(3,"<a align='center'><font size='25' color='#00FF57'><p'> Credits <a align='center'><font size='20' color='#0000FF'><p'> <J>Fuzzyfirsdog - Coding the minigame. <V>Tohpy - Working on BR translate. <VI> Bibsho - Gave ideas for the minigame. <T>Tortuegreen - Showed Fuzzyfirsdog how to use some coding stuff. <CH> Suprodo - Gave ideas for the minigame. <BV>Pinyxzyaj - Makes sure that there are no bugs. <R>Hidskills - Tests new updates and reports bugs.",playerName,180,100,500,260,0x272727,0x000001,1,true)
  118. ui.addTextArea(7,"<a href='event:7' align='center'><font size='11' color='#00FF57'><p'>Close</a>",playerName,5,215,70,20,0x000001,0x000001,1,true)
  119. elseif callback=="p" then
  120. ui.addTextArea(1000,"<a align='center'><font size='25' color='#00FF57'><p'> <a align='center'><font size='15' color='#0000FF'><p'> ",playerName,-500,-100,3000,3000,0x000001,0x000001,0.5,true)
  121. ui.addTextArea(3,"<a align='center'><font size='25' color='#00FF57'><p'> #Zerogravity <a align='center'><font size='15' color='#FFD000'><p'> The aim in #Zerogravity is to get through obstacles in no gravity maps. There are many easy maps, and at the same time, many hard maps! The creator of this minigame is Fuzzyfirsdog. In #Zerogravity, you can do some tricks, click next to see! ",playerName,180,100,500,190,0x272727,0x000001,1,true)
  122. ui.addTextArea(9,"<a href='event:9' align='center'><font size='11' color='#00FF57'><p'>Next</a>",playerName,300,265,70,20,0x000001,0x000001,1,true)
  123. ui.addTextArea(5,"<a href='event:5' align='center'><font size='11' color='#00FF57'><p'>Close</a>",playerName,5,195,70,20,0x000001,0x000001,1,true)
  124. elseif callback=="9" then
  125. ui.addTextArea(3,"<a align='center'><font size='25' color='#00FF57'><p'> #Zerogravity <a align='center'><font size='15' color='#FFD000'><p'> There are some things that you have the ability to do, for example, you can duck to spawn a spirit. You can also click Vampire to become a Vampire. Clicking O spawns a spark on top of you, rather than under you.",playerName,180,100,500,190,0x272727,0x000001,1,true)
  126. ui.addTextArea(9,"<a href='event:88' align='center'><font size='11' color='#00FF57'><p'>Back</a>",playerName,300,265,60,20,0x000001,0x000001,1,true)
  127. elseif callback=="88" then
  128. ui.addTextArea(3,"<a align='center'><font size='25' color='#00FF57'><p'> #Zerogravity <a align='center'><font size='15' color='#FFD000'><p'> The aim in #Zerogravity is to get through obstacles in no gravity maps. There are many easy maps, and at the same time, many hard maps! The creator of this minigame is Fuzzyfirsdog. In #Zerogravity, you can do some tricks, click next to see! ",playerName,180,100,500,190,0x272727,0x000001,1,true)
  129. ui.addTextArea(9,"<a href='event:9' align='center'><font size='11' color='#00FF57'><p'>Next</a>",playerName,300,265,60,20,0x000001,0x000001,1,true)
  130. elseif callback=="5" or callback=="7" then
  131. ui.removeTextArea(5,playerName)
  132. ui.removeTextArea(3,playerName)
  133.  
  134. ui.removeTextArea(200,playerName)
  135. ui.removeTextArea(7,playerName)
  136. ui.removeTextArea(9,playerName)
  137. ui.removeTextArea(1000,playerName)
  138. end
  139. end
  140.  
  141.  
  142.  
  143. function eventNewGame()
  144. o=tfm.get.room.xmlMapInfo.mapCode
  145. a=tfm.get.room.xmlMapInfo.author
  146. m=tfm.get.room.currentMap.id
  147. tfm.exec.setUIMapName("<VP>@"..o.." - Creator: "..a)
  148. if m=="6946086" then
  149. tfm.exec.setUIMapName("<VP>@"..o.." - Level 1 - Creator: "..a)
  150. end
  151. end
  152.  
  153. tfm.exec.chatMessage("<ROSE>")
  154.  
  155. function eventPlayerDied(name)
  156. tfm.exec.respawnPlayer(name)
  157. end
  158.  
  159. system.disableChatCommandDisplay("help",true)
  160. system.disableChatCommandDisplay("maps",true)
  161. system.disableChatCommandDisplay("x",true)
  162. function eventChatCommand(m,n)
  163. if n=="maps" then
  164. tfm.exec.chatMessage("["..#maps.." Maps]<J> MAPS: <VP>6946086, 6354056, 6373101, 6947670, 6973435",m)
  165. elseif n=="help" then
  166. tfm.exec.chatMessage("<J>The aim in #Zerogravity is to get through obstacles in no gravity maps. There are many easy maps, and at the same time, many hard maps! The creator of this minigame is Fuzzyfirsdog. Click the large help button to see more info.",m)
  167. ui.addTextArea(200,"<a href='event:p' align='center'><font size='130' color='#00FF57'><p'> Help</a>",m,250,-5,600,600,0x000001,0xFFE300,0,true)
  168. elseif n=="x" then
  169. ui.removeTextArea(200)
  170. end
  171. end
  172.  
  173.  
  174. function eventNewPlayer(n)
  175. tfm.exec.respawnPlayer(n)
  176. system.bindKeyboard(n, DOWN1, true)
  177. system.bindKeyboard(n, DOWN2, true)
  178. system.bindKeyboard(n, DOWN4, true)
  179. system.bindKeyboard(n, DOWN3, true)
  180. ui.addTextArea(1,"<a href='event:example' align='center'><font size='11' color='#FF0000'><p'>Vampire</a>",n,5,175,70,20,0x000001,0x000001,1,true)
  181. ui.addTextArea(2,"<a href='event:p' align='center'><font size='11' color='#00FF57'><p'>Help</a>",n,5,195,70,20,0x000001,0x000001,1,true)
  182. ui.addTextArea(4,"<a href='event:4' align='center'><font size='11' color='#00FF57'><p'>Credits</a>",n,5,215,70,20,0x000001,0x000001,1,true)
  183. ui.addTextArea(31,"<a href='event:59' align='center'><font size='11' color='#0000FF'><p'>Move Tabs</a>",playerName,5,155,70,20,0x000001,0x000001,1,true)
  184. ui.addTextArea(30,"<a href='event:99' align='center'><font size='11' color='#00FF57'><p'>Commands</a>",nil,5,235,70,20,0x000001,0x000001,1,true)
  185. tfm.exec.setUIMapName("<VP>@"..o.." - Creator: "..a)
  186. end
  187.  
  188. tfm.exec.setGameTime(5)
  189. tfm.exec.setRoomMaxPlayers(7)
  190.  
  191. function eventNewGame()
  192. ui.removeTextArea (0) --Remove textarea when a new round begins
  193. ui.removeTextArea (992)
  194. mouseWon = false
  195. o=tfm.get.room.xmlMapInfo.mapCode
  196. a=tfm.get.room.xmlMapInfo.author
  197. m=tfm.get.room.currentMap.id
  198. tfm.exec.setUIMapName("<J>@"..o.."<VP> - Creator: "..a)
  199. if m=="6946086" then
  200. tfm.exec.setUIMapName("<VP>@"..o.." - Level 1 - Creator: "..a)
  201. tfm.exec.chatMessage("<ROSE>[MAP INFO] <CH>@"..o.."<> - Creator: <J>"..a,name)
  202. end
  203. end
  204.  
  205. function eventPlayerWon(name)
  206. if not mouseWon then --This'll trigger only when the first mouse gets in the hole
  207. ui.addTextArea (992,"<a align='center'><font size='95' color='#E9D504'><a'> ",nil,-400,-405,9000,9000,0x000001,0x000001,0.4,true)
  208. ui.addTextArea (0,"<a align='center'><font size='90' color='#E9D504'><a'>Cheeeeeese *-* "..name.."! ",nil,65,85,790,1000,0x000001,0x000001,0,true)
  209. mouseWon = true
  210. tfm.exec.setGameTime(5)
  211. tfm.exec.chatMessage("<VP>You just completed the level!",name)
  212. tfm.exec.chatMessage("<VP>Your score: "..tfm.get.room.playerList[name].score,name)
  213. end
  214. end
  215.  
  216. tfm.exec.chatMessage("<J>The aim in #Zerogravity is to get through obstacles in no gravity maps. There are many easy maps, and at the same time, many hard maps! The creator of this minigame is Fuzzyfirsdog. Click the large help button to see more info.")
  217.  
  218. serialization = function(x)
  219. if type(x) == "table" then
  220. local t = x
  221. local str = ""
  222. for index,value in next,t do
  223. local prefix,tbOption = (type(value)=="string" and "_@" or type(value)=="boolean" and "_!" or type(value)=="number" and "_#" or type(value)=="table" and "_%" or ""),(type(value)~="table" and tostring(value) or "+&"..serialization(value):gsub(";","?").."&-")
  224. str = str .. ':' .. tostring(index) .. prefix .. tbOption .. ";"
  225. end
  226. return str
  227. elseif type(x) == "string" then
  228. local s = x
  229. local list = {}
  230. for str in s:gmatch("(.-);") do
  231. local varName,valueType,value = str:match(':(.-)_(%p)(.+)')
  232. if varName~=nil then
  233. varName = tonumber(varName) or varName
  234. if valueType == "@" then
  235. list[varName] = tostring(value)
  236. elseif valueType == "!" then
  237. list[varName] = value=="true"
  238. elseif valueType == "#" then
  239. list[varName] = tonumber(value)
  240. elseif valueType == "%" then
  241. list[varName] = serialization(value:gsub("+&",""):gsub("&-",""):gsub("%?",";"))
  242. end
  243. end
  244. end
  245. return list
  246. end
  247. end
  248.  
  249. info = {}
  250.  
  251. eventNewPlayer = function(name)
  252. info[n] = { -- Creates a table for the player
  253. victories = 0,
  254. }
  255. system.loadPlayerData(name)
  256. end
  257. table.foreach(tfm.get.room.playerList,eventNewPlayer)
  258.  
  259. eventPlayerWon = function(name)
  260. info[name].victories = info[name].victories + 1
  261. system.savePlayerData(name,serialization(info[name]))
  262. end
  263.  
  264. eventPlayerDataLoaded = function(name,data)
  265. if data:find("victories") then
  266. info[name] = serialization(data)
  267. else
  268. system.savePlayerData(name,serialization(info[name]))
  269. end
  270. end
Advertisement
Add Comment
Please, Sign In to add comment