Advertisement
Dudugz-Contistente

Untitled

Dec 11th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 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="400" Y="4000" X="401" 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. piso = {
  12. type=12,
  13. color=math.random(0,0xFFFFFF),
  14. linearDamping=1,
  15. angularDamping=1,
  16. dynamic=true,
  17. fixedRotation=true,
  18. width=math.random(20,100),
  19. groundCollision = false
  20. }
  21.  
  22. function eventNewPlayer(name)
  23. tfm.exec.bindKeyboard(name,32,true)
  24. tfm.exec.chatMessage("<VP>Bem-vindo ao skyrun(Corrida no ceú).</VP>",name)
  25. tfm.exec.chatMessage("<J>Criado por Contistente.</J>",name)
  26. end
  27.  
  28. function eventKeyboard(name, key, down, x, y)
  29. if key == 32 and not tfm.get.room.playerList[name].isDead and time >= 3000 then
  30. tfm.exec.movePlayer(name,0,0,false,0,-20,true)
  31. end
  32.  
  33. if tfm.get.room.playerList[name].y < 45 then
  34. tfm.exec.giveCheese(name)
  35. tfm.exec.playerVictory(name)
  36. end
  37.  
  38. ui.addTextArea(0,"<B><VP>"..tfm.get.room.playerList[name].y.."m",name,6,25,nil,20,0,0,0,true)
  39. end
  40.  
  41.  
  42. function split(t,s)
  43. local a={}
  44. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  45. table.insert(a,i)
  46. end
  47. return a
  48. end
  49.  
  50. function eventChatCommand(p, cmd)
  51. local arg = split(cmd, " ")
  52.  
  53. if arg[1] == "mylook" then
  54. tfm.exec.chatMessage('<R><B>Seu visual: '..tfm.get.room.playerList[p].look..'</B></R>',p)
  55. end
  56. end
  57.  
  58. function scoreBoard()
  59. local sc = {}
  60. for name, player in pairs(tfm.get.room.playerList) do
  61. sc[#sc+1] = {n=name,s=player.score}
  62. end
  63. table.sort(sc,function(a,b) return a.s>b.s end)
  64.  
  65. str = ''
  66. for k,v in pairs(sc) do
  67. if k < 11 then
  68. if str ~= '' then
  69. str=str.."<br><J>"..k.."°</J> - <VP>"..v.n.."</VP>"
  70. else
  71. str="<J>"..k.."°</J> - <VP>"..v.n.."</VP>"
  72. end
  73. end
  74. end
  75.  
  76. ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
  77. ui.addTextArea(1,'<B><J><font size="13"><p align="center">Score Board',name,295,40,210,30,nil,0x2e424d,nil,true)
  78. ui.addTextArea(2,"<B><font size='12'>"..str,name,305,85,190,255,0x0e232b,0x0e232b,nil,true)
  79. return str
  80. end
  81.  
  82. function eventPlayerWon(name)
  83. if wons < 3 then
  84. wons=wons+1;
  85. end
  86.  
  87.  
  88. tfm.exec.chatMessage("<V>"..name.."</V> venceu em <J>"..wons.."°</J> lugar.")
  89. vivos=vivos-1;
  90.  
  91. if vivos == 0 then
  92. tfm.exec.setGameTime(15)
  93. end
  94. end
  95.  
  96. function eventLoop(t,r)
  97. time = t
  98.  
  99. if t > 3000 and t < 3500 then
  100. tfm.exec.chatMessage("<VP>Vooe apertando espaço até as estrelas e vença o skyrun(Corrida no ceú).</VP>")
  101. end
  102.  
  103. if tempo < os.time()-1000 then
  104. piso.dynamic=true
  105.  
  106. for i=1,3 do
  107. tempo = os.time();
  108. piso.color=math.random(0,0xFFFFFF)
  109. piso.width=math.random(20,100)
  110. tfm.exec.addPhysicObject(tempo, math.random(200,400), 25, piso)
  111. end
  112. end
  113.  
  114. if r < 15000 and r > 14000 then
  115. scoreBoard();
  116. end
  117.  
  118. if r < 1000 then
  119. tfm.exec.newGame(mapas[math.random(#mapas)])
  120. end
  121. end
  122.  
  123. for all in pairs(tfm.get.room.playerList) do
  124. eventNewPlayer(all)
  125. end
  126.  
  127. function eventPlayerDied(name)
  128. vivos=vivos-1;
  129.  
  130. if vivos == 0 then
  131. tfm.exec.setGameTime(15)
  132. end
  133. end
  134.  
  135. function eventNewGame()
  136. vivos=0
  137. wons=0
  138. piso.dynamic = false
  139. piso.width = 1600
  140. piso.color = 0x6a7495
  141. tfm.exec.addPhysicObject(os.time(), 5, 15, piso)
  142. for name in pairs(tfm.get.room.playerList) do
  143. ui.addTextArea(0,"<B><VP>"..tfm.get.room.playerList[name].y.."m",name,6,25,nil,20,0,0,0,true)
  144. tfm.exec.giveMeep(name)
  145. tfm.exec.setPlayerScore(name,0,false)
  146. vivos=vivos+1;
  147. end
  148.  
  149. tfm.exec.setGameTime(301)
  150.  
  151. for id=0,2 do
  152. ui.removeTextArea(id,nil)
  153. ui.removeTextArea(6969+id,nil)
  154. ui.removeTextArea(7979+id,nil)
  155. end
  156. end
  157.  
  158. tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement