Advertisement
Allounett_Deathmatic

Bubbles v1.2

Mar 8th, 2014
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.98 KB | None | 0 0
  1. baseXML = [[
  2. <C><P DS="y;90" Ca="" /><Z><S><S P="0,0,9999,0.2,0,0,0,0" L="800" o="0" H="10" v="3000" Y="110" T="12" X="400" /><S L="800" o="fffffffff" H="10" X="400" v="3000" Y="70" T="12" P="0,0,9999,0.2,0,0,0,0" /><S P="0,0,9999,0.2,0,0,0,0" L="50" o="0" X="400" Y="-200" T="12" H="10" /><S L="50" o="0" X="400" H="10" Y="-240" T="12" P="0,0,9999,0.2,0,0,0,0" /><S P="0,0,9999,0.2,90,0,0,0" L="50" o="0" H="10" Y="-220" T="12" X="430" /><S L="50" o="0" H="10" X="370" Y="-220" T="12" P="0,0,9999,0.2,90,0,0,0" /></S><D><DS Y="90" X="400" /></D><O /></Z></C>
  3. ]]
  4.  
  5. tfm.exec.disableAfkDeath(true)
  6. tfm.exec.disableAutoShaman(true)
  7. tfm.exec.disableAutoNewGame(true)
  8. tfm.exec.disableAutoScore(true)
  9. tfm.exec.disableAutoTimeLeft(true)
  10.  
  11. system.disableChatCommandDisplay("afk")
  12. system.disableChatCommandDisplay("setdiff")
  13.  
  14. --          jour    crepuscule   aurore     nuages   collision    nocturne     noel    frommage
  15. maps = {"@4535536","@4533657","@4535757","@4535960","@4537526","@4537528","@4537632","@4871997"}
  16. players = {}
  17. afk = {}
  18.  
  19. id = {
  20.   askDifficulty = 42,
  21.   resultDifficulty = 43,
  22.   infoDifficulty = 44
  23. }
  24.  
  25. trigger = {
  26.   askDifficulty = false,
  27.   resultDifficulty = false,
  28.   askDifficultyInShutdown = false
  29. }
  30.  
  31. playerAsked = nil
  32. playersVotes = {}
  33. difficultyAsked = nil
  34. nextDifficulty = nil
  35. votesCount = 100
  36.  
  37. -- Plus frequency proche de 0, plus c'est fréquent
  38.  
  39. difficulty = {
  40.   easy = {
  41.     spawnFrequency = 1,
  42.     spiritFrequency = 5,
  43.     cannonFrequency = 6,
  44.     delayUnfrequency = 5,
  45.     spiritTime = 25,
  46.     cannonTime = 45
  47.   },
  48.   medium = {
  49.     -- Fréquence de spawn des bulles au début
  50.     spawnFrequency = 1,
  51.  
  52.     -- Fréquence de spawn des esprits
  53.     spiritFrequency = 4,
  54.  
  55.     -- Fréquence de spawn des boulets
  56.     cannonFrequency = 5,
  57.  
  58.     -- Nombre de secondes avant que la fréquence de spawn des bulles ne baisse
  59.     delayUnfrequency = 5,
  60.  
  61.     -- Nombre de secondes avant que les esprits n'apparaîssent
  62.     spiritTime = 20,
  63.  
  64.     -- Nombre de secondes avant que les boulets n'apparaissent
  65.     cannonTime = 40
  66.   },
  67.   hard = {
  68.     spawnFrequency = 1,
  69.     spiritFrequency = 3,
  70.     cannonFrequency = 4,
  71.     delayUnfrequency = 4,
  72.     spiritTime = 15,
  73.     cannonTime = 30
  74.   }
  75. }
  76.  
  77. currentDifficulty = difficulty.easy
  78.  
  79. lang = {}
  80.  
  81. lang.fr = {
  82.   info = "Bubbles !",
  83.   afk = "<N>Vous êtes <J>AFK<N>. Pour jouer, dites : <ROSE>!afk<N>.",
  84.   welcome = "<N>Bienvenue dans <J>#Bubbles<N> !<br /><T>Vous avez été emprisonnées dans une cage invisible aux parois mortelles. La seule chose que vous pouvez faire est de survivre le plus longtemps possible et être la dernière à vous en sortir !",
  85.   vote_choice_1 = "<N> veut modifier la difficulté à ",
  86.   vote_choice_2 = "<N>. Appuyez sur <J>1<N> si <V>vous êtes d'accord<N>, <R>sinon<N> appuyez sur <J>2<N>. <ROSE>Fin des votes dans <J>",
  87.   vote_choice_3 = "<ROSE> seconde(s).",
  88.   difficulty = "<N>Difficulté",
  89.   easy = "<V>Facile",
  90.   medium = "<J>Moyen",
  91.   hard = "<R>Difficile",
  92.   newDifficulty = "<N>La nouvelle difficulté sera mise en place lors de la prochaine partie.",
  93.   noNewDifficulty = "<N>La nouvelle difficulté n'a pas été adoptée.",
  94.   youVotedYes = "Vous avez voté <V>Pour<N>.",
  95.   youVotedNo = "Vous avez voté <R>Contre<N>."
  96. }
  97.  
  98. lang.en = {
  99.   info = "Bubbles !",
  100.   afk = "<N>You are <J>AFK<N>. To play, say : <ROSE>!afk<N>.",
  101.   welcome = "<N>Welcome to <J>#Bubbles<N> !",
  102.   vote_choice_1 = " <N> want to set the difficulty to ",
  103.   vote_choice_2 = "<N>. <ROSE>Press 1 if you agree, else press 2. Votes will end in ",
  104.   vote_choice_3 = "<ROSE> second(s).",
  105.   difficulty = "<N>Difficulty",
  106.   easy = "<V>Easy",
  107.   medium = "<J>Medium",
  108.   hard = "<R>Hard",
  109.   newDifficulty = "<N>The new difficulty has been instaured.",
  110.   noNewDifficulty = "<N>The new difficulty hasn't been instaured.",
  111.   youVotedYes = "You voted <V>for<N>.",
  112.   youVotedNo = "You voted <R>against<N>."
  113. }
  114.  
  115. text = lang.fr
  116.  
  117. timer = {
  118.   start = 0,
  119.   frequence = 0,
  120.   unfrequence = 0,
  121.   askDifficulty = 0,
  122.   resultDifficulty = 0,
  123.   shutdownDifficulty = 0
  124. }
  125.  
  126. bubbles = {}
  127.  
  128. function eventNewGame()
  129.   bubbles = {}
  130.   players = {}
  131.   spawnFrequency = 0.5
  132.  
  133.   timer.start = 0
  134.   timer.frequence = 0
  135.   timer.unfrequence = 0
  136.  
  137.   for n,p in pairs(tfm.get.room.playerList) do
  138.     table.insert(players, n)
  139.   end
  140.  
  141.   local bestPlayer = bestPlayer()
  142.   tfm.exec.setUIMapName("<PT>"..text.info.." <font color='#60608F'>|</font>   <N>Bubble Master : <VP>"..bestPlayer)
  143.  
  144.   for _,p in pairs(players) do
  145.     if afk[p] then
  146.       tfm.exec.movePlayer(p, 400, -200, false, 0, 0, false)
  147.     else
  148.       tfm.exec.movePlayer(p, math.random(100, 700), 90, false, 0, 0, false)
  149.     end
  150.   end
  151.  
  152.   showAfk()
  153. end
  154.  
  155. function eventNewPlayer(playerName)
  156.   tfm.exec.setPlayerScore(playerName, 0, false)
  157.   table.insert(players, playerName)
  158.   afk[playerName] = false
  159.  
  160.   tfm.exec.bindKeyboard(playerName, 49, false) -- 1
  161.   tfm.exec.bindKeyboard(playerName, 50, false) -- 2
  162.   tfm.exec.bindKeyboard(playerName, 97, false) -- 1
  163.   tfm.exec.bindKeyboard(playerName, 98, false) -- 2
  164. end
  165.  
  166. function eventPlayerLeft(playerName)
  167.   local toRemove = 0
  168.  
  169.   for i,p in pairs(players) do
  170.     if p==playerName then
  171.       toRemove = i
  172.     end
  173.   end
  174.  
  175.   table.remove(players, toRemove)
  176.   afk[playerName] = false
  177. end
  178.  
  179. function eventPlayerDied(playerName)
  180.   if #players > 1 then
  181.     local alive = 0
  182.     local pname = ""
  183.    
  184.     for _,p in pairs(players) do
  185.       if not tfm.get.room.playerList[p].isDead and not afk[p] and tfm.get.room.playerList[p].y > 0 then
  186.         alive = alive + 1
  187.         pname = p
  188.       end
  189.     end
  190.    
  191.     if alive == 1 then
  192.       tfm.exec.giveCheese(pname)
  193.       tfm.exec.playerVictory(pname)
  194.       tfm.exec.setGameTime(5)
  195.     elseif alive == 0 then
  196.       newGame()
  197.     end
  198.   else
  199.     newGame()
  200.   end
  201. end
  202.  
  203. function eventPlayerWon(playerName)
  204.   local score = 0
  205.   if currentDifficulty == difficulty.easy then score = 12
  206.   elseif currentDifficulty == difficulty.medium then score = 14
  207.   elseif currentDifficulty == difficulty.hard then score = 16 end
  208.   if playerName == bestPlayer() then score = score - 5 end
  209.   tfm.exec.setPlayerScore(playerName, score, true)
  210. end
  211.  
  212. function eventLoop(currentTime, timeRemaining)
  213.   timer.start = timer.start + 0.5
  214.  
  215.   if timer.start == 1.5 then
  216.     for p,s in pairs(tfm.get.room.playerList) do
  217.       if not afk[p] then table.insert(bubbles, tfm.exec.addShamanObject(59, s.x, 400, 0, 0, 0, false)) end
  218.     end
  219.   end
  220.  
  221.   if trigger.askDifficulty then
  222.     timer.askDifficulty = timer.askDifficulty + 0.5
  223.    
  224.     if difficultyAsked == 1 then
  225.       ui.updateTextArea(id.askDifficulty, "<p align='center'><J>"..playerAsked..text.vote_choice_1..text.easy..text.vote_choice_2..(20 - round(timer.askDifficulty))..text.vote_choice_3.."</p>", nil)
  226.     elseif difficultyAsked == 2 then
  227.       ui.updateTextArea(id.askDifficulty, "<p align='center'><J>"..playerAsked..text.vote_choice_1..text.medium..text.vote_choice_2..(20 - round(timer.askDifficulty))..text.vote_choice_3.."</p>", nil)
  228.     elseif difficultyAsked == 3 then
  229.       ui.updateTextArea(id.askDifficulty, "<p align='center'><J>"..playerAsked..text.vote_choice_1..text.hard..text.vote_choice_2..(20 - round(timer.askDifficulty))..text.vote_choice_3.."</p>", nil)
  230.     end
  231.    
  232.     if timer.askDifficulty >= 20 then
  233.       local wasNewDifficulty = false
  234.      
  235.       local yesVotes = 0
  236.      
  237.       for _,vote in pairs(playersVotes) do
  238.         if vote == "yes" then yesVotes = yesVotes + 1 end
  239.       end
  240.      
  241.       if yesVotes > #playersVotes - yesVotes then
  242.         nextDifficulty = difficultyAsked
  243.         wasNewDifficulty = true
  244.       end
  245.      
  246.       ui.removeTextArea(id.askDifficulty)
  247.  
  248.       trigger.askDifficultyInShutdown = true
  249.       trigger.askDifficulty = false
  250.       timer.askDifficulty = 0
  251.      
  252.       for i = 0,100 do
  253.         if votesCount > 100 then
  254.           ui.removeTextArea(votesCount)
  255.           votesCount = votesCount - 1
  256.         else
  257.           break
  258.         end
  259.       end
  260.      
  261.       votesCount = 100
  262.       playerAsked = nil
  263.       playersVotes = {}
  264.       difficultyAsked = nil
  265.      
  266.       if wasNewDifficulty then ui.addTextArea(id.resultDifficulty, "<p align='center'>"..text.newDifficulty.."</p>", nil, 0, 377, 800, 20, 0x010101, 0x010101, 0.7f)
  267.       else ui.addTextArea(id.resultDifficulty, "<p align='center'>"..text.noNewDifficulty.."</p>", nil, 0, 377, 800, 20, 0x010101, 0x010101, 0.7f) end
  268.        
  269.       trigger.resultDifficulty = true
  270.     end
  271.   end
  272.  
  273.   if trigger.resultDifficulty then
  274.     timer.resultDifficulty = timer.resultDifficulty + 0.5
  275.    
  276.     if timer.resultDifficulty >= 8 then
  277.       ui.removeTextArea(id.resultDifficulty)
  278.       trigger.resultDifficulty = false
  279.       timer.resultDifficulty = 0
  280.       trigger.askDifficultyInShutdown = true
  281.     end
  282.   end
  283.  
  284.   if trigger.askDifficultyInShutdown then
  285.     timer.shutdownDifficulty = timer.shutdownDifficulty + 0.5
  286.    
  287.     if timer.shutdownDifficulty >= 120 then
  288.       trigger.askDifficultyInShutdown = false
  289.       timer.shutdownDifficulty = 0
  290.     end
  291.   end
  292.  
  293.   if timeRemaining <= 0 then
  294.     for _,p in pairs(players) do
  295.       if not tfm.get.room.playerList[p].isDead and not afk[p] then
  296.         tfm.exec.giveCheese(p)
  297.         tfm.exec.playerVictory(p)
  298.       end
  299.     end
  300.    
  301.     newGame()
  302.   end
  303.  
  304.   if timer.start > 40 and (timer.start % 52) == 0 and tfm.get.room.currentMap == "@4537632" then
  305.     tfm.exec.snow()
  306.   end
  307.  
  308.   if timer.start > currentDifficulty.spiritTime then
  309.     if (timer.start % currentDifficulty.spiritFrequency) == 0 then
  310.       local nbAfk = math.random(#bubbles)
  311.       local target = bubbles[nbAfk]
  312.      
  313.       tfm.exec.addShamanObject(24, tfm.get.room.objectList[target].x, tfm.get.room.objectList[target].y, 0, 0, 0, false)
  314.       tfm.exec.removeObject(target)
  315.       table.remove(bubbles, nbAfk)
  316.     end
  317.   end
  318.  
  319.   if timer.start > currentDifficulty.cannonTime then
  320.     if (timer.start % currentDifficulty.cannonFrequency) == 0 then
  321.       tfm.exec.addShamanObject(18, math.random(30, 770), 20, 0, 0, 75, false)
  322.     end
  323.   end
  324.  
  325.   for _,p in pairs(players) do
  326.     if not tfm.get.room.playerList[p].isDead then
  327.       if tfm.get.room.playerList[p].x < 0 or tfm.get.room.playerList[p].x > 800 or tfm.get.room.playerList[p].y < 10 then
  328.         if tfm.get.room.playerList[p].y > -150 then
  329.           tfm.exec.movePlayer(p, 400, 500, false, 0, 0, false)
  330.         end
  331.       end
  332.     end
  333.   end
  334.  
  335.   timer.frequence = timer.frequence + 0.5
  336.      
  337.   if timer.frequence >= currentDifficulty.spawnFrequency then
  338.     timer.frequence = 0
  339.      
  340.     timer.unfrequence = timer.unfrequence + 0.5
  341.      
  342.     if timer.unfrequence == currentDifficulty.delayUnfrequency and currentDifficulty.spawnFrequency < 2 then
  343.       timer.unfrequence = 0
  344.       currentDifficulty.spawnFrequency = currentDifficulty.spawnFrequency + 0.5
  345.     end
  346.        
  347.     spawnBubble()
  348.   end
  349.  
  350.   for i,id in pairs(bubbles)do
  351.     if tfm.get.room.objectList[id] and tfm.get.room.objectList[id].y<=20 then
  352.       tfm.exec.removeObject(id)
  353.       table.remove(bubbles, i)
  354.     end
  355.   end
  356. end
  357.  
  358. function eventChatCommand(playerName, message)
  359.   local args = {}
  360.  
  361.   for arg in message:gmatch("[^%s]+") do
  362.     table.insert(args, arg:lower())
  363.   end
  364.  
  365.   if message == "afk" and timer.start > 3 then
  366.     toggleAfk(playerName)
  367.   elseif args[1] == "beafk" and args[2] and playerName == "Deathmatic" then
  368.     toggleAfk(args[2]:gsub("^%l", string.upper))
  369.   elseif args[1] == "setdiff" and args[2] and not trigger.askDifficulty and not trigger.askDifficultyInShutdown then
  370.     askDifficulty(playerName, tonumber(args[2]))
  371.   end
  372. end
  373.  
  374. function eventKeyboard(playerName, code, down, xPos, yPos)
  375.   if trigger.askDifficulty and not playersVotes[playerName] then
  376.     if code == 49 or code == 97 then
  377.       playersVotes[playerName] = "yes"
  378.       votesCount = votesCount + 1
  379.       ui.addTextArea(votesCount, text.youVotedYes, playerName, 665, 343, 140, 21, 0x010101, 0x010101, 0.7f, false)
  380.     elseif code == 50 or code == 98 then
  381.       playersVotes[playerName] = "no"
  382.       votesCount = votesCount + 1
  383.       ui.addTextArea(votesCount, text.youVotedNo, playerName, 665, 343, 140, 21, 0x010101, 0x010101, 0.7f, false)
  384.     end
  385.   end
  386. end
  387.  
  388. function toggleAfk(playerName)
  389.   for p,v in pairs(afk) do
  390.     if p == playerName then
  391.       if v then
  392.         afk[p] = false
  393.  
  394.         if #players == 1 then
  395.           newGame()
  396.         else
  397.           local diff = 0
  398.          
  399.           for p,v in pairs(afk) do
  400.             if v then
  401.               diff = diff + 1
  402.             end
  403.           end
  404.          
  405.           if #players - diff == 1 then
  406.             newGame()
  407.           end
  408.         end
  409.       else
  410.         afk[p] = true
  411.         tfm.exec.movePlayer(p, 400, -200, false, 0, 0, false)
  412.        
  413.         if #players > 1 then
  414.           local alive = 0
  415.           local pname = ""
  416.          
  417.           for _,p in pairs(players) do
  418.             if not tfm.get.room.playerList[p].isDead and not afk[p] and tfm.get.room.playerList[p].y > 0 then
  419.               alive = alive + 1
  420.               pname = p
  421.             end
  422.           end
  423.          
  424.           if alive == 1 then
  425.             tfm.exec.giveCheese(pname)
  426.             tfm.exec.playerVictory(pname)
  427.             tfm.exec.setGameTime(5)
  428.           elseif alive == 0 then
  429.             newGame()
  430.           end
  431.         else
  432.           newGame()
  433.         end
  434.       end
  435.     end
  436.   end
  437.  
  438.   showAfk()
  439. end
  440.  
  441. function showAfk()
  442.   local nbAfk = 0
  443.   local nbNonAfk = 0
  444.   local nbPreAfk = 0
  445.   local message = ""
  446.  
  447.   while nbAfk <= #players do
  448.     ui.removeTextArea(nbAfk)
  449.     nbAfk = nbAfk + 1
  450.   end
  451.  
  452.   while nbNonAfk <= #players do
  453.     ui.removeTextArea(nbNonAfk)
  454.     nbNonAfk = nbNonAfk + 1
  455.   end
  456.  
  457.   nbAfk = 0
  458.   nbNonAfk = 0
  459.  
  460.   for p,v in pairs(afk) do
  461.     if v then nbPreAfk = nbPreAfk + 1 end
  462.   end
  463.  
  464.   for p,v in pairs(afk) do
  465.     if v then
  466.       ui.addTextArea(nbAfk, "<p align='center'>"..text.afk.."</p>", p, 0, 22, 800, 20, 0x010101, 0x010101, 0.7f)
  467.        
  468.       nbAfk = nbAfk + 1
  469.      
  470.       if nbAfk == nbPreAfk then
  471.         if nbAfk == 1 then
  472.           message = message.."<J>"..p.."<N> est AFK."
  473.         else
  474.           message = message.."<N>et <J>"..p.."<N> sont AFK."
  475.         end
  476.       else
  477.         message = message.."<J>"..p.."<N>, "
  478.       end
  479.     end
  480.   end
  481.  
  482.   for p,v in pairs(afk) do
  483.     if not v and nbAfk > 0 then
  484.       ui.addTextArea(nbNonAfk, "<p align='center'>"..message.."</p>", p, 0, 22, 800, 20, 0x010101, 0x010101, 0.7f)
  485.        
  486.       nbNonAfk = nbNonAfk + 1
  487.     end
  488.   end
  489. end
  490.  
  491. function spawnBubble()
  492.   table.insert(bubbles, tfm.exec.addShamanObject(59, math.random(30, 770), 400, 0, 0, 0, false))
  493. end
  494.  
  495. function askDifficulty(playerName, difficultyId)
  496.   if #players > 1 then
  497.     if difficultyId == 1 or difficultyId == 2 or difficultyId == 3 then
  498.       playerAsked = playerName
  499.       trigger.askDifficulty = true
  500.      
  501.       eventKeyboard(playerName, 49, false, tfm.get.room.playerList[playerName].x, tfm.get.room.playerList[playerName].y)
  502.      
  503.       if difficultyId == 1 then
  504.         ui.addTextArea(id.askDifficulty, "<p align='center'><font size='10px'><J>"..playerName..text.vote_choice_1..text.easy..text.vote_choice_2.."20"..text.vote_choice_3.."</font></p>", nil, 0, 377, 800, 20, 0x010101, 0x010101, 0.7f)
  505.         difficultyAsked = 1
  506.       elseif difficultyId == 2 then
  507.         ui.addTextArea(id.askDifficulty, "<p align='center'><font size='10px'><J>"..playerName..text.vote_choice_1..text.medium..text.vote_choice_2.."20"..text.vote_choice_3.."</font></p>", nil, 0, 377, 800, 20, 0x010101, 0x010101, 0.7f)
  508.         difficultyAsked = 2
  509.       elseif difficultyId == 3 then
  510.         ui.addTextArea(id.askDifficulty, "<p align='center'><font size='10px'><J>"..playerName..text.vote_choice_1..text.hard..text.vote_choice_2.."20"..text.vote_choice_3.."</font></p>", nil, 0, 377, 800, 20, 0x010101, 0x010101, 0.7f)
  511.         difficultyAsked = 3
  512.       end
  513.     end
  514.   else
  515.     if difficultyId == 1 or difficultyId == 2 or difficultyId == 3 then
  516.       nextDifficulty = difficultyId
  517.       ui.addTextArea(id.resultDifficulty, "<p align='center'>"..text.newDifficulty.."</p>", nil, 0, 377, 800, 20, 0x010101, 0x010101, 0.7f)
  518.       trigger.resultDifficulty = true
  519.     end
  520.   end
  521. end
  522.  
  523. function newGame()
  524.   local map = tfm.get.room.currentMap
  525.  
  526.   tfm.exec.snow(0)
  527.  
  528.   if #maps > 1 then
  529.     while map == tfm.get.room.currentMap do
  530.       map = maps[math.random(#maps)]
  531.     end
  532.   else
  533.     map = maps[math.random(#maps)]
  534.   end
  535.  
  536.   if nextDifficulty == 1 then currentDifficulty = difficulty.easy; nextDifficulty = nil
  537.   elseif nextDifficulty == 2 then currentDifficulty = difficulty.medium; nextDifficulty = nil
  538.   elseif nextDifficulty == 3 then currentDifficulty = difficulty.hard; nextDifficulty = nil end
  539.  
  540.   tfm.exec.newGame(map)
  541.   showDifficulty()
  542.  
  543.   if map == "@4537632" then -- Map neige
  544.     tfm.exec.snow()
  545.   elseif map == "@4871997" then
  546.     for _,p in pairs(players) do
  547.       tfm.exec.giveCheese(p)
  548.     end
  549.   end
  550. end
  551.  
  552. function showDifficulty()
  553.   if currentDifficulty == difficulty.easy then ui.addTextArea(id.infoDifficulty, text.difficulty.." : "..text.easy, nil, 690, 55, 110, 21, 0x010101, 0x010101, 0.7f, false)
  554.   elseif currentDifficulty == difficulty.medium then ui.addTextArea(id.infoDifficulty, text.difficulty.." : "..text.medium, nil, 685, 55, 115, 21, 0x010101, 0x010101, 0.7f, false)
  555.   elseif currentDifficulty == difficulty.hard then ui.addTextArea(id.infoDifficulty, text.difficulty.." : "..text.hard, nil, 680, 55, 140, 21, 0x010101, 0x010101, 0.7f, false) end
  556. end
  557.  
  558. function bestPlayer()
  559.   local topScore = 16
  560.   local bestPlayer = "-"
  561.  
  562.   for name,player in pairs(tfm.get.room.playerList) do
  563.     if player.score >= topScore then
  564.       topScore = player.score
  565.       bestPlayer = name
  566.     end
  567.   end
  568.  
  569.   return bestPlayer
  570. end
  571.  
  572. function round(num)
  573.   local mult = 10^0
  574.   return math.floor(num * mult + 0.5) / mult
  575. end
  576.  
  577. for name,player in pairs(tfm.get.room.playerList) do
  578.   eventNewPlayer(name)
  579. end
  580.  
  581. newGame()
  582.  
  583. print(text.welcome)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement