Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --~=V.2.0!
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoScore(true)
- p={}
- mapas={6974651,6980764,7025719,7027009,7026887,7027767,7027747,7028052,7028067,7027140,7027083,7028660}
- registroSpawnObjetos = {};
- pos = 0
- admins = {"Hugotitas","Contistente","Shiobausamak","Trofooop","Lynezx","[Anti-Souris]"}
- banidos = {}
- data={}
- moving = true
- tempo = os.time();
- stop = 0
- vivos=0;
- teclasProibidas = {[37] = true, [38] = true, [39] = true, [40] = true, [119] = true, [87] = true};
- function eventNewGame()
- tempo = os.time();
- moving = true
- pos = 4
- tfm.exec.setGameTime(120)
- vivos = 0;
- pos=0
- for i,v in pairs(tfm.get.room.playerList) do
- vivos=vivos+1;
- p[i].rodadas = p[i].rodadas + 1
- p[i].timestamp = os.time();
- ui.removeTextArea(-60,i)
- end
- end
- function eventPlayerDied(name)
- vivos=vivos-1;
- if vivos == 0 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- end
- function eventNewPlayer(name)
- if name:sub(1,1) ~= "*" then
- p[name]={
- money = 0,
- wins = 0,
- rodadas = 0,
- firsts= 0,
- sendMessage = true,
- sendTime = 0,
- inventory = {},
- using = {},
- shop = {
- {item="Caixa",price=50,id=2,buyed=false},
- {item="Bigorna",price=73,id=10,buyed=false},
- {item="Caixa Coração",price=80,id=61,buyed=false},
- {item="Rato Congelado",price=178,id=54,buyed=false},
- {item="Rocha",price=263,id=85,buyed=false},
- {item="R.I.P",price=300,id=90,buyed=false}
- },
- timestamp=os.time()
- }
- for i,v in pairs(data) do
- if v[1] == name then
- p[name] = v[2]
- end
- end
- table.insert(data,{name, p[name]})
- for key in pairs(teclasProibidas) do --lyne
- system.bindKeyboard(name, key, true, true)
- end
- system.bindKeyboard(name, 32, true, true)
- tfm.exec.chatMessage("<VP>[+]</VP> <J>Bem-vindo ao <B>Stopped</B>.</J>",name)
- eventChatCommand(name,"help")
- tfm.exec.setPlayerScore(name,0,false)
- else
- tfm.exec.chatMessage("Por favor crie uma conta para poder jogar stopped.",name)
- table.insert(banidos,name)
- tfm.exec.chatMessage("<B><V>"..name.."</V></B> foi banido do minigame.")
- end
- end
- function eventRanking(name)
- local sc = {}
- ui.addTextArea(0,"",name,80,40,600,350,nil,0x324650,nil,true)
- ui.addTextArea(1,'<B><J><font size="13"><p align="center">Ranking',name,75,35,610,30,nil,0x2e424d,nil,true)
- ui.addTextArea(2,"Pos.",name,82,77,50,20,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(3,"Nome",name,146,77,120,20,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(4,"Firsts",name,280,77,100,20,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(5,"Rodadas",name,395,77,70,20,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(6,"Moedas",name,480,77,70,20,0x0e232b,0x0e232b,nil,true)
- for name, player in pairs(tfm.get.room.playerList) do
- this = p[name]
- sc[#sc+1] = {n=name,r=this.rodadas,w=this.wins,f=this.firsts,m=this.money,id=tfm.get.room.playerList[name].id} -- insira o valor que quiser
- end
- idlist = {}
- table.sort(sc,function(a,b) return a.f>b.f end)
- table.sort(sc,function(a,b) return a.w>b.w end)
- table.sort(sc,function(a,b) return a.r>b.r end)
- table.sort(sc,function(a,b) return a.m>b.m end)
- y=80
- for k,v in pairs(sc) do
- if k < 9 then
- y=y+32
- ui.addTextArea(5959+v.id,k,name,82,y,50,20,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(4949+v.id,v.n,name,146,y,120,20,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(3939+v.id,v.f,name,280,y,100,20,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(2929+v.id,v.r,name,395,y,70,20,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(1919+v.id,v.m,name,480,y,70,20,0x0e232b,0x0e232b,nil,true)
- for i,id in pairs({5959,4949,3939,2929,1919}) do
- table.insert(idlist,id+v.id)
- end
- end
- end
- -- 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,82,368,596,20,0x3c5063,0x3c5063,nil,true)
- return str
- end
- function isAdmin(name)
- str = false
- for i,v in pairs(admins) do
- if v == name then
- str = true
- end
- end
- return str
- 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, " ")
- this = p[name]
- if arg[1] == "ban" and arg[2] and isAdmin(name) then
- nome = arg[2]:lower():gsub('%a', string.upper, 1)
- if tfm.get.room.playerList[nome] then
- table.insert(banidos,nome)
- tfm.exec.chatMessage("<VP>[+]</VP> <N>Você baniu "..nome..".</N>",name)
- for i,v in pairs(admins) do
- tfm.exec.chatMessage("<VP>[+]</VP> <N><B><V>"..name.."</V> baniu <J>"..nome.."</J></B>",v)
- end
- end
- end
- if arg[1] == "mod" then
- onlines = ""
- offlines = ""
- for i,v in pairs(admins) do
- if tfm.get.room.playerList[v] then
- if onlines ~= "" then
- onlines = onlines..","..v
- else
- onlines = v
- end
- else
- if offlines ~= "" then
- offlines = offlines..","..v
- else
- offlines = v
- end
- end
- end
- if onlines == "" then
- text = "Nenhum administrador em sala.<br>Administradores fora da sala: "..offlines
- elseif offlines == "" then
- text = "Administradores em sala: "..onlines.."<br>Nenhum administrador fora da sala."
- else
- text = "Administradores em sala: "..onlines.."<br>Administradores fora da sala: "..offlines
- end
- tfm.exec.chatMessage(text,name)
- end
- if arg[1] == "unban" and arg[2] and isAdmin(name) then
- nome = arg[2]:lower():gsub('%a', string.upper, 1)
- id = nil
- for i,v in pairs(banidos) do
- if v == nome then
- id = i
- end
- end
- if id ~= nil then
- table.remove(banidos,id)
- ui.removeTextArea(-60,name)
- tfm.exec.chatMessage("<VP>[+]</VP> <N>Você desbaniu "..nome..".</N>",name)
- for i,v in pairs(admins) do
- tfm.exec.chatMessage("<VP>[+]</VP> <N><B><V>"..name.."</V></B> desbaniu <B><J>"..nome.."</J></B>.</N>",v)
- end
- end
- end
- if arg[1] == "rank" then
- eventRanking(name)
- end
- if arg[1] == "help" then
- tfm.exec.chatMessage("<VP>Olá, pegue o queijo para vencer, temos ranking,loja inventário, veja utilizando os comandos: <B>!rank</B>,<B>!shop</B>,<B>!inv</B>, veja suas moedas com <B>!money</B> e tome muito cuidado preste atenção no semáforo para não morrer.</VP>",name)
- end
- if arg[1] == "p" then
- if arg[2] then
- nome = arg[2]:lower():gsub('%a', string.upper, 1)
- else
- nome = name
- end
- if tfm.get.room.playerList[nome] then
- this = tfm.get.room.playerList[nome]
- client = p[nome]
- ui.addTextArea(0,"",name,250,40,300,300,nil,0x324650,nil,true)
- ui.addTextArea(1,'<B><J><font size="17"><p align="center">'..nome,name,245,35,310,30,nil,0x2e424d,nil,true)
- ui.addTextArea(2,"Comunidade: <J>"..this.community:lower():gsub('%a', string.upper, 1).."</J><br>Look: <V>"..this.look.."</V><br><br><B>Rato</B><br><BL> • Queijos coletados em primeiro: <V>"..client.firsts.."</V></BL><br><BL> • Queijos coletados: <V>"..client.wins.."</V></BL><br><BL> • Moedas: <V>"..client.money.."</V></BL><br><BL> • Rodadas jogadas: <V>"..client.rodadas.."</V></BL>",name,255,80,290,220,0x0e232b,0x0e232b,nil,true)
- ui.addTextArea(3,"<R><p align='center'><B><a href='event:close'>Fechar</a>",name,255,315,290,20,0x3c5063,0x3c5063,nil,true)
- else
- tfm.exec.chatMessage("<R>"..nome.." não se encontra em sala.</R>",name)
- end
- end
- if arg[1] == "money" then
- sendMessage(name,"<B><VP>Você tem <I>"..p[name].money.."</I> moedas.</VP></B>",name)
- end
- if arg[1] == "shop" then
- eventShop(name)
- end
- if arg[1] == "inv" then
- eventInv(name)
- end
- end
- function eventPlayerWon(name)
- pos=pos+1
- p[name].wins = p[name].wins + 1
- if pos == 1 then
- p[name].firsts = p[name].firsts + 1
- end
- if pos < 4 then
- n=name
- if pos == 1 then
- m = 3
- elseif pos == 2 then
- m = 2
- elseif pos == 3 then
- m = 1
- end
- Money = math.random(3,math.floor(m*4))
- p[n].money = p[n].money+Money
- tfm.exec.playerVictory(n)
- tfm.exec.chatMessage("Parabéns "..n.." pegou o queijo em "..pos.."° lugar e ganhou +"..Money.." moedas.")
- tfm.exec.setPlayerScore(name, m, true);
- end
- vivos=vivos-1;
- if vivos == 0 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- end
- function isTribeHouse()
- return tfm.get.room.name:sub(1,2) == string.char(42, 0x03)
- end
- function sendMessage(name,msg)
- if name == nil then
- tfm.exec.chatMessage(msg)
- else
- tfm.exec.chatMessage(msg,name)
- end
- end
- function eventShop(name)
- y=55
- ui.addTextArea(0,"",name,200,45,300,300,nil,0x324650,nil,true)
- ui.addTextArea(3,'<B><J><font size="13"><p align="center">Loja',name,195,40,310,30,nil,0x2e424d,nil,true)
- ui.addTextArea(-5,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,205,320,290,20,0x3c5063,0x3c5063,nil,true)
- for i,loja in pairs(p[name].shop) do
- y=y+32
- if loja.buyed then
- ui.addTextArea(2929+i,"<VP><I>"..loja.item.."</I></VP>",name,207,y,285,20,0x0e232b,0x0e232b,nil,true)
- else
- ui.addTextArea(2929+i,"<ROSE><B><a href='event:buy-"..loja.item.."'>"..loja.item.."</a></B></ROSE>",name,207,y,285,20,0x0e232b,0x0e232b,nil,true)
- end
- end
- end
- function eventInv(name)
- y=55
- ui.addTextArea(0,"",name,200,45,300,300,nil,0x324650,nil,true)
- ui.addTextArea(3,'<B><J><font size="13"><p align="center">Inventário',name,195,40,310,30,nil,0x2e424d,nil,true)
- ui.addTextArea(-5,"<B><p align='center'><font size='15'><R><a href='event:close'>Fechar</a>",name,205,320,290,20,0x3c5063,0x3c5063,nil,true)
- for i,v in pairs(p[name].inventory) do
- y = y+32;
- if p[name].using.item == v.item then
- ui.addTextArea(2929+i,"<VP><I>"..v.item.."</I></VP>",name,207,y,285,20,0x0e232b,0x0e232b,nil,true)
- else
- ui.addTextArea(2929+i,"<ROSE><B><a href='event:usar-"..v.item.."'>"..v.item.."</a></B></ROSE>",name,207,y,285,20,0x0e232b,0x0e232b,nil,true)
- end
- end
- end
- function eventTextAreaCallback(id,name,link)
- if link == "close" then
- for id=-5,6 do
- ui.removeTextArea(id,name)
- ui.removeTextArea(6969+id,name)
- ui.removeTextArea(7979+id,name)
- end
- for i,v in pairs(idlist) do
- ui.removeTextArea(v,name)
- end
- for i,v in pairs(p[name].shop) do
- ui.removeTextArea(2929+i,name)
- end
- end
- for i,v in pairs(p[name].shop) do
- if link == "buy-"..v.item then
- if p[name].money >= v.price then
- sendMessage(nil,"<VP>[+]</VP> <V><B>"..name.."</B></V> <N>comprou o item "..v.item..".</N>")
- p[name].money = p[name].money-v.price
- table.insert(p[name].inventory,{item=v.item,id=v.id})
- v.buyed = true
- else
- faltando = v.price-p[name].money
- sendMessage(name,"<I>Você precisa de <B>+"..faltando.."</B> moedas para poder comprar este item.</I>")
- end
- eventShop(name)
- end
- end
- for i,v in pairs(p[name].inventory) do
- if link=="usar-"..v.item then
- p[name].using = {item=v.item,id=v.id}
- eventInv(name)
- sendMessage(name,"<B><J>Você agora está usando o item "..v.item..".</J></B>")
- end
- end
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- function eventPlayerGetCheese(n)
- tfm.exec.playerVictory(n)
- end
- function eventLoop(t,r)
- local agora = os.time();
- local remover = {};
- if r < 1000 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- for i,v in pairs(tfm.get.room.playerList) do
- if v.movingRight and not moving then
- tfm.exec.killPlayer(i)
- elseif v.movingLeft and not moving then
- tfm.exec.killPlayer(i)
- end
- end
- for i,v in pairs(banidos) do
- ui.addTextArea(-60,"",v,-300,-200,9999,9999,0x1C1C1C,0x1C1C1C,nil,true)
- tfm.exec.chatMessage("<VP>[+]</VP> <R><I>Você foi banido por um administrador da sala.</I></R>",v)
- tfm.exec.killPlayer(v)
- end
- for k, item in pairs(tfm.get.room.objectList) do
- if (registroSpawnObjetos[item.id]) then
- if (agora >= registroSpawnObjetos[item.id]) then
- table.insert(remover, item.id);
- end
- else
- local duracaoObjetos = {
- [2] = 5000, --[Caixa grande] = 4s
- [10] = 8000, --[bigorna] = 5s
- [61] = 7000, --[Caixa Coração] = 10s
- [54] = 7000, --[Caixa Coração] = 13s
- [90] = 5000,
- [85] = 3500
- }
- local duracaoPadrao = 3000; --quanto tempo os demais objetos que não estão listados acima irão durar
- --formato: [id do objeto] = tempo em milisegundos
- --ids dos objetos: http://atelier801.com/topic?f=6&t=801563&p=1#tab_4_message_1
- registroSpawnObjetos[item.id] = agora + (duracaoObjetos[item.id] or duracaoPadrao);
- end
- end
- for i = 1, #remover do
- --remoção dos objetos
- tfm.exec.removeObject(remover[i]);
- registroSpawnObjetos[remover[i]] = nil;
- end
- if t >= 3000 then
- ui.addTextArea(9,"",nil,6,30,40,85,0x1C1C1C,0x1C1C1C,nil,true)
- if tempo < os.time()-10000 then
- ui.addTextArea(10,"",nil,10,32,30,20,0x008B00,0x1C1C1C,nil,true)
- ui.addTextArea(11,"",nil,10,62,30,20,0xB18E00,0x1C1C1C,nil,true)
- ui.addTextArea(12,"",nil,10,92,30,20,0xFF0000,0x1C1C1C,nil,true)
- moving = false
- stop = stop+1;
- if stop == 8 then
- stop = 0
- tempo = os.time();
- end
- elseif tempo < os.time()-8000 then
- ui.addTextArea(10,"",nil,10,32,30,20,0x008B00,0x1C1C1C,nil,true)
- ui.addTextArea(11,"",nil,10,62,30,20,0xFFCC00,0x1C1C1C,nil,true)
- ui.addTextArea(12,"",nil,10,92,30,20,0xCD0000,0x1C1C1C,nil,true)
- else
- moving = true
- ui.addTextArea(10,"",nil,10,32,30,20,0x00FF00,0x1C1C1C,nil,true)
- ui.addTextArea(11,"",nil,10,62,30,20,0xB18E00,0x1C1C1C,nil,true)
- ui.addTextArea(12,"",nil,10,92,30,20,0xCD0000,0x1C1C1C,nil,true)
- end
- end
- end
- function eventKeyboard(name,key,down,x,y)
- if not moving and teclasProibidas[key] then
- tfm.exec.killPlayer(name)
- end
- if (key==32) and not tfm.get.room.playerList[name].isDead then
- if p[name].timestamp < os.time()-10000 then
- local id
- if tfm.get.room.playerList[name].isFacingRight then
- id=tfm.exec.addShamanObject(p[name].using.id,x+13,y-10,0,0,0)
- else
- id=tfm.exec.addShamanObject(p[name].using.id,x-13,y-10,180,0,0)
- end
- p[name].timestamp = os.time();
- else
- tfm.exec.chatMessage("Espere 10 segundos até spawnar um item novamente.",name)
- end
- end
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- tfm.exec.newGame(mapas[math.random(#mapas)])
- system.disableChatCommandDisplay("rank", true)
- system.disableChatCommandDisplay("help", true)
- system.disableChatCommandDisplay("p", true)
- system.disableChatCommandDisplay("ban", true)
- system.disableChatCommandDisplay("unban", true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement