Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Meep Gamer v3.0
- -- Créditos:Brenower
- -- Tables
- data={};
- mg={
- ["alive"]=0;
- ["map"]=0;
- ["car"]=0;
- ["team1"]=0;
- ["team2"]=0;
- ["win"]=false;
- };
- maps={"4741672"};
- players={};
- -- Functions
- function giveData(p)
- if not data[p] then
- nD={
- ["team"]="...";
- ["time"]=os.time();
- ["wins"]=0;
- ["morts"]=0;
- ["winst"]=0;
- };
- data[p] = nD;
- end
- tfm.exec.bindKeyboard(p,32,false,true)
- end
- function nextMap()
- if mg.map == 1 or mg.map == 2 or mg.map == 3 then
- tfm.exec.newGame(maps[math.random(#maps)])
- tfm.exec.setGameTime(120)
- for i in pairs(tfm.get.room.playerList) do
- tfm.exec.giveMeep(i)
- data[i].time=os.time();
- end
- else
- mg.map=0;
- tfm.exec.newGame(4741672)
- tfm.exec.setGameTime(15)
- end
- end
- function giveWin()
- for vv in pairs(tfm.get.room.playerList) do
- tfm.exec.giveCheese(vv)
- tfm.exec.playerVictory(vv)
- tfm.exec.setGameTime(10)
- end
- end
- function team()
- if mg.map == 3 then
- local players = {};
- for i in pairs(tfm.get.room.playerList) do
- table.insert(players,i)
- end
- for i=1,#players do
- local r = math.random(#players)
- local p = players[r]
- if i%2==0 then
- data[p].team="red";
- tfm.exec.setNameColor(p,0xCB546B)
- else
- data[p].team="blue";
- tfm.exec.setNameColor(p,0x2F7FCC)
- end
- table.remove(players,r)
- end
- else
- for i in pairs(tfm.get.room.playerList) do
- tfm.exec.setNameColor(i,0xC2C2DA)
- end
- end
- end
- function stats(p,pp)
- ui.addTextArea(3,"<font size='14'>Partidas normais:<br /><br /><font size='12'><BL>Partidas ganhadas : <v>"..data[p].wins.."<br /><BL>Mortes : <v>"..data[p].morts.."<br /><br /><font size='14'><N>Partidas em equipe:<font size='12'><br /><br /><BL>Partidas ganhadas : <v>"..data[p].winst.."",pp,212,133,200,150,0x3C5064,0x2E5A61,1,true)
- ui.addTextArea(2,"<font size='18' face='Soopafresh'> <v>"..p.." <a href='event:close'>X</a>",pp,210,100,nil,nil,0x324650,0x2E5A61,1,true)
- ui.addTextArea(1,"",pp,130,100,75,75,0x1E3D42,0x2E5A61,1,true)
- end
- function check()
- if mg.map == 2 or mg.map == 4 then
- local i = 0;
- for vv,v in pairs(tfm.get.room.playerList) do
- if not v.isDead then
- i=i+1;
- end
- end
- if i == 1 then
- giveWin()
- end
- end
- if mg.map == 3 then
- local t1 = 0;
- local t2 = 0;
- for vv,v in pairs(tfm.get.room.playerList) do
- if not tfm.get.room.playerList[vv].isDead then
- if data[vv].team == "blue" then
- t1=t1+1;
- else
- t2=t2+1;
- end
- end
- end
- if t1 == 0 and t2 ~= 0 then
- giveWin()
- end
- if t1 ~= 0 and t2 == 0 then
- giveWin()
- end
- end
- end
- -- Novo jogador entra na sala
- function eventNewPlayer(p)
- giveData(p)
- tfm.exec.bindKeyboard(p,32,false,true)
- end
- -- Inicio do script
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoTimeLeft(true)
- print("<img src='http://i.imgur.com/zDRQwLM.png' /><br /><br /><br /><br /><br />")
- nextMap()
- for i in pairs(tfm.get.room.playerList) do
- eventNewPlayer(i)
- end
- -- Loop
- function eventLoop(ct,rt)
- if mg.map == 1 then
- local x = {100,300,500,700};
- local y = 230
- tfm.exec.displayParticle(20,x[math.random(#x)],y-70,0,0,0,0,NIL)
- tfm.exec.displayParticle(20,x[math.random(#x)]+100,y,0,0,0,0,NIL)
- end
- if rt <= 0 then
- nextMap()
- end
- end
- -- Novo jogo
- function eventNewGame()
- mg.map=mg.map+1;
- team()
- end
- -- Jogador morre
- function eventPlayerDied(p)
- check()
- data[p].morts=data[p].morts+1;
- end
- -- Eventos do teclado
- function eventKeyboard(p,key,down,x,y)
- if mg.map == 4 and not tfm.get.room.playerList[p].isDead and data[p].time < os.time()-10000 then
- data[p].time=os.time();
- tfm.exec.explosion(x,y,25,100,true)
- tfm.exec.movePlayer(p,nil,nil,false,-10,-10)
- end
- end
- -- Comandos
- function eventChatCommand(p,cm)
- local arg = {};
- for i in cm:gmatch("[^%s]+") do
- table.insert(arg,i)
- end
- if arg[1] == [[stats]] or arg[1] == [[p]] or arg[1] == [[profile]] or arg[1] == [[perfil]] and data[arg[2]] then
- stats(arg[2],p)
- end
- end
- -- Callbacks
- function eventTextAreaCallback(id,p,l)
- if l == [[close]] then
- if id == 2 then
- for i = 1,3 do
- ui.removeTextArea(i,p)
- end
- end
- end
- end
- -- Jogador ganha a partida
- function eventPlayerWon(p)
- if mg.map == 3 then
- data[p].winst=data[p].winst+1;
- else
- data[p].wins=data[p].wins+1;
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment