Advertisement
Dudugz-Contistente

Untitled

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