Advertisement
Dudugz-Contistente

Untitled

Dec 11th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.34 KB | None | 0 0
  1. mapas = {'<C><P H="4000" Ca="" D="x_transformice/x_maps/x_nonoel_2014/x_cheminee.jpg,200,0" /><Z><S><S H="3000" o="6a7495" L="200" Y="1500" X="700" P="0,0,0,0,0,0,0,0" T="12" N="" /><S H="3000" o="6a7495" L="200" Y="3205" X="700" P="0,0,0,0,0,0,0,0" T="12" N="" /><S H="3000" o="6a7495" L="200" Y="1500" X="100" P="0,0,0,0,0,0,0,0" T="12" N="" /><S H="3000" o="6a7495" L="200" Y="3205" X="100" P="0,0,0,0,0,0,0,0" T="12" N="" /><S H="10" o="3b3b3b" L="401" Y="4000" c="3" X="400" P="0,0,0.3,0.2,0,0,0,0" T="12" /></S><D><T X="402" Y="3998" /></D><O /></Z></C>'}
  2. tempo = os.time();
  3.  
  4. tfm.exec.disableAutoNewGame(true)
  5. tfm.exec.disableAutoShaman(true)
  6. tfm.exec.disableAutoTimeLeft(true)
  7.  
  8. vivos=0
  9. wons=0
  10.  
  11. p={}
  12.  
  13. piso = {
  14. type=12,
  15. color=math.random(0,0xFFFFFF),
  16. linearDamping=1,
  17. angularDamping=1,
  18. dynamic=true,
  19. fixedRotation=true,
  20. width=math.random(20,100),
  21. groundCollision = false
  22. }
  23.  
  24. function eventNewPlayer(name)
  25. tfm.exec.bindKeyboard(name,32,true,true)
  26. tfm.exec.chatMessage("<VP>Bem-vindo ao Sky run alpha 0.5</VP>",name)
  27. tfm.exec.chatMessage("<J>Criado por Contistente.</J>",name)
  28. p[name]={
  29. wins=0
  30. }
  31. end
  32.  
  33. function eventKeyboard(name, key, down, x, y)
  34. if key == 32 and time >= 3000 then
  35. if y < 50 then
  36. tfm.exec.giveCheese(name)
  37. tfm.exec.playerVictory(name)
  38. end
  39.  
  40. tfm.exec.movePlayer(name,0,0,false,0,-math.random(20,25),true)
  41.  
  42. end
  43.  
  44. ui.addTextArea(3,"<B><VP>"..tfm.get.room.playerList[name].y.."m",name,6,25,nil,20,0,0,0,true)
  45. end
  46.  
  47.  
  48. function split(t,s)
  49. local a={}
  50. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  51. table.insert(a,i)
  52. end
  53. return a
  54. end
  55.  
  56. function eventChatCommand(p, cmd)
  57. local arg = split(cmd, " ")
  58.  
  59. if arg[1] == "rank" then
  60. eventRanking(p)
  61. end
  62. end
  63.  
  64. function scoreBoard()
  65. local sc = {}
  66. for name, player in pairs(tfm.get.room.playerList) do
  67. sc[#sc+1] = {n=name,s=player.score}
  68. end
  69. table.sort(sc,function(a,b) return a.s>b.s end)
  70.  
  71. str = ''
  72. for k,v in pairs(sc) do
  73. if k < 11 then
  74. if str ~= '' then
  75. str=str.."<br><J>"..k.."°</J> - <VP>"..v.n.."</VP>"
  76. else
  77. str="<J>"..k.."°</J> - <VP>"..v.n.."</VP>"
  78. end
  79. end
  80. end
  81.  
  82. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  83. ui.addTextArea(1,'<B><J><font size="13"><p align="center">Score Board',name,295,40,210,30,nil,0x2e424d,nil,true)
  84. ui.addTextArea(2,"<B><font size='12'>"..str,name,305,85,190,255,0x0e232b,0x0e232b,nil,true)
  85. return str
  86. end
  87.  
  88. function eventRanking(name)
  89. local sc = {}
  90. for name, player in pairs(tfm.get.room.playerList) do
  91. sc[#sc+1] = {n=name,s=player.score,w=p[name].wins}
  92. end
  93.  
  94. table.sort(sc,function(a,b) return a.s>b.s end)
  95. table.sort(sc,function(a,b) return a.w>b.w end)
  96.  
  97. str = ''
  98. for k,v in pairs(sc) do
  99. if k < 19 then
  100. if str ~= '' then
  101. str=str.."<br><J>"..k.."°</J> - <VP>"..v.n.."</VP>"
  102. else
  103. str="<J>"..k.."°</J> - <VP>"..v.n.."</VP>"
  104. end
  105. end
  106. end
  107.  
  108. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  109. ui.addTextArea(1,'<B><J><font size="13"><p align="center">Ranking',name,295,40,210,30,nil,0x2e424d,nil,true)
  110. ui.addTextArea(2,"<B><font size='12'>"..str,name,305,85,190,220,0x0e232b,0x0e232b,nil,true)
  111. ui.addTextArea(-1,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,305,320,190,20,0x3c5063,0x3c5063,nil,true)
  112. return str
  113. end
  114.  
  115. function eventTextAreaCallback(id,name,link)
  116. if link == "close" then
  117. for id=-1,2 do
  118. ui.removeTextArea(id,name)
  119. ui.removeTextArea(6969+id,name)
  120. ui.removeTextArea(7979+id,name)
  121. end
  122. end
  123. end
  124.  
  125. function eventPlayerWon(name)
  126. if wons < 3 then
  127. wons=wons+1;
  128. tfm.exec.chatMessage("<V>"..name.."</V> venceu em <J>"..wons.."°</J> lugar.")
  129. p[name].wins=p[name].wins+1;
  130. end
  131.  
  132. vivos=vivos-1;
  133.  
  134. if vivos == 0 then
  135. tfm.exec.setGameTime(15)
  136. end
  137. end
  138.  
  139. function eventLoop(t,r)
  140. time = t
  141. tr = r
  142.  
  143. if t > 3000 and t < 3500 then
  144. tfm.exec.chatMessage("<VP>Vooe apertando espaço até as estrelas e vença a Sky run.</VP>")
  145. end
  146.  
  147. if tempo < os.time()-700 then
  148. piso.dynamic=true
  149.  
  150. for i=1,5 do
  151. type = math.random(15)
  152. if type >= 2 then
  153. tempo = os.time();
  154. piso.color=math.random(0,0xFFFFFF)
  155. piso.width=math.random(20,100)
  156. tfm.exec.addPhysicObject(tempo, math.random(200,600), 25, piso)
  157. else
  158. tfm.exec.addShamanObject(17, math.random(200,600), 25, 180, 0, 0, false)
  159. end
  160. end
  161. end
  162.  
  163. if r < 15000 and r > 14000 then
  164. scoreBoard();
  165. end
  166.  
  167. if r < 1000 then
  168. tfm.exec.newGame(mapas[math.random(#mapas)])
  169. end
  170. end
  171.  
  172. for all in pairs(tfm.get.room.playerList) do
  173. eventNewPlayer(all)
  174. end
  175.  
  176. function eventPlayerDied(name)
  177. vivos=vivos-1;
  178.  
  179. if vivos == 0 then
  180. tfm.exec.setGameTime(15)
  181. end
  182.  
  183. if vivos < 4 and tr > 40000 then
  184. tfm.exec.setGameTime(40)
  185. end
  186. end
  187.  
  188. function eventNewGame()
  189. vivos=0
  190. wons=0
  191. piso.dynamic = false
  192. piso.width = 1600
  193. piso.color = 0x6a7495
  194. tfm.exec.addPhysicObject(os.time(), 5, 15, piso)
  195. for name in pairs(tfm.get.room.playerList) do
  196. ui.addTextArea(3,"<B><VP>"..tfm.get.room.playerList[name].y.."m",name,6,25,nil,20,0,0,0,true)
  197. tfm.exec.setPlayerScore(name,0,false)
  198. vivos=vivos+1;
  199. end
  200.  
  201. tfm.exec.setGameTime(301)
  202.  
  203. for id=0,2 do
  204. ui.removeTextArea(id,nil)
  205. ui.removeTextArea(6969+id,nil)
  206. ui.removeTextArea(7979+id,nil)
  207. end
  208. end
  209.  
  210. tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement