Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.41 KB | None | 0 0
  1. admin = "Pvsto"
  2. teamPlayers = {
  3. {"Pvsto", "", "", "", ""};
  4. {"", "", "", "", "", ""};
  5. }
  6. goalScore = 15
  7. maps = {247329,250610,2118599,445133,149853,212903,220737,397296,2617003,629731,329627,221767,422655,417816,164931,245152,371072,2458243,214788,274963,2439335,269534,8679,321268,398041,5591416,5650343,5650250,161730,4273207,4091580,5650303,5172709,5650469,214660,3579335,4003729,508451,314205,156510,5545443,606723,3946626,332467,1665516,1614563,3679884,414899,1531388,905496,3834905,3821104,1851411,3816991,2331474,313245,266854,193588,2141379,3738767,232791,285752,278506,406266,1976857,301315,180469,3693822,280896,403698,259604,418022,323366,594883,477603,437860,590641,3688419,3682405,645288,419374,664949,704015,398942,195720,314159,613985,3683383,3683201,3680223,3680221,363625,1693705,319524,3667358,1718723,1490438,3630433,3620542,3617674,3556489,3548406,3548376,3408247,2953315,2883986,2683170,2645615,2536577,2453022,2372538,2287914,2286056,2223685,2150335,2150335,2101747,2018511,2007205,1975684,1964752,1964700,1956555,1923785,1862800,1716949,1674534,1658171,1659639,1657360,1657021,1654105,1651658,1643157,1634741,1632706,1622737,1619934,1618110,1613550,1612796,1612436,1608638,6212895,1602654,1601492,1586439,1588884,1573997,1567620,1542618,1539791,1513407,1509474,1503393,1487161,1450554,1425101,1394120,1393405,1373000,1371239,1368222,1359797,1358446,1352534,1346440,1321664,1321417,1281981,1255130,1222899,1214182,1195842,1143815,1132357,1058681,979179,829657,813156,798953,749102,737841,627609,624721,608459,616373,594049,606719,586688,580031,564033,558790,551126,545493,536235,528428,511275,508106,501711,496945,496091,483924,472665,472379,447556,445133,444490,441047,438154,436447,436107,431373,430145,429822,428517,427300,425806,424795,422361,421302,420956,420806,418658,418600,416142,412316,410813,412211,410565,410532,410230,407457,407455,407230,407165,406982,406881,406486,405295,403910,401995,401945,401778,397938,397812,397296,396861,396645,391625,387270,387180,386046,385295,386029,379745,378826,379866,364998,359055,352885,352710,350251,344952,340069,339896,339643,337774,323600,319841,317754,309029,308711,308435,306213,292348,278916,277784,275514,270819,1017676,160762,2089069,234039,267187,263163,262144,330590,403698,396105,6538564,396105,419735,6547536,355658,6607378,191716,292348,6456247,5326916,6077025,356722,2564883,1450554,494706,254291,1503393,6467947,6263285,2953315,6114281,412752,4038817,5461992,319841,359901,191716,452016,1450554,397296,250610,499684,5848412,238791,2283,232274,1716693,330590,459349,6583596,455167,6460747,251459,244888,5755208,240973,235501,235034,234039,233398,232274,230510,216735,216439,216505,214037,212542,211565,198715,193936,191716,186604,180274,176263,178657,146801,145020,3154,2283,5382692,5249500,4412890,5163891,789128,2245005,2030343,5712914,372401,5087373,4953687,2369254,4853690,226069,422509,5436200,732880,4038817,400866,3730656,3985806,355658,5175727,5699298,5588646,3921436,3639993,3984750,508796,1985019,4734427,1703617,289068,197219,333666,6077025,5710586,322321,331572,4741601,}
  8. ------------------------------------------------------------
  9. teamColor = {0xCC0000, 0x0033FF}
  10. teamScore = {0,0}
  11. gameStarted = nil
  12. gameFinished = nil
  13. currentMap = nil
  14. playersAlive = nil
  15. playersInRoom = 0
  16. players = {}
  17. team = {}
  18. first = nil
  19.  
  20. teamList = {"",""}
  21. for i=1,2 do
  22. for _,name in pairs(teamPlayers[i]) do
  23. team[name] = i
  24. teamList[i] = teamList[i] .. name .. "\n"
  25. end
  26. end
  27.  
  28. function main()
  29. tfm.exec.disableAutoNewGame(true)
  30. tfm.exec.disableAutoShaman(true)
  31. tfm.exec.disableAutoTimeLeft(true)
  32.  
  33. for name in pairs(tfm.get.room.playerList) do
  34. eventNewPlayer(name)
  35. end
  36.  
  37. tfm.exec.newGame(0)
  38.  
  39. local x = {110,690}
  40. for name,t in pairs(team) do
  41. tfm.exec.movePlayer(name, x[t], 350)
  42. end
  43. tfm.exec.movePlayer(admin, 400, 350)
  44.  
  45. ui.addTextArea(1, "<font size='16'>Equipo 1</font>\n\n"..teamList[1], nil, 30, 54, 160, 320, 0x4a4d60, 0x3a3d4b, 0.8, true)
  46. ui.addTextArea(2, "<font size='16'>Equipo 2</font>\n\n"..teamList[2], nil, 610, 54, 160, 320, 0x4a4d60, 0x3a3d4b, 0.8, true)
  47. ui.addTextArea(3, "<p align='center'><font size='16'><a href='event:start'> Empezar </a></font></p>", admin, 320, 180, 160, 32, 0x4a4d60, 0x3a3d4b, 1, true)
  48. end
  49.  
  50. function startGame()
  51. local newMap
  52. repeat
  53. newMap = math.random(#maps)
  54. until newMap ~= currentMap
  55. currentMap = newMap
  56. tfm.exec.newGame(maps[newMap])
  57. end
  58.  
  59. function endGame()
  60. startGame()
  61. end
  62.  
  63. function eventNewGame()
  64. playersAlive = playersInRoom
  65. first = false
  66.  
  67. for name,t in pairs(team) do
  68. tfm.exec.setNameColor(name, teamColor[t])
  69. end
  70.  
  71. tfm.exec.setGameTime(60)
  72. end
  73.  
  74. function eventNewPlayer(name)
  75. if team[name] then
  76. playersInRoom = playersInRoom + 1
  77. end
  78. end
  79.  
  80. function eventPlayerLeft(name)
  81. if team[name] then
  82. playersInRoom = playersInRoom - 1
  83. end
  84. end
  85.  
  86. function eventPlayerDied(name)
  87. if not gameStarted then return end
  88. if team[name] then
  89. playersAlive = playersAlive - 1
  90. checkPlayers()
  91. end
  92. end
  93.  
  94. function eventPlayerWon(name)
  95. if not gameStarted then return end
  96. if team[name] then
  97. if not first then
  98. first = true
  99. local t = team[name]
  100. teamScore[t] = teamScore[t] + 1
  101. updateScore()
  102. tfm.exec.setGameTime(5)
  103. if teamScore[t] == goalScore then
  104. gameStarted = false
  105. gameFinished = true
  106. local c = {"#F90505","#0045FF"}
  107. ui.addTextArea(5, "<p align='center'><font size='20' color='" .. c[t] .. "'>¡El equipo " .. t .. " ha ganado!</font></p>", nil, 0, 170, 800, 60, 0, 0, 0, true)
  108. end
  109. end
  110. playersAlive = playersAlive - 1
  111. checkPlayers()
  112. end
  113. end
  114.  
  115. function checkPlayers()
  116. if playersAlive == 0 then
  117. endGame()
  118. end
  119. end
  120.  
  121. function eventLoop(t, tr)
  122. if gameFinished then
  123. for i=1,8 do
  124. local x,y = math.random(0,800), math.random(0,400)
  125. for j=1,5 do
  126. tfm.exec.displayParticle(math.random(21,24), x, y, math.random(-5,5), 0, 0, math.random(10)/10, nil)
  127. end
  128. end
  129. end
  130. if not gameStarted then return end
  131. if tr <= 0 then
  132. endGame()
  133. end
  134. end
  135.  
  136. function eventTextAreaCallback(id, name, cb)
  137. if id == 3 and not gameStarted then
  138. gameStarted = true
  139. for i=1,3 do
  140. ui.removeTextArea(i)
  141. end
  142. updateScore()
  143. startGame()
  144. end
  145. end
  146.  
  147. function updateScore()
  148. local t = string.format("<p align='center'><font size='32'><font color='#F90505'>%02d</font> - <font color='#0045FF'>%02d</font></font></p>", teamScore[1], teamScore[2])
  149. ui.addTextArea(4, t, nil, 320, 20, 160, 43, 0x4a4d60, 0x3a3d4b, 0, true)
  150. end
  151.  
  152. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement