Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoTimeLeft(true)
- p={}
- mapas={6974651,6980764,7025719,6980627}
- registroSpawnObjetos = {};
- moving = true
- tempo = os.time();
- stop = 0
- vivos=0;
- function eventNewGame()
- tempo = os.time();
- moving = true
- ui.setMapName("Stopped")
- vivos = 0;
- pos=0
- for i,v in pairs(tfm.get.room.playerList) do
- vivos=vivos+1;
- p[i].rodadas = p[i].rodadas + 1
- end
- end
- function eventPlayerDied(name)
- vivos=vivos-1;
- if vivos == 0 then
- tfm.exec.newGame(mapas[math.random(#mapas)])
- end
- end
- function eventNewPlayer(name)
- p[name]={
- money = 0,
- wins = 0,
- rodadas = 0,
- firsts= 0,
- inventory = {},
- using = {},
- shop = {
- {item="Caixa",price=30,id=2,buyed=false},
- {item="Bigorna",price=30,id=10,buyed=false},
- },
- timestamp=os.time()
- }
- for key=37,40 do
- system.bindKeyboard(name, key, true, true)
- end
- system.bindKeyboard(name, 32, true, true)
- ui.addTextArea(1, "<n>Bem vindos ao Novo Mini Game <font color='#ff4e00'> #Stopped <n> Seu Objetibo é <rose>Correr até o Fim do Mapa e pega o queijo.<br><vp>[Atenção] Aquele que Pega Primeiro o Queijo... VENCE!!<br><font color='#ff0000'>Cuidado Quando Aparecer \"Stopped\" na sua tela, fique parado e não faça nenhum motivo.<br><n>Mas Por outro lado espero que se <rose>Divirta-se <br><br><font size='14'><j>Comandos :</j><br><font size='12'><vp>!shop<br>!inv<br>!money<br>!p",name, 248.5, 97, 273, 202, 0x1c1c1c)
- ui.addTextArea(0, "<font size='16'> Help", name, 225, 59, 322, 30, 0x3cff)
- ui.addTextArea(2, "<font size='16'> <a href='event:close'>Fechar</a>", name, 336.5, 269, 96, 30, 0xff0000)
- 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, " ")
- 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
- 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,"<font size='14' color='#FF8B00'>Vitórias: "..p[nome].wins,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><p align='center'>Você tem "..p[name].money.." R$.</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
- 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)
- room = isTribeHouse()
- if room then
- ui.addPopup(0,3,msg,name,205,150,290,true)
- else
- tfm.exec.chatMessage(msg,name)
- end
- end
- function eventShop(name)
- str = ''
- for i,loja in pairs(p[name].shop) do
- if loja.buyed then
- if str ~= '' then
- str = str.."<font color='#2aff00' size='12'> «"..loja.item.."» <n> | <font color='#e600ff' size='12' > «$"..loja.price.."» <n> | <font color='#FFEB00'>Item comprado</font><br>"
- else
- str = "<font color='#2aff00' size='12'> «"..loja.item.."» <n> | <font color='#e600ff' size='12' > «$"..loja.price.."» <n> | <font color='#FFEB00'>Item comprado</font><br>"
- end
- else
- if str ~= '' then
- str = str.."<font color='#2aff00' size='12'> «"..loja.item.."» <n> | <font color='#e600ff' size='12' > «$"..loja.price.."» <n> | <font color='#ffe000'><a href='event:buy-"..loja.item.."'>Comprar</a></font><br>"
- else
- str = "<font color='#2aff00' size='12'> «"..loja.item.."» <n> | <font color='#e600ff' size='12' > «$"..loja.price.."» <n> | <font color='#ffe000'><a href='event:buy-"..loja.item.."'>Comprar</a></font><br>"
- end
- end
- end
- 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(2,"<font size='12'><BL><p align='center'>Bem-vindo a loja, você tem <VP>"..p[name].money.."R$</VP></p></BL><br><br>"..str,name,205,85,290,220,0x0e232b,0x0e232b,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)
- end
- function eventInv(name)
- str="<B><font size='12'><J>Nome do item</J> | <ROSE>Botão</ROSE>"
- for i,v in pairs(p[name].inventory) do
- if p[name].using.item == v.item then
- str = str.."<br><B><font size='12'><J>"..v.item.."</J> | <VP>Usando</VP>"
- else
- str = str.."<br><B><font size='12'><J>"..v.item.."</J> | <ROSE><a href='event:usar-"..v.item.."'>Usar</a></ROSE>"
- end
- end
- 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(2,"<B><font size='12'>"..str,name,205,85,290,220,0x0e232b,0x0e232b,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)
- end
- function eventTextAreaCallback(id,name,link)
- if link == "close" then
- for id=-5,5 do
- ui.removeTextArea(id,name)
- ui.removeTextArea(6969+id,name)
- ui.removeTextArea(7979+id,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(name,"<B><R>Você comprou "..v.item.." por -"..v.price.." R$.</R></B>")
- p[name].money = p[name].money-v.price
- table.insert(p[name].inventory,{item=v.item,id=v.id})
- v.buyed = true
- else
- faltando = p[name].money-v.price
- sendMessage(name,"<B><R>Você precisa de "..faltando.." R$ para comprar "..v.item..".</R></B>")
- 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)
- tfm.exec.chatMessage("Parabéns "..n.." Venceu essa Partida!")
- end
- function eventLoop(t,r)
- local agora = os.time();
- local remover = {};
- 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] = 4000, --[Caixa grande] = 4s
- [10] = 3000 --[bigorna] = 5s
- };
- 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
- if tempo < os.time()-10000 then
- ui.addTextArea(10,"<B><p align='center'><R>STOP</R>",nil,6,30,100,20,nil,0x324650,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,"<B><p align='center'><J>ALERT</J>",nil,6,30,100,20,nil,0x324650,nil,true)
- else
- moving = true
- ui.addTextArea(10,"<B><p align='center'><font color='#00FF00'>RUN</font>",nil,6,30,100,20,nil,0x324650,nil,true)
- end
- end
- end
- function eventKeyboard(name,key,down,x,y)
- if not moving and (key == 37 or key == 38 or key == 39 or key == 40) then
- tfm.exec.killPlayer(name)
- end
- if not moving then
- if name == i then
- for i,v in pairs(tfm.get.room.playerList) do
- if v.movingRight then
- tfm.exec.killPlayer(i)
- else
- tfm.exec.killPlayer(i)
- end
- end
- end
- end
- if (key==32) and not tfm.get.room.playerList[name].isDead then
- if p[name].timestamp < os.time()-5000 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();
- end
- end
- end
- for all in pairs(tfm.get.room.playerList) do
- eventNewPlayer(all)
- end
- tfm.exec.newGame(mapas[math.random(#mapas)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement