Advertisement
JessiewindScripts

Click War 2211.005

Dec 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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","help"} do
  5. system.disableChatCommandDisplay(g,true)
  6. end
  7. sudden=false
  8. powerups=true
  9. winner=""
  10. data={}
  11. players_table={}
  12. increase=0
  13. intensity=40
  14. nightmode=false
  15. night=0
  16. mices=0
  17. remain=10
  18. last_win=""
  19. times=1;
  20. enabled=false
  21. function split(t,s)
  22.     local a={}
  23.     for i,v in string.gmatch(t,string.format("[^%s]+",s or "%s")) do
  24.         table.insert(a,i)
  25.     end
  26.     return a
  27. end
  28. function eventRanking(name)
  29.     local sc = {}
  30.     for id, name in pairs(players_table) do
  31.         sc[#sc+1] = {n=name,s=data[name].score,f=data[name].wins}
  32.     end
  33.     table.sort(sc,function(a,b) return a.s>b.s end)
  34.     str1 = ''
  35.     str2 = ''
  36.     str3 = ''
  37.     for k,v in pairs(sc) do
  38.         if k < 11 then
  39.             if str ~= '' then
  40.                 str1=str1.."<br><N>"..k.."° | <VP>"..v.n..""
  41.                 str2=str2.."<br><b><N>"..v.s.."</b>"
  42.                 str3=str3.."<br><N>"..v.f..""
  43.             else
  44.                 str1="<J>"..k.."° | <VP>"..v.n..""
  45.                 str2="<J><b>"..v.s.."</b>"
  46.                 str3="<J>"..v.f..""
  47.             end
  48.         end
  49.     end
  50.     ui.addTextArea(8000,'<B><J><font size="13"><p align="center">Temporary Ranking',name,100,100,500,30,nil,0x2e424d,nil,true)
  51.     ui.addTextArea(8001,"<B><font size='13'><font face='Consolas'>#      Name                                 Score       Wins",name,110,110,480,20,0x0e232b,0x0e232b,nil,true)
  52.     ui.addTextArea(8002,"<B><font size='16'><font face='Consolas'>"..str1,name,110,130,480,220,0x0e232b,0x0e232b,nil,true)
  53.     ui.addTextArea(8003,"<p align='right'><font size='16'><font face='Consolas'>"..str2,name,400,130,60,220,0x0e232b,0x0e232b,nil,true)
  54.     ui.addTextArea(8004,"<p align='right'><font size='16'><font face='Consolas'>"..str3,name,485,130,60,220,0x0e232b,0x0e232b,nil,true)
  55.     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)
  56. end
  57. function eventChatCommand(name,message)
  58.     local arg = split(message, " ")
  59.     if arg[1] == "p" then
  60.         if arg[2] then
  61.             nome = arg[2]:lower():gsub('%a', string.upper, 1)
  62.         else
  63.             nome = name
  64.         end
  65.  
  66.         if tfm.get.room.playerList[nome] then
  67.             ui.addTextArea(8003,'<B><J><font size="17"><p align="center">'..nome,name,245,95,315,30,nil,0x2e424d,nil,true)
  68.             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)
  69.             ui.addTextArea(8005,"<R><p align='center'><B><a href='event:fechar'>Close</a>",name,255,210,290,20,0x3c5063,0x3c5063,nil,true)
  70.         else
  71.             tfm.exec.chatMessage("Function not allowed",name)
  72.         end
  73.     end
  74.     if message == "rank" then
  75.         eventRanking(name)
  76.     end
  77.     if message == "help" then
  78.         ui.addTextArea(9000,"<B><J><font size='13'><p align='center'>Help",name,100,90,600,30,nil,0x2e424d,nil,true)
  79.         ui.addTextArea(9005,"<font size='13'><font face='Consolas'>The objetive of this module is kill the other players using the mouse to generate spirits.<br><br>At moment, 3 powerups are available:<br>F1 = Fast Spirits (700 points)<br>F2 = Double Power (250 points)<br>F3 = Box Meteor (550 points)<br>F4 = Night Mode (400 points)<br>F5 = Ultra Explosion (1000 points)<br><br>Module made by Jessiewind26#2546 and Caitlyndma7#0000",name,150,125,500,175,0x0e232b,0x0e232b,nil,true)
  80.         ui.addTextArea(9006,"<font size='13'><R><a href='event:closep'>Close</a>",name,300,297,190,20,0x3c5063,0x3c5063,nil,true)
  81.     end
  82. end
  83. function eventNewPlayer(name)
  84.     system.bindMouse(name)
  85.     if not data[name] then
  86.         table.insert(players_table,name)
  87.         data[name]={time=0,matches=0,wins=0,score=0,p1=false,p2=false,pcount=0}
  88.     end
  89.     ui.addTextArea(299,"<p align='center'><a href='event:show_menu'><font size='18'>Menu",name,365,376,70,24,0x000001,0x000001,0.75,true)
  90.     for i=112,123 do
  91.         tfm.exec.bindKeyboard(name,i,true,true)
  92.         system.bindMouse(name,true)
  93.     end
  94.     tfm.exec.chatMessage("<br>Welcome to module #clickwar!<br>Use the mouse to generate explosions and kill other mices!<br><br>Module made by Jessiewind26#2546 and Caitlyndma7#0000",name)
  95. end
  96. for name,player in pairs(tfm.get.room.playerList) do
  97.     eventNewPlayer(name)
  98. end
  99. function eventMouse(name,x,y)
  100.     if not tfm.get.room.playerList[name].isDead and enabled == true then
  101.         if data[name].p1 == false then
  102.             if data[name].time >= 2 then
  103.                 if data[name].p2 == true then
  104.                     tfm.exec.explosion(x,y,intensity,intensity*2,false)
  105.                 else
  106.                     tfm.exec.explosion(x,y,intensity/2,intensity*1.5,false)
  107.                 end
  108.                 data[name].time=0;
  109.                 tfm.exec.displayParticle(10,x,y,0,0,0,0,nil)
  110.             end
  111.         else
  112.             if data[name].p2 == true then
  113.                 tfm.exec.explosion(x,y,intensity,intensity*2,false)
  114.             else
  115.                 tfm.exec.explosion(x,y,intensity/2,intensity*1.5,false)
  116.             end
  117.             data[name].time=2;
  118.             tfm.exec.displayParticle(10,x,y,0,0,0,0,nil)
  119.         end
  120.     end
  121. end
  122. function eventNewGame()
  123.     ui.removeTextArea(1,nil)
  124.     sudden=false
  125.     tfm.exec.setGameTime(120)
  126.     winner=""
  127.     increase=0;
  128.     remain=10
  129.     enabled=false
  130.     intensity=40
  131.     prox=false;
  132.     for name,player in pairs(tfm.get.room.playerList) do
  133.         data[name].matches=data[name].matches+1
  134.         data[name].p1=false
  135.         data[name].p2=false
  136.         data[name].pcount=0
  137.     end
  138.     tfm.exec.chatMessage("<br>Welcome to module #clickwar!<br>Use the mouse to generate explosions and kill other mices!<br><br>Module made by Jessiewind26#2546 and Caitlyndma7#0000",name)
  139. end
  140. function eventLoop(pass,falt)
  141.     if pass > 1200 and pass < 1700 then
  142.         tfm.exec.chatMessage("Playing map <J>"..tfm.get.room.currentMap.."<BL> made by <J>"..tfm.get.room.xmlMapInfo.author)
  143.     end
  144.     if nightmode == true then
  145.         night=night+1
  146.         if night >= 4 then
  147.             ui.removeTextArea(2571,nil)
  148.             night=0
  149.             nightmode=false
  150.         end
  151.     end
  152.     for name,player in pairs(tfm.get.room.playerList) do
  153.         if data[name].pcount >= 0 then
  154.             data[name].pcount=data[name].pcount-1
  155.         else
  156.             data[name].p1=false
  157.             data[name].p2=false
  158.             break
  159.         end
  160.     end
  161.     if sudden == true then
  162.         intensity=intensity+2
  163.         if falt < 20000 then
  164.             intensity=intensity+1
  165.         end
  166.         for name,player in pairs(tfm.get.room.playerList) do
  167.             if not tfm.get.room.playerList[name].isDead then
  168.                 data[name].score=math.floor(data[name].score+(intensity/40))
  169.             end
  170.         end
  171.     end
  172.     if falt < 50000 and falt > 49375 then
  173.         tfm.exec.chatMessage("The ultra hard mode will be enabled in 10 seconds!",nil)
  174.     end
  175.     if falt < 40000 and sudden == false and falt > 30000 then
  176.         tfm.exec.chatMessage("<R>Ultra hard mode enabled!",nil)
  177.         ui.addTextArea(1,"",nil,-1000,-1000,3000,3000,0x000001,0x000001,0.8,false)
  178.         sudden=true;
  179.     end
  180.     if falt < 20000 and sudden == true and falt > 19000 then
  181.         ui.addTextArea(1,"",nil,-1000,-1000,3000,3000,0x000001,0x000001,0.91,false)
  182.     end
  183.     if falt < 10000 and sudden == true and falt > 9000 then
  184.         ui.addTextArea(1,"",nil,-1000,-1000,3000,3000,0x000001,0x000001,0.96,false)
  185.     end
  186.     if falt < 100 then
  187.         tfm.exec.newGame("#10")
  188.     end
  189.     if prox == false then
  190.         ui.setMapName("<N>Click War RTM 2211.005  <BL>|  <N>Intensity: <b>"..intensity.."</b>")
  191.     else
  192.         ui.setMapName("<b>"..winner.."</b> <N>wons the match! Next match on "..math.floor(falt/1000).." seconds.<")
  193.     end
  194.     remain=remain-0.5
  195.     if remain <= 3 and remain >= 0.5 then
  196.         ui.addTextArea(0,"<font size='33'><p align='center'>"..math.ceil(remain).."",nil,370,350,60,45,0x000001,0x000001,0.8,true)
  197.     end
  198.     if remain <= 0 then
  199.         ui.removeTextArea(0,nil)
  200.         enabled=true;
  201.     end
  202.     for name,player in pairs(tfm.get.room.playerList) do
  203.         data[name].time=data[name].time+1
  204.     end
  205.     if enabled == true then
  206.         increase=increase+0.5
  207.         if increase >= 2 then
  208.             if sudden == false then
  209.                 intensity=intensity+1
  210.                 increase=0;
  211.                 for name,player in pairs(tfm.get.room.playerList) do
  212.                     if not tfm.get.room.playerList[name].isDead then
  213.                         if pass > 30000 then
  214.                             data[name].score=math.floor(data[name].score+(intensity/24))
  215.                         end
  216.                     end
  217.                 end
  218.             end
  219.         end
  220.     end
  221. end
  222. function eventPlayerDied(name)
  223.     if name == last_win and times >= 2 then
  224.         tfm.exec.chatMessage("The victory sequence of <R>"..last_win.."<J> has been ended!")
  225.         times=1
  226.     end
  227.     local i=0
  228.     local n
  229.     for pname,player in pairs(tfm.get.room.playerList) do
  230.         if not player.isDead then
  231.             i=i+1
  232.             n=pname
  233.         end
  234.     end
  235.     if i==0 then
  236.         tfm.exec.newGame("#10")
  237.     elseif i==1 then
  238.         winner=n;
  239.         tfm.exec.giveCheese(n)
  240.         tfm.exec.playerVictory(n)
  241.         data[n].wins=data[n].wins+1
  242.         data[n].score=data[n].score+200
  243.         tfm.exec.setGameTime(10)
  244.         tfm.exec.setPlayerScore(n,1,true)
  245.         prox=true;
  246.         if winner == last_win then
  247.             data[n].score=data[n].score+100
  248.             times=times+1
  249.             if times == 2 then
  250.                 tfm.exec.chatMessage("<J>"..last_win.." wons <b>2</b> times in a row!")
  251.             elseif times >= 3 then
  252.                 tfm.exec.chatMessage("<R><b>Legendary!</b><J> "..last_win.." wons <b>3</b> times in a row!")
  253.             end
  254.         end
  255.         last_win=n
  256.     end
  257. end
  258. function eventTextAreaCallback(id,name,callback)
  259.     if callback == "show_menu" then
  260.         ui.addTextArea(299,"<p align='center'><a href='event:hide_menu'><font size='18'>Menu",name,365,376,70,24,0x000001,0x000001,0.75,true)
  261.         ui.addTextArea(298,"<p align='center'><a href='event:help'>Help</a>  |  <a href='event:profile'>Profile</a>  |  <a href='event:ranking'>Ranking</a>",name,300,350,200,20,0x000001,0x000001,0.80,true)
  262.     end
  263.     if callback == "hide_menu" then
  264.         ui.addTextArea(299,"<p align='center'><a href='event:show_menu'><font size='18'>Menu",name,365,376,70,24,0x000001,0x000001,0.75,true)
  265.         ui.removeTextArea(298,name)
  266.     end
  267.     if callback == "ranking" then
  268.         eventChatCommand(name,"rank")
  269.     end
  270.     if callback == "profile" then
  271.         tfm.exec.chatMessage("Use the !p command to view your profile and !p [user] to view the profile of specified user.",name)
  272.     end
  273.     if callback == "fechar" then
  274.         for id=8000,8010 do
  275.             ui.removeTextArea(id,name)
  276.         end
  277.     end
  278.     if callback == "help" then
  279.         eventChatCommand(name,"help")
  280.     end
  281.     if callback == "close" then
  282.         for id=8000,8010 do
  283.             ui.removeTextArea(id,name)
  284.             ui.removeTextArea(6969+id,name)
  285.             ui.removeTextArea(7979+id,name)
  286.         end
  287.     end
  288.     if callback == "closep" then
  289.         for id=9000,9010 do
  290.             ui.removeTextArea(id,name)
  291.         end
  292.     end
  293. end
  294. function eventKeyboard(name,key,down,x,y)
  295.     if enabled == true and powerups == true then
  296.         if not tfm.get.room.playerList[name].isDead and data[name].p1 == false and data[name].p2 == false then
  297.             if key == 112 and data[name].score >= 700 then
  298.                 data[name].p1=true
  299.                 data[name].score=data[name].score-700
  300.                 data[name].pcount=16
  301.                 tfm.exec.chatMessage("<J>"..name.." used the powerup Fast Spirits!")
  302.             end
  303.             if key == 113 and data[name].score >= 250 then
  304.                 data[name].p2=true
  305.                 data[name].score=data[name].score-250
  306.                 data[name].pcount=20
  307.                 tfm.exec.chatMessage("<J>"..name.." used the powerup Double Power!")
  308.             end
  309.             if key == 114 and data[name].score >= 550 then
  310.                 data[name].score=data[name].score-550
  311.                 tfm.exec.chatMessage("<J>"..name.." used the powerup Box Meteor!")
  312.                 for i=-6,19 do
  313.                     tfm.exec.addShamanObject(2,i*60,-1,0,0,0,false)
  314.                 end
  315.             end
  316.             if key == 115 and data[name].score >= 400 then
  317.                 data[name].score=data[name].score-400
  318.                 tfm.exec.chatMessage("<J>"..name.." used the powerup Night Mode!")
  319.                 ui.addTextArea(2571,"",nil,-800,-600,3000,3000,0x010101,0x010101,0.99,true)
  320.                 nightmode=true
  321.             end
  322.             if key == 116 and data[name].score >= 1000 then
  323.                 data[name].score=data[name].score-1000
  324.                 tfm.exec.chatMessage("<J>"..name.." used the powerup Mega Explosion!")
  325.                 for i=-4,12 do
  326.                     for j=-2,6 do
  327.                         tfm.exec.explosion(i*100,j*100,intensity,intensity*1.5,false)
  328.                         tfm.exec.displayParticle(10,i*100,j*100,0,0,0,0,nil)
  329.                     end
  330.                 end
  331.             end
  332.         end
  333.     end
  334. end
  335. tfm.exec.newGame("#10")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement