Advertisement
JessiewindScripts

Click War 0.9.5

Oct 20th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.66 KB | None | 0 0
  1. for _,f in next,{"AutoShaman","AutoScore","AutoNewGame","AutoTimeLeft","AutoScore","PhysicalConsumables","DebugCommand","MinimalistMode"} do
  2.     tfm.exec["disable"..f](true)
  3. end
  4. for _,g in next,{"p","rank"} do
  5. system.disableChatCommandDisplay(g,true)
  6. end
  7. tfm.exec.setRoomMaxPlayers(40)
  8. sudden=false
  9. winner=""
  10. data={}
  11. players_table={}
  12. increase=0
  13. intensity=40
  14. mices=0
  15. remain=10
  16. last_win=""
  17. times=1;
  18. enabled=false
  19. function split(t,s)
  20.     local a={}
  21.     for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  22.         table.insert(a,i)
  23.     end
  24.     return a
  25. end
  26. function eventRanking(name)
  27.     local sc = {}
  28.     for id, name in pairs(players_table) do
  29.         sc[#sc+1] = {n=name,s=data[name].score,f=data[name].wins}
  30.     end
  31.     table.sort(sc,function(a,b) return a.s>b.s end)
  32.     str1 = ''
  33.     str2 = ''
  34.     str3 = ''
  35.     for k,v in pairs(sc) do
  36.         if k < 11 then
  37.             if str ~= '' then
  38.                 str1=str1.."<br><N>"..k.."° | <VP>"..v.n..""
  39.                 str2=str2.."<br><b><N>"..v.s.."</b>"
  40.                 str3=str3.."<br><N>"..v.f..""
  41.             else
  42.                 str1="<J>"..k.."° | <VP>"..v.n..""
  43.                 str2="<J><b>"..v.s.."</b>"
  44.                 str3="<J>"..v.f..""
  45.             end
  46.         end
  47.     end
  48.     ui.addTextArea(8000,'<B><J><font size="13"><p align="center">Temporary Ranking',name,100,100,500,30,nil,0x2e424d,nil,true)
  49.     ui.addTextArea(8001,"<B><font size='13'><font face='Consolas'>#      Name                                 Score       Wins",name,110,110,480,20,0x0e232b,0x0e232b,nil,true)
  50.     ui.addTextArea(8002,"<B><font size='16'><font face='Consolas'>"..str1,name,110,130,480,220,0x0e232b,0x0e232b,nil,true)
  51.     ui.addTextArea(8003,"<p align='right'><font size='16'><font face='Consolas'>"..str2,name,400,130,60,220,0x0e232b,0x0e232b,nil,true)
  52.     ui.addTextArea(8004,"<p align='right'><font size='16'><font face='Consolas'>"..str3,name,485,130,60,220,0x0e232b,0x0e232b,nil,true)
  53.     ui.addTextArea(8006,"<p align='center'><font size='16'><R><a href='event:close'>Close</a>",name,300,350,210,20,0x3c5063,0x3c5063,nil,true)
  54. end
  55. function eventChatCommand(name,message)
  56.     local arg = split(message, " ")
  57.     if arg[1] == "p" then
  58.         if arg[2] then
  59.             nome = arg[2]:lower():gsub('%a', string.upper, 1)
  60.         else
  61.             nome = name
  62.         end
  63.  
  64.         if tfm.get.room.playerList[nome] then
  65.             ui.addTextArea(8003,'<B><J><font size="17"><p align="center">'..nome,name,245,95,315,30,nil,0x2e424d,nil,true)
  66.             ui.addTextArea(8004,"<font size='12'><b>Score: "..data[nome].score.."</b><br><br>Wins: "..data[nome].wins.."<br>Matches: "..data[nome].matches.."",name,255,125,290,90,0x0e232b,0x0e232b,nil,true)
  67.             ui.addTextArea(8005,"<R><p align='center'><B><a href='event:fechar'>Close</a>",name,255,210,290,20,0x3c5063,0x3c5063,nil,true)
  68.         else
  69.             tfm.exec.chatMessage("Função não permitida. (Você colocou a #tag no nome?)",name)
  70.         end
  71.     end
  72.     if message == "rank" then
  73.         eventRanking(name)
  74.     end
  75. end
  76. function eventNewPlayer(name)
  77.     system.bindMouse(name)
  78.     if not data[name] then
  79.         table.insert(players_table,name)
  80.         data[name]={time=0,matches=0,wins=0,score=0,p1=false,p2=false,pcount=0}
  81.     end
  82.     tfm.exec.bindKeyboard(name,112,true,true)
  83.     tfm.exec.bindKeyboard(name,113,true,true)
  84.     tfm.exec.chatMessage("<br>Bem-vindo ao module temporário #clickwar!<br>Use o mouse para gerar uma explosão e matar os outros ratos!<br><br>Use o comando !p para ver o seu perfil e !rank para ver o ranking.<br><br>Module criado por Jessiewind26#2546 e Camilledrain#0000",name)
  85. end
  86. for name,player in pairs(tfm.get.room.playerList) do
  87.     eventNewPlayer(name)
  88. end
  89. function eventMouse(name,x,y)
  90.     if not tfm.get.room.playerList[name].isDead and enabled == true then
  91.         if data[name].p1 == false then
  92.             if data[name].time >= 2 then
  93.                 if data[name].p2 == true then
  94.                     tfm.exec.explosion(x,y,intensity,intensity*1.5,false)
  95.                 else
  96.                     tfm.exec.explosion(x,y,intensity/2,intensity*1.5,false)
  97.                 end
  98.                 data[name].time=0;
  99.                 tfm.exec.displayParticle(10,x,y,0,0,0,0,nil)
  100.             end
  101.         else
  102.             if data[name].p2 == true then
  103.                 tfm.exec.explosion(x,y,intensity,intensity*1.5,false)
  104.             else
  105.                 tfm.exec.explosion(x,y,intensity/2,intensity*1.5,false)
  106.             end
  107.             data[name].time=2;
  108.             tfm.exec.displayParticle(10,x,y,0,0,0,0,nil)
  109.         end
  110.     end
  111. end
  112. function eventNewGame()
  113.     ui.removeTextArea(1,nil)
  114.     sudden=false
  115.     tfm.exec.setGameTime(120)
  116.     winner=""
  117.     increase=0;
  118.     remain=10
  119.     enabled=false
  120.     intensity=40
  121.     prox=false;
  122.     for name,player in pairs(tfm.get.room.playerList) do
  123.         data[name].matches=data[name].matches+1
  124.         data[name].p1=false
  125.         data[name].p2=false
  126.         data[name].pcount=0
  127.     end
  128. end
  129. function eventLoop(pass,falt)
  130.     for name,player in pairs(tfm.get.room.playerList) do
  131.         if data[name].pcount >= 0 then
  132.             data[name].pcount=data[name].pcount-1
  133.         else
  134.             data[name].p1=false
  135.             data[name].p2=false
  136.             break
  137.         end
  138.     end
  139.     if sudden == true then
  140.         intensity=intensity+2
  141.         if falt < 20000 then
  142.             intensity=intensity+1
  143.         end
  144.         for name,player in pairs(tfm.get.room.playerList) do
  145.             if not tfm.get.room.playerList[name].isDead then
  146.                 data[name].score=math.floor(data[name].score+(intensity/36))
  147.             end
  148.         end
  149.     end
  150.     if falt < 40000 and sudden == false and falt > 30000 then
  151.         tfm.exec.chatMessage("<R>Modo ultra difícil habilitado!",nil)
  152.         ui.addTextArea(1,"",nil,-1000,-1000,3000,3000,0x000001,0x000001,0.8,false)
  153.         sudden=true;
  154.     end
  155.     if falt < 20000 and sudden == true and falt > 19000 then
  156.         ui.addTextArea(1,"",nil,-1000,-1000,3000,3000,0x000001,0x000001,0.91,false)
  157.     end
  158.     if falt < 100 then
  159.         tfm.exec.newGame("#10")
  160.     end
  161.     if prox == false then
  162.     ui.setMapName("<N>Click War RTM v0.9.5  <BL>|  <N>Intensidade: <b>"..intensity.."</b>")
  163.     else
  164.         ui.setMapName("<b>"..winner.."</b> <N>venceu a partida! Próxima partida em "..math.floor(falt/1000).." segundos.<")
  165.     end
  166.     remain=remain-0.5
  167.     if remain <= 3 and remain >= 0.5 then
  168.         ui.addTextArea(0,"<font size='33'><p align='center'>"..math.ceil(remain).."",nil,370,350,60,45,0x000001,0x000001,0.8,true)
  169.     end
  170.     if remain <= 0 then
  171.         ui.removeTextArea(0,nil)
  172.         enabled=true;
  173.     end
  174.     for name,player in pairs(tfm.get.room.playerList) do
  175.         data[name].time=data[name].time+1
  176.     end
  177.     if enabled == true then
  178.         increase=increase+0.5
  179.         if increase >= 2 then
  180.             if sudden == false then
  181.                 intensity=intensity+1
  182.                 increase=0;
  183.                 for name,player in pairs(tfm.get.room.playerList) do
  184.                     if not tfm.get.room.playerList[name].isDead then
  185.                         if pass > 30000 then
  186.                             data[name].score=math.floor(data[name].score+(intensity/24))
  187.                         end
  188.                     end
  189.                 end
  190.             end
  191.         end
  192.     end
  193. end
  194. function eventPlayerDied(name)
  195.     if name == last_win and times >= 2 then
  196.         tfm.exec.chatMessage("A sequência de vitórias de <R>"..last_win.."<J> foi encerrada!")
  197.         times=1
  198.     end
  199.     local i=0
  200.     local n
  201.     for pname,player in pairs(tfm.get.room.playerList) do
  202.         if not player.isDead then
  203.             i=i+1
  204.             n=pname
  205.         end
  206.     end
  207.     if i==0 then
  208.         tfm.exec.newGame("#10")
  209.     elseif i==1 then
  210.         winner=n;
  211.         tfm.exec.giveCheese(n)
  212.         tfm.exec.playerVictory(n)
  213.         data[n].wins=data[n].wins+1
  214.         data[n].score=data[n].score+200
  215.         tfm.exec.setGameTime(10)
  216.         tfm.exec.setPlayerScore(n,1,true)
  217.         prox=true;
  218.         if winner == last_win then
  219.             data[n].score=data[n].score+100
  220.             times=times+1
  221.             if times == 2 then
  222.                 tfm.exec.chatMessage("<J>"..last_win.." venceu <b>2</b> vezes seguidas!")
  223.             elseif times == 3 then
  224.                 tfm.exec.chatMessage("<R><b>Enfurecido!</b><J>"..last_win.." venceu <b>3</b> vezes seguidas!")
  225.             elseif times == 4 then
  226.                 tfm.exec.chatMessage("<R><b>Implacável!</b><J>"..last_win.." venceu <b>4</b> vezes seguidas!")
  227.             elseif times == 5 then
  228.                 tfm.exec.chatMessage("<R><b>Supremo!</b><J>"..last_win.." venceu <b>5</b> vezes seguidas!")
  229.             elseif times >= 6 then
  230.                 tfm.exec.chatMessage("<R><b>Lendário!</b><J>"..last_win.." venceu <b>"..times.."</b> vezes seguidas!")
  231.             end
  232.         end
  233.         last_win=n
  234.     end
  235. end
  236. tfm.exec.newGame("#10")
  237. function eventTextAreaCallback(id,name,callback)
  238.     if callback == "fechar" then
  239.         for id=8000,8010 do
  240.             ui.removeTextArea(id,name)
  241.         end
  242.     end
  243.     if callback == "close" then
  244.         for id=8000,8010 do
  245.             ui.removeTextArea(id,name)
  246.             ui.removeTextArea(6969+id,name)
  247.             ui.removeTextArea(7979+id,name)
  248.         end
  249.     end
  250. end
  251. function eventKeyboard(name,key,down,x,y)
  252.     if enabled == true then
  253.         if not tfm.get.room.playerList[name].isDead and data[name].p1 == false and data[name].p2 == false then
  254.             if key == 112 and data[name].score >= 1000 then
  255.                 data[name].p1=true
  256.                 data[name].score=data[name].score-1000
  257.                 data[name].pcount=16
  258.                 tfm.exec.chatMessage("<J>"..name.." usou o powerup Espíritos Rápidos!")
  259.             end
  260.             if key == 113 and data[name].score >= 400 then
  261.                 data[name].p2=true
  262.                 data[name].score=data[name].score-400
  263.                 data[name].pcount=20
  264.                 tfm.exec.chatMessage("<J>"..name.." usou o powerup Potência Duplicada!")
  265.             end
  266.         end
  267.     end
  268. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement