Advertisement
Guest User

[Script] Chat

a guest
Oct 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.13 KB | None | 0 0
  1. local data = {}
  2. local gametime = 5
  3. local xml = '<C><P /><Z><S><S L="800" X="401" H="127" Y="432" T="0" P="0,0,0.3,0.2,0,0,0,0" /></S><D /><O /><L><VL n="Layer1" l="-1" /><JPL c="050505,9,1,0" P3="42,316" P2="44,311" P4="43,314" P1="42,317" /><JPL c="050505,9,1,0" P3="46,307" P2="52,296" P4="49,302" P1="44,311" /><JPL c="050505,9,1,0" P3="56,289" P2="65,276" P4="60,283" P1="52,296" /><JPL c="050505,9,1,0" P3="71,269" P2="84,256" P4="77,263" P1="65,276" /><JPL c="050505,9,1,0" P3="92,250" P2="110,241" P4="100,245" P1="84,256" /><JPL c="050505,9,1,0" P3="120,238" P2="142,235" P4="130,236" P1="110,241" /><JPL c="050505,9,1,0" P3="155,236" P2="155,236" P4="168,238" P1="142,235" /><VC f="20" P2="168,238" C1="42,317" C="050505,9,1,0" C2="76,216" P1="42,317" /><JPL c="050505,9,1,0" P3="168,162" P2="159,165" P4="164,163" P1="169,162" /><JPL c="050505,9,1,0" P3="152,167" P2="134,174" P4="144,170" P1="159,165" /><JPL c="050505,9,1,0" P3="124,179" P2="102,190" P4="113,184" P1="134,174" /><JPL c="050505,9,1,0" P3="91,197" P2="70,214" P4="80,205" P1="102,190" /><JPL c="050505,9,1,0" P3="61,223" P2="45,246" P4="52,234" P1="70,214" /><JPL c="050505,9,1,0" P3="40,258" P2="36,286" P4="37,272" P1="45,246" /><JPL c="050505,9,1,0" P3="37,302" P2="37,302" P4="41,319" P1="36,286" /><VC f="20" P2="41,319" C1="169,162" C="050505,9,1,0" C2="4,203" P1="169,162" /><JD c="050505,9,1,0" P2="170,273" P1="169,238" /><JD c="050505,9,1,0" P2="301,203" P1="170,273" /><JD c="050505,9,1,0" P2="170,123" P1="300,202" /><JD c="050505,9,1,0" P2="170,159" P1="170,123" /><JD c="050505,9,1,0" P2="50,244" P1="42,299" /><JD c="050505,9,1,0" P2="73,243" P1="43,304" /><JD c="050505,36,1,0" P2="102,216" P1="57,258" /><JD c="050505,36,1,0" P2="168,181" P1="102,216" /><JD c="050505,36,1,0" P2="75,228" P1="168,181" /><JD c="050505,36,1,0" P2="173,197" P1="105,229" /><JD c="050505,36,1,0" P2="186,220" P1="130,221" /><JD c="050505,28,1,0" P2="49,283" P1="60,253" /><JD c="050505,28,1,0" P2="179,141" P1="185,183" /><JD c="050505,28,1,0" P2="278,200" P1="179,141" /><JD c="050505,28,1,0" P2="180,254" P1="278,200" /><JD c="050505,28,1,0" P2="177,199" P1="180,254" /><JD c="050505,28,1,0" P2="250,204" P1="168,210" /><JD c="050505,28,1,0" P2="200,175" P1="208,232" /><JD c="050505,28,1,0" P2="238,198" P1="200,175" /><JD c="050505,12,1,0" P2="292,204" P1="261,209" /><JD c="050505,12,1,0" P2="170,125" P1="170,170" /><L /></L></Z></C>'
  4.  
  5. for k, v in next, {'AutoShaman', 'AutoTimeLeft', 'AfkDeath', 'AutoNewGame'} do
  6.     tfm.exec['disable' .. v]()
  7. end
  8.  
  9. tfm.exec.newGame(xml)
  10.  
  11. function eventNewPlayer(name)
  12.     data[name] = {clicks = 0}
  13. end
  14. table.foreach(tfm.get.room.playerList, eventNewPlayer)
  15.  
  16. function eventNewGame()
  17.     tfm.exec.setGameTime(30)
  18.     ui.setMapName('...')
  19.     ui.addTextArea(0, "<font size='700'>•", nil, 250, -272, 486, 634, 0xc64ad4, 0x000000, 0, true)
  20.     gametime = 5
  21.     for k, v in next, data do
  22.         v.clicks = 0
  23.     end
  24. end
  25.  
  26. function eventLoop(elapsed, remaining)
  27.     local elapsed, remaining = math.floor(elapsed/1000), math.floor(remaining/1000)
  28.    
  29.     gametime = gametime - 0.5
  30.    
  31.     if (elapsed < 5) then
  32.         if (not tostring(gametime):find('.5')) then
  33.             ui.setMapName('The round will start in ' .. (gametime + 1) .. ' seconds.')
  34.         end
  35.     elseif (elapsed == 5) then
  36.         ui.setMapName('Click!')
  37.         ui.updateTextArea(0, "<a href='event:click'><font size='700'><vp>•</a>", nil)
  38.     elseif (elapsed == 20) then
  39.         local str = ''
  40.         local clicks = {}
  41.         for k, v in next, data do
  42.             clicks[#clicks + 1] = {k, v.clicks}
  43.         end
  44.         table.sort(clicks, function(a, b) return a[2] > b[2] end)
  45.        
  46.         for i = 1, #clicks do
  47.             str = str .. '<v>' .. clicks[i][1] .. '<n>: <j>' .. clicks[i][2] .. '\n'
  48.         end
  49.        
  50.         ui.updateTextArea(0, "<font size='700'>•", nil)
  51.         ui.addTextArea(1, str, nil, 50, 50)
  52.     end
  53.    
  54.     if (remaining <= 0) then
  55.         ui.removeTextArea(1, nil)
  56.         tfm.exec.newGame(xml)
  57.     end
  58. end
  59.  
  60. function eventTextAreaCallback(id, name, link)
  61.     if (link == 'click') then
  62.         data[name].clicks = data[name].clicks + 1
  63.     end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement