Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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>'}
- tempo = os.time();
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- vivos=0
- wons=0
- p={}
- 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 0.5</VP>",name)
- tfm.exec.chatMessage("<J>Criado por Contistente.</J>",name)
- p[name]={
- wins=0
- }
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 32 and time >= 3000 then
- if y < 50 then
- tfm.exec.giveCheese(name)
- tfm.exec.playerVictory(name)
- end
- tfm.exec.movePlayer(name,0,0,false,0,-math.random(20,25),true)
- end
- ui.addTextArea(3,"<B><VP>"..tfm.get.room.playerList[name].y.."m",name,6,25,nil,20,0,0,0,true)
- 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(p, cmd)
- local arg = split(cmd, " ")
- if arg[1] == "rank" then
- eventRanking(p)
- end
- end
- function scoreBoard()
- local sc = {}
- for name, player in pairs(tfm.get.room.playerList) do
- sc[#sc+1] = {n=name,s=player.score}
- end
- table.sort(sc,function(a,b) return a.s>b.s end)
- str = ''
- for k,v in pairs(sc) do
- if k < 11 then
- if str ~= '' then
- str=str.."<br><J>"..k.."°</J> - <VP>"..v.n.."</VP>"
- else
- str="<J>"..k.."°</J> - <VP>"..v.n.."</VP>"
- end
- end
- end
- ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
- ui.addTextArea(1,'<B><J><font size="13"><p align="center">Score Board',name,295,40,210,30,nil,0x2e424d,nil,true)
- ui.addTextArea(2,"<B><font size='12'>"..str,name,305,85,190,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}
- end
- table.sort(sc,function(a,b) return a.s>b.s end)
- table.sort(sc,function(a,b) return a.w>b.w 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>"
- else
- str="<J>"..k.."°</J> - <VP>"..v.n.."</VP>"
- end
- end
- end
- ui.addTextArea(0,"",name,300,45,200,300,nil,0x324650,nil,true)
- ui.addTextArea(1,'<B><J><font size="13"><p align="center">Ranking',name,295,40,210,30,nil,0x2e424d,nil,true)
- ui.addTextArea(2,"<B><font size='12'>"..str,name,305,85,190,220,0x0e232b,0x0e232b,nil,true)
- 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)
- return str
- end
- function eventTextAreaCallback(id,name,link)
- if link == "close" then
- for id=-1,2 do
- ui.removeTextArea(id,name)
- ui.removeTextArea(6969+id,name)
- ui.removeTextArea(7979+id,name)
- end
- end
- end
- function eventPlayerWon(name)
- if wons < 3 then
- wons=wons+1;
- tfm.exec.chatMessage("<V>"..name.."</V> venceu em <J>"..wons.."°</J> lugar.")
- p[name].wins=p[name].wins+1;
- end
- vivos=vivos-1;
- if vivos == 0 then
- tfm.exec.setGameTime(15)
- end
- end
- function eventLoop(t,r)
- time = t
- tr = r
- if t > 3000 and t < 3500 then
- tfm.exec.chatMessage("<VP>Vooe apertando espaço até as estrelas e vença a Sky run.</VP>")
- end
- if tempo < os.time()-700 then
- piso.dynamic=true
- for i=1,5 do
- type = math.random(15)
- if type >= 2 then
- tempo = os.time();
- 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(17, math.random(200,600), 25, 180, 0, 0, false)
- end
- end
- end
- if r < 15000 and r > 14000 then
- scoreBoard();
- end
- if r < 1000 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- 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(15)
- end
- if vivos < 4 and tr > 40000 then
- tfm.exec.setGameTime(40)
- end
- end
- function eventNewGame()
- vivos=0
- wons=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
- ui.addTextArea(3,"<B><VP>"..tfm.get.room.playerList[name].y.."m",name,6,25,nil,20,0,0,0,true)
- tfm.exec.setPlayerScore(name,0,false)
- vivos=vivos+1;
- end
- tfm.exec.setGameTime(301)
- for id=0,2 do
- ui.removeTextArea(id,nil)
- ui.removeTextArea(6969+id,nil)
- ui.removeTextArea(7979+id,nil)
- end
- end
- tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement