Advertisement
Dudugz-Contistente

Untitled

Dec 12th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.24 KB | None | 0 0
  1. xml='<C><P H="5000" Ca="" F="'..math.random(0,9)..'" /><Z><S><S H="4000" 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 X="400" o="212f36" L="400" Y="4689" c="3" H="10" P="0,0,0.3,0.2,0,0,0,0" T="12" /><S H="150" o="6a7495" L="1200" Y="4760" c="4" X="449" P="0,0,0,0,0,0,0,0" T="12" N="" /></S><D><T X="400" Y="4685" /></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. _time = 0;
  13.  
  14. p={}
  15. data={}
  16.  
  17. piso = {
  18. type=12,
  19. color=math.random(0,0xFFFFFF),
  20. linearDamping=1,
  21. angularDamping=1,
  22. dynamic=true,
  23. fixedRotation=true,
  24. width=math.random(20,100),
  25. groundCollision = false
  26. }
  27.  
  28. function eventNewPlayer(name)
  29. tfm.exec.bindKeyboard(name,32,true,true)
  30. tfm.exec.chatMessage("<VP>Bem-vindo ao Sky run alpha 1.5</VP>",name)
  31. tfm.exec.chatMessage("<ROSE>[~Update] Fundos aleatórios, obstaculos mais difíceis, sistema de recorde, perfil.</ROSE>",name)
  32. tfm.exec.chatMessage("<B><J>Comandos:</J></B><br>!p [nome] - abre o perfil de alguém e sem o nome abre o seu.<br>!rank - abre o ranking.<br>!help - abre a janela de ajuda.",name)
  33. tfm.exec.chatMessage("<J>Criado por Contistente.</J>",name)
  34. eventChatCommand(name,'help')
  35.  
  36. p[name]={
  37. rounds=0,
  38. wins=0,
  39. pm=0,
  40. kills=0,
  41. new_record=0,
  42. old_record=0,
  43. }
  44.  
  45. for i,v in pairs(data) do
  46. if v[1] == name then
  47. p[name] = v[2]
  48. end
  49. end
  50.  
  51. table.insert(data,{name, p[name]})
  52. end
  53.  
  54. function eventKeyboard(name, key, down, x, y)
  55. if key == 32 and time >= 3000 then
  56. if y < 55 then
  57. tfm.exec.giveCheese(name)
  58. tfm.exec.playerVictory(name)
  59. end
  60.  
  61. tfm.exec.movePlayer(name,0,0,false,0,-math.random(30,50),true)
  62.  
  63. end
  64. end
  65.  
  66.  
  67. function split(t,s)
  68. local a={}
  69. for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  70. table.insert(a,i)
  71. end
  72. return a
  73. end
  74.  
  75. function eventChatCommand(name, cmd)
  76. local arg = split(cmd, " ")
  77.  
  78. if arg[1] == "help" then
  79. ui.addTextArea(3,"",name,300,45,200,300,nil,0x324650,nil,true)
  80. ui.addTextArea(4,'<B><J><font size="13"><p align="center">Central de ajuda',name,295,40,210,30,nil,0x2e424d,nil,true)
  81. ui.addTextArea(5,"<B><font size='12'>Olá "..name..", o jogo é simplesmente uma Corrida pelos ceús, voe <font color='#00FF00'>apertando espaço</font> até o topo e seja um dos 5° vencedores do jogo<br>!rank - abre o ranking.",name,305,85,190,220,0x0e232b,0x0e232b,nil,true)
  82. ui.addTextArea(6,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,305,320,190,20,0x3c5063,0x3c5063,nil,true)
  83. end
  84.  
  85. if arg[1] == "p" then
  86. if arg[2] then
  87. nome = arg[2]:lower():gsub('%a', string.upper, 1) -- guarda na variavel
  88. else
  89. nome = name
  90. end
  91.  
  92. if tfm.get.room.playerList[nome] then
  93. ui.addTextArea(0,"",name,250,45,300,300,nil,0x324650,nil,true)
  94. ui.addTextArea(1,'<B><J><font size="13"><p align="center">'..nome,name,245,40,310,30,nil,0x2e424d,nil,true)
  95. ui.addTextArea(2,"<font size='12'>Tribo : <J>"..tfm.get.room.playerList[nome].tribeName.."</J><br>Comunidade : <V>"..tfm.get.room.playerList[nome].community.."</V><br><font size='15'>Rato</font><br><font color='#6a7495'> • Rodadas jogadas : </font> <V>"..p[nome].rounds.."</V><br><font color='#6a7495'> • Vitórias : </font> <V>"..p[nome].wins.."</V><br><font color='#6a7495'> • Derrotas : </font> <V>"..p[nome].kills.."</V><br><font color='#6a7495'> • Pontuação máxima : </font> <V>"..p[nome].pm.."</V><br><font color='#6a7495'> • Recorde : </font><br> <V>"..p[nome].new_record.."</V><BL>/</BL><J>"..p[nome].old_record.."</J>",name,255,85,290,220,0x0e232b,0x0e232b,nil,true)
  96. ui.addTextArea(-1,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,255,320,290,20,0x3c5063,0x3c5063,nil,true)
  97. else
  98. tfm.exec.chatMessage("<R>"..nome.." não se encostra em sala.</R>",name)
  99. end
  100. end
  101.  
  102. if arg[1] == "rank" then
  103. eventRanking(name)
  104. end
  105. end
  106.  
  107. function scoreBoard()
  108. local sc = {}
  109. for name, player in pairs(tfm.get.room.playerList) do
  110. sc[#sc+1] = {n=name,s=player.score,pm=p[name].pm}
  111. end
  112. table.sort(sc,function(a,b) return a.pm>b.pm end)
  113.  
  114. str = ''
  115. for k,v in pairs(sc) do
  116. if k < 19 then
  117. if str ~= '' then
  118. str=str.."<br><J>"..k.."°</J> | <VP>"..v.n.."</VP> | <R>"..v.pm.."</R>"
  119. else
  120. str="<J>"..k.."°</J> | <VP>"..v.n.."</VP> | <R>"..v.pm.."</R>"
  121. end
  122. end
  123. end
  124.  
  125. ui.addTextArea(0,"",name,250,45,300,300,nil,0x324650,nil,true)
  126. ui.addTextArea(1,'<B><J><font size="13"><p align="center">Score Board',name,245,40,310,30,nil,0x2e424d,nil,true)
  127. ui.addTextArea(2,"<B><font size='12'>"..str,name,255,85,290,255,0x0e232b,0x0e232b,nil,true)
  128. return str
  129. end
  130.  
  131. function eventRanking(name)
  132. local sc = {}
  133. for name, player in pairs(tfm.get.room.playerList) do
  134. sc[#sc+1] = {n=name,s=player.score,w=p[name].wins,pm=p[name].pm}
  135. end
  136.  
  137. table.sort(sc,function(a,b) return a.w>b.w end)
  138.  
  139. str = ''
  140. for k,v in pairs(sc) do
  141. if k < 15 then
  142. if str ~= '' then
  143. str=str.."<br><J>"..k.."°</J> | <VP>"..v.n.."</VP> | <CE>"..v.w.."</CE> | <R>"..v.pm.."</R>"
  144. else
  145. str="<br><J>"..k.."°</J> | <VP>"..v.n.."</VP> | <CE>"..v.w.."</CE> | <R>"..v.pm.."</R>"
  146. end
  147. end
  148. end
  149.  
  150. ui.addTextArea(0,"",name,250,45,300,300,nil,0x324650,nil,true)
  151. ui.addTextArea(1,'<B><J><font size="13"><p align="center">Ranking',name,245,40,310,30,nil,0x2e424d,nil,true)
  152. ui.addTextArea(2,"<B><font size='12'>"..str,name,255,85,290,220,0x0e232b,0x0e232b,nil,true)
  153. ui.addTextArea(-1,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,255,320,290,20,0x3c5063,0x3c5063,nil,true)
  154. return str
  155. end
  156.  
  157. function eventTextAreaCallback(id,name,link)
  158. if link == "close" then
  159. for id=-1,6 do
  160. ui.removeTextArea(id,name)
  161. ui.removeTextArea(6969+id,name)
  162. ui.removeTextArea(7979+id,name)
  163. end
  164. end
  165. end
  166.  
  167. function eventPlayerWon(name)
  168. if wons < 5 then
  169. wons=wons+1;
  170. tfm.exec.chatMessage("<V>"..name.."</V> venceu em <J>"..wons.."°</J> lugar.")
  171. p[name].wins=p[name].wins+1;
  172. else
  173. for i,v in pairs(tfm.get.room.playerList) do
  174. if v.score < 1 then
  175. p[name].kills = p[name].kills+1;
  176. end
  177. end
  178. end
  179.  
  180. if _time < p[name].new_record then
  181. p[name].old_record = p[name].new_record
  182. p[name].new_record = _time
  183. elseif p[name].new_record == 0 then
  184. p[name].new_record = _time
  185. end
  186.  
  187. vivos=vivos-1;
  188.  
  189. if vivos < 4 and tr > 40000 then
  190. tfm.exec.setGameTime(40)
  191. end
  192.  
  193. if vivos == 0 then
  194. tfm.exec.setGameTime(12)
  195. end
  196.  
  197. for i,v in pairs(tfm.get.room.playerList) do
  198. if name == i then
  199. p[i].pm = p[i].pm+v.score
  200. end
  201. end
  202. end
  203.  
  204. function eventLoop(t,r)
  205. time = t
  206. tr = r
  207.  
  208. if t > 3000 then
  209. _time = _time+0.1;
  210. ui.addTextArea(7,"<B><font size='12'><VP>".._time.."s",nil,6,378,nil,20,0,0,0,true)
  211. end
  212.  
  213. if t > 3000 and t < 3500 then
  214. tfm.exec.chatMessage("<VP>Voe apertando espaço até as estrelas e vença a Sky run.</VP>")
  215. end
  216.  
  217. if tempo < os.time()-600 then
  218. piso.dynamic=true
  219.  
  220. for i=1,18 do
  221. type = math.random(18)
  222. if type >= 5 then
  223. piso.restitution = math.random(0.1,1.2)
  224. piso.friction = math.random(0.1,1.2)
  225. piso.color=math.random(0,0xFFFFFF)
  226. piso.width=math.random(20,100)
  227. tfm.exec.addPhysicObject(tempo, math.random(200,600), 25, piso)
  228. else
  229. tfm.exec.addShamanObject(math.random(0,22), math.random(200,600), 25, 180, 0, math.random(0,10), false)
  230. end
  231. end
  232. tempo = os.time();
  233. end
  234.  
  235. if r < 12000 and r > 10000 then
  236. scoreBoard();
  237. end
  238.  
  239. if r < 1000 then
  240. tfm.exec.newGame(xml)
  241. end
  242. end
  243.  
  244. for all in pairs(tfm.get.room.playerList) do
  245. eventNewPlayer(all)
  246. end
  247.  
  248. function eventPlayerDied(name)
  249. vivos=vivos-1;
  250.  
  251. if vivos == 0 then
  252. tfm.exec.setGameTime(12)
  253. end
  254.  
  255. if vivos < 4 and tr > 40000 then
  256. tfm.exec.setGameTime(40)
  257. end
  258. end
  259.  
  260. function eventNewGame()
  261. vivos=0
  262. wons=0
  263. piso.restitution = 0
  264. piso.friction = 0
  265. piso.dynamic = false
  266. piso.width = 1600
  267. piso.color = 0x6a7495
  268. tfm.exec.addPhysicObject(os.time(), 5, 15, piso)
  269. for name in pairs(tfm.get.room.playerList) do
  270. tfm.exec.setPlayerScore(name,0,false)
  271. vivos=vivos+1;
  272. p[name].rounds = p[name].rounds+1;
  273. end
  274.  
  275. tfm.exec.setGameTime(200)
  276.  
  277. for id=-1,2 do
  278. ui.removeTextArea(id,nil)
  279. ui.removeTextArea(6969+id,nil)
  280. ui.removeTextArea(7979+id,nil)
  281. end
  282.  
  283. _time = 0;
  284.  
  285. xml='<C><P H="5000" Ca="" F="'..math.random(0,9)..'" /><Z><S><S H="4000" 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 X="400" o="212f36" L="400" Y="4689" c="3" H="10" P="0,0,0.3,0.2,0,0,0,0" T="12" /><S H="150" o="6a7495" L="1200" Y="4760" c="4" X="449" P="0,0,0,0,0,0,0,0" T="12" N="" /></S><D><T X="400" Y="4685" /></D><O /></Z></C>'
  286. end
  287.  
  288. tfm.exec.newGame(xml)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement