Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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>'
- tempo = os.time();
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- vivos=0
- wons=0
- _time = 0;
- p={}
- data={}
- piso = {
- type=12,
- color=math.random(0,0xFFFFFF),
- linearDamping=1,
- angularDamping=1,
- dynamic=true,
- fixedRotation=true,
- width=math.random(20,100),
- groundCollision = false
- }
- function eventNewPlayer(name)
- tfm.exec.bindKeyboard(name,32,true,true)
- tfm.exec.chatMessage("<VP>Bem-vindo ao Sky run alpha 1.5</VP>",name)
- tfm.exec.chatMessage("<ROSE>[~Update] Fundos aleatórios, obstaculos mais difíceis, sistema de recorde, perfil.</ROSE>",name)
- 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)
- tfm.exec.chatMessage("<J>Criado por Contistente.</J>",name)
- eventChatCommand(name,'help')
- p[name]={
- rounds=0,
- wins=0,
- pm=0,
- kills=0,
- new_record=0,
- old_record=0,
- }
- for i,v in pairs(data) do
- if v[1] == name then
- p[name] = v[2]
- end
- end
- table.insert(data,{name, p[name]})
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 32 and time >= 3000 then
- if y < 55 then
- tfm.exec.giveCheese(name)
- tfm.exec.playerVictory(name)
- end
- tfm.exec.movePlayer(name,0,0,false,0,-math.random(30,50),true)
- end
- end
- function split(t,s)
- local a={}
- for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
- table.insert(a,i)
- end
- return a
- end
- function eventChatCommand(name, cmd)
- local arg = split(cmd, " ")
- if arg[1] == "help" then
- ui.addTextArea(3,"",name,300,45,200,300,nil,0x324650,nil,true)
- ui.addTextArea(4,'<B><J><font size="13"><p align="center">Central de ajuda',name,295,40,210,30,nil,0x2e424d,nil,true)
- 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)
- 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)
- end
- if arg[1] == "p" then
- if arg[2] then
- nome = arg[2]:lower():gsub('%a', string.upper, 1) -- guarda na variavel
- else
- nome = name
- end
- if tfm.get.room.playerList[nome] then
- ui.addTextArea(0,"",name,250,45,300,300,nil,0x324650,nil,true)
- ui.addTextArea(1,'<B><J><font size="13"><p align="center">'..nome,name,245,40,310,30,nil,0x2e424d,nil,true)
- 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)
- 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)
- else
- tfm.exec.chatMessage("<R>"..nome.." não se encostra em sala.</R>",name)
- end
- end
- if arg[1] == "rank" then
- eventRanking(name)
- end
- end
- function scoreBoard()
- local sc = {}
- for name, player in pairs(tfm.get.room.playerList) do
- sc[#sc+1] = {n=name,s=player.score,pm=p[name].pm}
- end
- table.sort(sc,function(a,b) return a.pm>b.pm end)
- str = ''
- for k,v in pairs(sc) do
- if k < 19 then
- if str ~= '' then
- str=str.."<br><J>"..k.."°</J> | <VP>"..v.n.."</VP> | <R>"..v.pm.."</R>"
- else
- str="<J>"..k.."°</J> | <VP>"..v.n.."</VP> | <R>"..v.pm.."</R>"
- end
- end
- end
- ui.addTextArea(0,"",name,250,45,300,300,nil,0x324650,nil,true)
- ui.addTextArea(1,'<B><J><font size="13"><p align="center">Score Board',name,245,40,310,30,nil,0x2e424d,nil,true)
- ui.addTextArea(2,"<B><font size='12'>"..str,name,255,85,290,255,0x0e232b,0x0e232b,nil,true)
- return str
- end
- function eventRanking(name)
- local sc = {}
- for name, player in pairs(tfm.get.room.playerList) do
- sc[#sc+1] = {n=name,s=player.score,w=p[name].wins,pm=p[name].pm}
- end
- table.sort(sc,function(a,b) return a.w>b.w end)
- str = ''
- for k,v in pairs(sc) do
- if k < 15 then
- if str ~= '' then
- str=str.."<br><J>"..k.."°</J> | <VP>"..v.n.."</VP> | <CE>"..v.w.."</CE> | <R>"..v.pm.."</R>"
- else
- str="<br><J>"..k.."°</J> | <VP>"..v.n.."</VP> | <CE>"..v.w.."</CE> | <R>"..v.pm.."</R>"
- end
- end
- end
- ui.addTextArea(0,"",name,250,45,300,300,nil,0x324650,nil,true)
- ui.addTextArea(1,'<B><J><font size="13"><p align="center">Ranking',name,245,40,310,30,nil,0x2e424d,nil,true)
- ui.addTextArea(2,"<B><font size='12'>"..str,name,255,85,290,220,0x0e232b,0x0e232b,nil,true)
- 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)
- return str
- end
- function eventTextAreaCallback(id,name,link)
- if link == "close" then
- for id=-1,6 do
- ui.removeTextArea(id,name)
- ui.removeTextArea(6969+id,name)
- ui.removeTextArea(7979+id,name)
- end
- end
- end
- function eventPlayerWon(name)
- if wons < 5 then
- wons=wons+1;
- tfm.exec.chatMessage("<V>"..name.."</V> venceu em <J>"..wons.."°</J> lugar.")
- p[name].wins=p[name].wins+1;
- else
- for i,v in pairs(tfm.get.room.playerList) do
- if v.score < 1 then
- p[name].kills = p[name].kills+1;
- end
- end
- end
- if _time < p[name].new_record then
- p[name].old_record = p[name].new_record
- p[name].new_record = _time
- elseif p[name].new_record == 0 then
- p[name].new_record = _time
- end
- vivos=vivos-1;
- if vivos < 4 and tr > 40000 then
- tfm.exec.setGameTime(40)
- end
- if vivos == 0 then
- tfm.exec.setGameTime(12)
- end
- for i,v in pairs(tfm.get.room.playerList) do
- if name == i then
- p[i].pm = p[i].pm+v.score
- end
- end
- end
- function eventLoop(t,r)
- time = t
- tr = r
- if t > 3000 then
- _time = _time+0.1;
- ui.addTextArea(7,"<B><font size='12'><VP>".._time.."s",nil,6,378,nil,20,0,0,0,true)
- end
- if t > 3000 and t < 3500 then
- tfm.exec.chatMessage("<VP>Voe apertando espaço até as estrelas e vença a Sky run.</VP>")
- end
- if tempo < os.time()-600 then
- piso.dynamic=true
- for i=1,18 do
- type = math.random(18)
- if type >= 5 then
- piso.restitution = math.random(0.1,1.2)
- piso.friction = math.random(0.1,1.2)
- piso.color=math.random(0,0xFFFFFF)
- piso.width=math.random(20,100)
- tfm.exec.addPhysicObject(tempo, math.random(200,600), 25, piso)
- else
- tfm.exec.addShamanObject(math.random(0,22), math.random(200,600), 25, 180, 0, math.random(0,10), false)
- end
- end
- tempo = os.time();
- end
- if r < 12000 and r > 10000 then
- scoreBoard();
- end
- if r < 1000 then
- tfm.exec.newGame(xml)
- end
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- function eventPlayerDied(name)
- vivos=vivos-1;
- if vivos == 0 then
- tfm.exec.setGameTime(12)
- end
- if vivos < 4 and tr > 40000 then
- tfm.exec.setGameTime(40)
- end
- end
- function eventNewGame()
- vivos=0
- wons=0
- piso.restitution = 0
- piso.friction = 0
- piso.dynamic = false
- piso.width = 1600
- piso.color = 0x6a7495
- tfm.exec.addPhysicObject(os.time(), 5, 15, piso)
- for name in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(name,0,false)
- vivos=vivos+1;
- p[name].rounds = p[name].rounds+1;
- end
- tfm.exec.setGameTime(200)
- for id=-1,2 do
- ui.removeTextArea(id,nil)
- ui.removeTextArea(6969+id,nil)
- ui.removeTextArea(7979+id,nil)
- end
- _time = 0;
- 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>'
- end
- tfm.exec.newGame(xml)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement