Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Squish Bird
- -- Tables
- -- Créditos:Brenower | Outros créditos você encontra pelo script. :D
- birds = {};
- player = "Ninguém";
- score = 0;
- tube = 0;
- time = 0;
- game = 0;
- bx = {};
- data = {};
- p = {};
- tx = 0;
- -- Functions
- function choosePlayer()
- local score = -1;
- local p = nil;
- for i,v in pairs(tfm.get.room.playerList) do
- if v.score > score and i ~= player then
- score = v.score;
- p = i;
- end
- end
- return p
- end
- function check(pla)
- for i,v in pairs(p) do
- if pla == v then
- return true
- end
- end
- end
- function bestScores(pl)
- for i = #p,1,-1 do
- table.remove(p,i)
- end
- local s = 0;
- for i,v in pairs(tfm.get.room.playerList) do
- if v.score > s and check(i) ~= true then
- score = v.score;
- table.insert(p,i)
- end
- end
- if p[1] then
- ui.addPopup(0,0,"<font size='12'>Melhores pontuações:<br /><br /><font color='#6C77C1'>"..p[#p].." <font color='#606090'>- <font color='#BABD2F'>"..data[p[#p]].score,pl,300,175,200,true)
- end
- if p[2] then
- ui.addPopup(0,0,"<font size='12'>Melhores pontuações:<br /><br /><font color='#6C77C1'>"..p[#p].." <font color='#606090'>- <font color='#BABD2F'>"..data[p[#p]].score.."<br /><font color='#6C77C1'>"..p[#p-1].." <font color='#606090'>- <font color='#BABD2F'>"..data[p[#p-1]].score.."",pl,300,175,200,true)
- end
- if p[3] then
- ui.addPopup(0,0,"<font size='12'>Melhores pontuações:<br /><br /><font color='#6C77C1'>"..p[#p].." <font color='#606090'>- <font color='#BABD2F'>"..data[p[#p]].score.."<br /><font color='#6C77C1'>"..p[#p-1].." <font color='#606090'>- <font color='#BABD2F'>"..data[p[#p-1]].score.."<br /><font color='#6C77C1'>"..p[#p-2].." <font color='#606090'>- <font color='#BABD2F'>"..data[p[#p-2]].score.."",pl,300,175,200,true)
- end
- end
- function moveTheTube()
- if tube == 1 then
- tx = tx + 5;
- if tx <= 80 then
- ui.addTextArea(1000,"",nil,350,300-tx,100,800,0xA0C654,0x000000,1)
- ui.addTextArea(2000,"",nil,350,-675+tx,100,800,0xA0C654,0x000000,1)
- elseif tx >= 80 then
- tube = 0;
- tx = 0;
- ui.addTextArea(1000,"",nil,350,300,100,800,0xA0C654,0x000000,1)
- ui.addTextArea(2000,"",nil,350,-675,100,800,0xA0C654,0x000000,1)
- end
- end
- end
- function givePoints()
- for i in pairs(birds) do
- if bx[i] >= 345 and bx[i] <= 445 then
- score = score + 1;
- data[player].score = data[player].score + 1;
- tfm.exec.setPlayerScore(player,data[player].score,false)
- bx[i] = 10;
- end
- end
- if score == 10 then
- score = 0;
- table.insert(birds,#birds+1)
- table.insert(bx,10)
- end
- end
- function hasTheBestScore()
- if data[player].score > data[p[#p]].score then
- local particle = math.random(0,2) -- Fogos de artificio por Stheblindd
- local x = math.random(0,800)
- local y = math.random(30,75)
- for i=0,2 do
- tfm.exec.displayParticle(particle,x,y,0.2F,0.2F,0.2F,0.2F,nil)
- tfm.exec.displayParticle(particle,x,y,-0.2F,-0.2F,-0.2F,-0.2F,nil)
- tfm.exec.displayParticle(particle,x,y,0F,0.2F,0F,0.2F,nil)
- tfm.exec.displayParticle(particle,x,y,0F,-0.2F,0F,-0.2F,nil)
- tfm.exec.displayParticle(particle,x,y,0.2F,0F,0.2F,0F,nil)
- tfm.exec.displayParticle(particle,x,y,-0.2F,0F,-0.2F,0F,nil)
- particle = math.random(0,2)
- end
- end
- end
- function f5MapName()
- local time = string.format("%.2d:%.2d",time/60%60, time%60) -- Tempo por Eshkation
- tfm.exec.setUIMapName("<n>Jogador : <j>"..player.." <bl>| <n>Pontos : <v>"..data[player].score.." <bl>| <n>Tempo :<v> "..time.."<p")
- end
- -- Novo jogador entra na sala
- function eventNewPlayer(p)
- if not data[p] then
- data[p] = {
- ["score"] = 0;
- };
- end
- system.bindMouse(p,true)
- end
- -- Inicio do script
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.newGame('<C><P Ca="" /><Z><S /><D><P X="800" P="0,1" C="bcd374" Y="-200" T="34" /><P X="0" P="0,0" C="4c7942" Y="200" T="34" /></D><O /></Z></C>')
- for i in pairs(tfm.get.room.playerList) do
- eventNewPlayer(i)
- end
- -- Loop
- function eventLoop(ct,rt)
- bestScores("A")
- time = time + 0.5;
- if p[1] then
- hasTheBestScore()
- end
- moveTheTube()
- if time >= 3 and game == 0 then
- f5MapName()
- tfm.exec.setGameTime(999)
- for i,v in pairs(birds) do
- bx[i] = bx[i] + math.random(-3,20);
- ui.addTextArea(v,"<R>B",nil,bx[i],200+math.random(-50,50),10,10,0xFBEA2B,1,0.6)
- if bx[i] >= 500 then
- game = 1;
- tfm.exec.setGameTime(10)
- tfm.exec.setUIMapName("<n>Jogador : <j>"..player.." <bl>| <n>Pontos :<v> "..data[player].score.." <bl>| <r>O "..player.." perdeu o jogo. :(")
- end
- end
- end
- if rt <= 0 then
- tfm.exec.newGame('<C><P Ca="" /><Z><S /><D><P X="800" P="0,1" C="bcd374" Y="-200" T="34" /><P X="0" P="0,0" C="4c7942" Y="200" T="34" /></D><O /></Z></C>')
- end
- end
- -- Novo jogo é iniciado
- function eventNewGame()
- for i = #birds,1,-1 do
- ui.removeTextArea(birds[i],nil)
- table.remove(birds,i)
- table.remove(bx,i)
- end
- for i in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(i,data[i].score,false)
- end
- table.insert(birds,1)
- table.insert(bx,10)
- time = -3;
- game = 0;
- score = 0;
- tube = 0;
- tx = 0;
- player = choosePlayer();
- data[player].score = 0;
- ui.addTextArea(1000,"",nil,350,300,100,800,0xA0C654,0x000000,1,true)
- ui.addTextArea(2000,"",nil,350,-675,100,800,0xA0C654,0x000000,1,true)
- end
- -- Comandos
- function eventChatCommand(p,cm)
- if cm == [[scores]] then
- bestScores(p)
- end
- end
- -- Eventos do mouse
- function eventMouse(p,x,y)
- if p == player then
- tube = 1;
- givePoints()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment