Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mapas = {6940835,6940872,6939230,6939743,6932947,6931137,6933370,6933386,6933388,6939573,6939693,6939230,6939580,6939558,6939573,6939583,6939322}
- p = {}
- admin = "Contistente"
- click = false
- jogadores = 0
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAfkDeath(true)
- translations={
- EN={
- help={
- "<b><p align='center'><J><font size='18'>How to play:</font></J><br>Rats can not die by the explosions that cause killer <R>by click on the screen</R>, just do not forget win the last alive and each mouse has meep.\n<V><p align='center'><J><font size='18'>Credits: </font></J><br><N><V>Rianmojang</V>,<CE>Contistente</CE> and <J>Laagaadoo</J>.",
- "<p align='center'><J><font size='18'>Commands: </font></J></p><br>!p - open the profile tab<br>!help - open the help tab<br>!rank - open the ranking tab<br>!shop - ...",
- "<p align='center'><J><font size='18'>Credits: </font></J><br><N><V>Rianmojang</V>,<CE>Contistente</CE> e <J>Laagaadoo</J>.",
- },
- profile={
- wins = "Wins: ",
- kills = "Kills: ",
- rounds = "Rounds: ",
- killers = "Killer: "
- },
- rank={
- ["name"] = "Name",
- ["position"] = "Place",
- ["wins"] = "Wins"
- },
- errors={
- ["invalid_name_1"] = "<BL>-</BL> <R>Error invalid user name,",
- ["invalid_name_2"] = " Is not in the room.</R>",
- ["manutention_shop"] = "The store is under maintenance."
- },
- buttons = {
- ["help"] = "Ajuda",
- ["rank"] = "Ranking",
- ["shop"] = "Loja",
- },
- },
- BR={
- help={
- "<b><p align='center'><J><font size='18'>Como Jogar:</font></J><br>Os ratos não podem morrer para as explosões que o assasino causa <R>clickando na tela</R>, cada rato tem meep e o último vivo ganha.",
- "<p align='center'><J><font size='18'>Comandos: </font></J></p><br>!p - abre o perfil<br>!help - abre a aba de ajuda<br>!rank - abre o ranking<br>!loja - ...",
- "<p align='center'><J><font size='18'>Creditos: </font></J><br><N><V>Rianmojang</V>,<CE>Contistente</CE> e <J>Laagaadoo</J>.",
- },
- profile={
- ["wins"] = "Vitórias: ",
- ["kills"] = "Mortes: ",
- ["rounds"] = "Rodadas: ",
- ["killers"] = "Assassino: "
- },
- rank={
- ["name"] = "Nome",
- ["position"] = "Lugar",
- ["wins"] = "Vitórias"
- },
- errors={
- ["invalid_name_1"] = "<BL>-</BL> <R>Erro nome de usuário inválido,",
- ["invalid_name_2"] = " não está na sala.</R>",
- ["manutention_shop"] = "A loja está em manutenção."
- },
- buttons = {
- ["help"] = "Ajuda",
- ["rank"] = "Ranking",
- ["shop"] = "Loja"
- },
- }
- }
- players={}
- local proximoAssassino = ''
- textarea=ui.addTextArea
- function ui.addTextArea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha,emboss)
- --if not backgroundColor then backgroundColor=0x324650 end
- --if not borderColor then borderColor=0x000001 end
- if emboss then
- textarea(6969+id,"",targetPlayer,x,y+1,width,height,0x000001,0x000001,backgroundAlpha)
- textarea(7979+id,"",targetPlayer,x,y-1,width,height,0x6A8FA2,0x6A8FA2,backgroundAlpha)
- end
- textarea(id,text,targetPlayer,x,y,width,height,backgroundColor,borderColor,backgroundAlpha)
- end
- function trans(mes)
- if translations[tfm.get.room.community] and translations[tfm.get.room.community][mes] then
- return translations[tfm.get.room.community][mes]
- else
- return translations.BR[mes]
- end
- end
- function eventRank()
- local sc = {}
- for name, player in pairs(tfm.get.room.playerList) do
- sc[#sc+1] = {n=name,w=p[name].wins}
- end
- table.sort(sc,function(a,b) return a.w>b.w end)
- y = 25
- for k,v in pairs(sc) do
- if k < 9 then
- y=y+30;
- ui.addTextArea(9000+k,"<J>"..k.."</J> | <V>"..v.n.."</V> | <CE>"..v.w.."</CE>",name,260,y+30,280,15,nil,0x324650,nil,true)
- end
- end
- end
- function eventChatCommand(name,command)
- local arg = {}
- for args in command:gmatch("[^%s]+") do
- table.insert(arg, args:lower())
- end
- if arg[1]=="help" then
- ui.addTextArea(1,"<font size='12'>"..trans("help")[players[name].helpid],name,250,50,300,300,nil,0x324650,nil,true)
- ui.addTextArea(2,"<p align='center'><a href='event:previous'><b><</b></a></p>",name,445,365,16,16,nil,0x324650,nil,true)
- ui.addTextArea(3,"<p align='center'><a href='event:next'><b>></b></a></p>",name,532,365,16,16,nil,0x324650,nil,true)
- ui.addTextArea(4,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
- ui.addTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name,475,365,42,16,nil,0x324650,nil,true)
- end
- if arg[1]=="rank" then
- ui.addTextArea(1,"<p align='center'><J><font size='18'>Mini-Rank</font></J></p>",name,250,50,300,300,nil,0x324650,nil,true)
- ui.addTextArea(2,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
- for i,v in pairs({3,4,5}) do
- ui.removeTextArea(v,name)
- ui.removeTextArea(6969+v,name)
- ui.removeTextArea(7979+v,name)
- end
- eventRank();
- end
- if (arg[1]=="shop" or arg[1]=="loja") then
- tfm.exec.chatMessage('<R>'..trans("errors")["manutention_shop"],name)
- end
- if arg[1]=="p" then
- if arg[2] then
- nome = arg[2]:sub(1,1):upper() .. arg[2]:sub(2):lower()
- else
- nome = name
- end
- if tfm.get.room.playerList[nome] then
- wins = trans("profile")["wins"]
- kills = trans("profile")["kills"]
- rounds = trans("profile")["rounds"]
- killers = trans("profile")["killers"]
- ui.addTextArea(1,"<p align='center'><b><font size='18'><J>"..nome.."</J></font><br><font size='15'><N>"..wins.."</N><V>"..p[nome].wins.."</V><br>"..kills.."</N><V>"..p[nome].kills.."</V><br>"..rounds.."</N><V>"..p[nome].rounds.."</V><br>"..killers.."</N><V>"..p[nome].killers.."</V><br>",name,250,50,300,300,nil,0x324650,nil,true)
- ui.addTextArea(2,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
- for i,v in pairs({3,4,5}) do
- ui.removeTextArea(v,name)
- ui.removeTextArea(6969+v,name)
- ui.removeTextArea(7979+v,name)
- end
- else
- tfm.exec.chatMessage(trans("errors")["invalid_name_1"]..nome..trans("errors")["invalid_name_2"],name)
- end
- end
- end
- function eventTextAreaCallback(id,name,callback)
- if callback=="help" then
- eventChatCommand(name,callback)
- elseif callback=="rank" then
- eventChatCommand(name,callback)
- elseif callback=="shop" then
- eventChatCommand(name,callback)
- elseif callback=="menu" then
- ui.addTextArea(10,"",name,6,365,300,25,0x1c3b40,0x1c3b40,nil,true)
- ui.addTextArea(11,"<p align='center'><b><a href='event:menu-close'>...</a></p>",name,6,365,20,25,0x1b393d,0x1b393d,nil,true)
- ui.addTextArea(12,"<p align='center'><a href='event:help'><b>"..trans("buttons")["help"].."</a></p>",name,40,368,75,20,nil,0x324650,nil,true)
- ui.addTextArea(13,"<p align='center'><a href='event:rank'><b>"..trans("buttons")["rank"].."</a></p>",name,130,368,75,20,nil,0x324650,nil,true)
- ui.addTextArea(14,"<p align='center'><a href='event:shop'><b>"..trans("buttons")["shop"].."</a></p>",name,220,368,75,20,nil,0x324650,nil,true)
- elseif callback=="menu-close" then
- for id=10,14 do
- ui.removeTextArea(id,name)
- ui.removeTextArea(6969+id,name)
- ui.removeTextArea(7979+id,name)
- end
- ui.addTextArea(11,"<p align='center'><a href='event:menu'><b>...</a></p>",name,6,365,20,25,nil,0x324650,nil,true)
- elseif callback=="close" then
- players[name].helpid=1
- for id=1,9 do
- ui.removeTextArea(id,name)
- ui.removeTextArea(9000+id,name)
- ui.removeTextArea(6969+9000+id,name)
- ui.removeTextArea(7979+9000+id,name)
- ui.removeTextArea(6969+id,name)
- ui.removeTextArea(7979+id,name)
- end
- elseif callback=="next" and players[name].helpid<#trans("help") then
- players[name].helpid=(players[name].helpid)+1
- ui.updateTextArea(1,trans("help")[players[name].helpid],name)
- ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
- ui.addTextArea(4,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
- elseif callback=="previous" and players[name].helpid>1 then
- players[name].helpid=players[name].helpid-1
- ui.updateTextArea(1,trans("help")[players[name].helpid],name)
- ui.updateTextArea(5,"<p align='center'>"..players[name].helpid.."/"..#trans("help").."</p>",name)
- ui.addTextArea(4,"<p align='center'><a href='event:close'><b>Fechar</b></a></p>",name,275,325,250,16,nil,0x324650,nil,true)
- end
- end
- function eventNewPlayer(name)
- p[name]={
- click = true,
- time_click = 0,
- wins = 0,
- kills = 0,
- rounds = 0,
- killers = 0,
- }
- if jogadores == 2 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- jogadores = jogadores+1;
- tfm.exec.setPlayerScore(name,0,false)
- system.bindMouse(name,true)
- players[name]={helpid=1}
- ui.addTextArea(6,"<p align='center'><a href='event:menu'><b>...</a></p>",name,11,365,20,25,nil,0x324650,nil,true)
- if proximoAssassino ~= '' then
- tfm.exec.setUIMapName("<b>#explosion</b> <font color='#6a7495'>|</font> <N>Assassino: </N><V>"..proximoAssassino.."</V>")
- end
- tfm.exec.chatMessage("<CE>"..name.." bem-vindo ao explosion.</CE><br><VP>Acesse o nosso tópico no forum: http://atelier801.com/topic?f=6&t=838331</VP>",name)
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- function eventMouse(name,x,y)
- if p[name].click and admin == name and jogadores >= 3 and click then
- tfm.exec.explosion (x, y, 20, 100, true)
- tfm.exec.displayParticle(12,x,y)
- p[name].click = false
- p[name].time_click = 5
- end
- end
- function eventLoop(elapsed, remaining)
- if elapsed >= 3800 and not click then
- click = true
- end
- if jogadores >= 3 then
- if not p[admin].click then
- if p[admin].time_click > 0 then
- ui.addTextArea(-1,math.floor(p[admin].time_click/2),nil,750,375,20,15,nil,nil,80,true)
- p[admin].time_click = p[admin].time_click-1;
- else
- p[admin].click = true
- ui.removeTextArea(-1,nil)
- ui.removeTextArea(6969+-1,nil)
- ui.removeTextArea(7979+-1,nil)
- end
- end
- if remaining < 1000 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- proximoAssassino = ''
- end
- else
- tfm.exec.setUIMapName("<R>É necessário 3 jogadores.</R>")
- end
- end
- function eventPlayerDied(name)
- if vivos > 2 then
- vivos = vivos-1;
- else
- for i in pairs(tfm.get.room.playerList) do
- if not tfm.get.room.playerList[i].isDead then
- proximoAssassino = i
- tfm.exec.giveCheese(i)
- tfm.exec.playerVictory(i)
- end
- end
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- p[name].kills = p[name].kills+1;
- end
- function eventPlayerWon(name)
- p[name].wins = p[name].wins+1;
- end
- function eventPlayerLeft(name)
- jogadores = jogadores-1;
- end
- function eventNewGame()
- vivos = 0
- click = false
- ui.removeTextArea(-1,nil)
- ui.removeTextArea(-2,nil)
- tfm.exec.setGameTime(120)
- local sc = {}
- for name,player in pairs(tfm.get.room.playerList) do
- vivos=vivos+1;
- sc[#sc+1] = name
- tfm.exec.giveMeep(name)
- p[name].rounds = p[name].rounds+1;
- end
- if proximoAssassino == '' then
- proximoAssassino = sc[math.random(#sc)]
- end
- admin = proximoAssassino
- tfm.exec.killPlayer(admin)
- p[admin].killers = p[admin].killers+1;
- tfm.exec.setUIMapName("<b>#explosion</b> <font color='#6a7495'>|</font> <N>Assassino: </N><V>"..proximoAssassino.."</V>")
- tfm.exec.chatMessage("Cuidado <V>"..admin.."</V> é o assassino.")
- end
- for i,v in pairs({"p","help","rank","shop","loja"}) do
- system.disableChatCommandDisplay(v, true)
- end
- tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement