Advertisement
alditojeje

Untitled

Sep 21st, 2020
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.67 KB | None | 0 0
  1.  
  2. tfm.exec.disableAutoScore(true)
  3. tfm.exec.disableAutoShaman(true)
  4. tfm.exec.disableAutoTimeLeft(true)
  5. tfm.exec.disableAutoNewGame(true)
  6. tfm.exec.disableAfkDeath(true)
  7. tfm.exec.disablePhysicalConsumables(true)
  8.  
  9. local removerText = {}
  10. local jugadorCantidad = {}
  11. local lugares = {}
  12. tiempoJugado = 0
  13. local playerInfo = {verTimes = {}, alreadyRespawn = {}}
  14. local juego_activo = false
  15. local teams = {Team1 = {}, Team2 = {}}
  16. local puntos = {team1 = 0, team2 = 0}
  17. local respawnPlayer = {}
  18. local times = {}
  19. local bestTimes = {}
  20. local ez_maps = {
  21. 113156, 124000, 149422, 149451, 150651, 150664, 151655, 152260, 152733,
  22. 153996, 155480, 155606, 155611, 155628, 155765, 156720, 157203, 157805,
  23. 157960, 158345, 158417, 158909, 159187, 159298, 159932, 160841, 161023,
  24. 161434, 162482, 163159, 163172, 163506, 163531, 163596, 164544, 164916,
  25. 165186, 166032, 177652, 166056, 166271, 166333, 166361, 166430, 166805,
  26. 167075, 167903, 168204, 167903, 168754, 169059, 169076, 169110, 169139,
  27. 171148, 171480, 171482, 171776, 172501, 172512, 172520, 172547, 172605,
  28. 172621, 172951, 172976, 173623, 173816, 174223, 175204, 175280, 176253,
  29. 176507, 176710, 176729, 179005, 179488, 179492, 179807, 180801, 182370,
  30. 182769, 183139, 183141, 184648, 184817, 184868, 185289, 185428, 185529,
  31. 185529, 185873, 185887, 186066, 189819, 190646, 190996, 191177, 191203,
  32. 191205, 191443, 191642, 192158, 192255, 192959, 193662, 195116, 195672,
  33. 197229, 198988, 199210, 199710, 199826, 201000, 202574, 203664, 204488,
  34. 204647, 205240, 205506, 206396, 208056, 208373, 232675, 208653, 208940,
  35. 209848, 213752, 213755, 213874, 214631, 214755, 216173, 217261, 220352,
  36. 222377, 222910, 223947, 2795201, 225744, 226266, 227093, 230588, 231137,
  37. 231921, 232469, 232678, 235037, 236768, 237091, 242291, 250153, 254785,
  38. 257218, 257324, 257715, 258192258908, 259319, 261298, 261814, 263819,
  39. 263926, 264091, 268915, 270143, 270924, 271193, 271411, 159145, 272402,
  40. 272518, 272689, 277427, 277513, 514311, 277824, 279337, 281948, 282584,
  41. 284134, 286254, 289865, 2574744, 295465, 295630, 295932, 297442, 299942,
  42. 299983, 301610, 302080, 303151, 303939, 304861, 305567, 305614, 305820,
  43. 306365, 306384, 313216, 314743, 315666, 315800, 316012, 318129, 319443,
  44. 320483, 320626, 322582, 327354, 329318, 329571, 330933, 330967, 331344,
  45. 331988, 332130, 332906, 333002, 336305, 337644, 342035, 343456, 354984,
  46. 361500, 365061, 368839, 372419, 392240, 393426, 394132, 395216, 395310,
  47. 395961, 397467, 397469, 399364, 401630, 403755, 403940, 408577, 408643,
  48. 410040, 410045, 412467, 412913, 419335, 419369, 419635, 420877, 422981,
  49. 423311, 424604, 424685, 424900, 425884, 431433, 431749, 432501, 435812,
  50. 438333, 438364, 439092, 444589, 447805, 449496, 454049, 455271, 457726,
  51. 458528, 460961, 467137, 476706, 478236, 492222, 492399, 496610, 496886,
  52. 497965, 499986, 500690, 500748, 500894, 504485, 505619, 506032, 506613,
  53. 506940, 510996, 511136, 512887, 523270, 528032, 531084, 541223, 541693,
  54. 541729, 543010, 551317, 556841, 380516, 557066, 560583, 562897, 563436,
  55. 564198, 568122, 571683, 586901, 592189, 593164, 593431, 593530, 596239,
  56. 605255, 608368, 618999, 684566, 692650, 692740, 783547, 801683, 815336,
  57. 834297, 842019, 842167, 868262, 898934, 912356, 919484, 976944, 1000006,
  58. 1004622, 1014313, 1018394, 1157281, 1162831, 1164086, 1242584, 1255359,
  59. 536905, 1265789, 1266330, 1383297, 1384078, 1413528, 1427980, 1435902,
  60. 1494499, 1503203, 1526894, 1531604, 1540221, 1580356, 1580835, 1593066,
  61. 1595965, 1615753, 1615949, 1647131, 1678634, 1722755, 1733211, 1788490,
  62. 1807217, 1809410, 2040569, 2130169, 2311703, 2423300, 256899, 2520540,
  63. 2636519, 2738370, 2794566, 2989803, 3136410, 3199998, 3242049, 3908151,
  64. 4067327, 4445580, 330841, 2176211, 373105, 375455, 376704, 378704, 2252731,
  65. 1646448, 4488666, 698992, 3888888, 4627777, 528782, 192519, 159691, 158053,
  66. 3907267, 3848147, 2692883, 5517891, 7016000, 215933, 343875, 507884, 597348,
  67. 720672, 1951944, 2850177, 2918822, 3043779, 3076903, 3200001, 3483300,
  68. 3527399, 3937567, 4854539, 1893451, 5534007 ,394125,3734989,3734996,3734998,3866660,320607,3089270,170483,1852910,2998268,658960,293306,157098,178297,328351,182681,176614,229802,233971,237188,239698,242351,245908,247311,252142,255561,255776,256886,258801,259029,261784,262533,263730,265652,267589,267973,268668,268882,270650,273903,275897,277641,279502,292809,7023000,294249,295620,296518,297465}
  69. local med_maps = {
  70. 6892200, 6000050, 157004, 158345, 158417, 163094, 7288650, 3473925, 192560,
  71. 216171, 2795201, 263819, 4617716, 590775, 306655, 307324, 327743, 2914456,
  72. 372255, 391924, 392240, 397478, 3133917, 2932238, 438364, 482791, 500000,
  73. 522719, 552986, 557074, 560583, 587501, 2242899, 612415, 721319, 722837,
  74. 562897, 563436, 564198, 568122, 571683, 574183, 575497, 584783, 560526,
  75. 729863, 374995, 758595, 881158, 886744, 970919, 1046877, 1066607, 1130256,
  76. 1156092, 1226207, 1301649, 1303323, 1323048, 1333846, 1384078, 1410539,
  77. 1620703, 1955745, 1989803, 1990413, 2024960, 2178800, 2329940, 2416969,
  78. 2469365, 2788517, 2846829, 3038589, 3668888, 3690269, 3988424, 549666,
  79. 4114521, 1523082, 5960814, 1256085, 6137767, 4890068, 557132, 357892,
  80. 273373, 225484, 5000126, 6533602, 6574593, 293559, 6696038, 6600067,
  81. 4763378, 1601992, 4770120, 6774534, 4877895, 425533, 556973, 4769901,
  82. 406154, 6642996, 6675248, 223174, 6999009, 4895345, 655207, 823329, 2082776,
  83. 2309030, 2963166, 2999994, 3828508, 3976977, 4107909, 4632975, 5092739,
  84. 6593495, 6727980, 2803483, 4237910, 4538472, 3521460, 2128560, 3493490,
  85. 4362335, 2294519, 6000033, 6284671, 7196861, 7261219, 6640663, 7306627,
  86. 7324922, 6000044, 7110102, 7370291, 6931020, 7290999, 7000002, 7512725,
  87. 7598733, 6462982,3707630,1737800,3734988,3734990,3747520,3750360,3759157,3767893,3779861,3850000,3799357,6722315,3815568,3826546,3849999,3860578,3866663,3920916,355336,5263927,3958217,5342889,3964892,3969628,6304911,3976766,3999991,3999992,3999997,4000007,4000008,4000009,4027263,4241333,4039451,4058168,4093488,7024409,4121359,4333895,5132197,4317592,5134116,7091488,1972688,4337732,1568331,4295473,4234558,7005221,4249695,4413656,3820501,3999979,3939000,4484685,6609034,6022675,4644584,4311255,4697673,4000000,3295954,4365527,4313858,3530999,2758747,4594304,322649,3999110,3838020,1923584,3846632,4720851,3734984,1551020,621850,4506542,4948659,315283,3311534,4822672,6621953,6827739,5008365,5505990,5931069,187478,4000662,2395201,2941840,4948551,3142783,4220381,5473125,2605186,5616777,5761507,4398794,5914063,5706542,5340984,6546598,6045500,293658,4117513,5356911,5284625,6079100,5998000,5758150,5720741,3985463,4660408,3500000,5444444,3984871,219956,6289411,330827,366260,4000010,6041917,7134487,7319472,5933637,6450492,238951,248650,249003,250664,277665,282332,
  88. }
  89. local hard_maps = {
  90. 329200, 2417098, 654894, 1111252, 2514792, 4224188, 290824, 5994088, 2659411,2633917,1603275,1914925,4051345,3895460,4245029,
  91. }
  92. local ultra_maps = {}
  93. local time_map = 363 -- (segundos)
  94. c_ez = 2
  95. c_m = 0
  96. c_h = 0
  97. c_u = 0
  98. local puesto_1 = false
  99. local puesto_2 = false
  100. local puesto_3 = false
  101. local admin = {
  102. ["Blood#3565"] = true,
  103. ["Misterthepro#0000"] = true,
  104. ["Edudekarly#3398"] = true,
  105. ["His#0439"] = true
  106. }
  107.  
  108. local recordsActivos = {}
  109. local mapActual = ""
  110.  
  111. local mejorTiempo = " "
  112. local last_map = false
  113. local time_lobby = 666
  114. local firstMap = true
  115. local estado
  116. local new_map = false
  117. local dificultadMap = ""
  118. local cantidad_f = {}
  119. local name_cant = {}
  120.  
  121. newMap = function ()
  122. puesto_1 = false
  123. puesto_2 = false
  124. puesto_3 = false
  125.  
  126. primero = ""
  127. segundo = ""
  128. tercero = ""
  129.  
  130. for i = 31, 40 do
  131. ui.removeTextArea(i, nil)
  132. end
  133.  
  134. if c_ez == 0 and c_m == 0 and c_h == 0 and c_u == 0 then
  135. addpoints_time(times)
  136. if #times >= 1 then
  137. table.insert(bestTimes, {
  138. mapa = times[1].mapa,
  139. time = times[1].time,
  140. name = times[1].name
  141. })
  142. end
  143. last_map = true
  144. end
  145.  
  146. if last_map then
  147. tfm.exec.newGame(7692692)
  148. time_map = 1234567
  149. cantidades_mapa()
  150. cantidades_finales(name_cant)
  151. tfm.exec.setGameTime(time_map)
  152. estadisticasFinales()
  153. juego_activo = false
  154.  
  155. elseif not map_bc_actual then
  156. mejorTiempo = " "
  157. times = {}
  158. str = "\n<textformat tabstops='[70, 170, 300]'>"
  159. lugares = {}
  160.  
  161. juego_activo = true
  162. map_bc_actual = true
  163. math.randomseed(os.time())
  164. if c_ez ~= 0 then
  165. estado = 1
  166. local map = ez_maps[math.random(#ez_maps)]
  167. tfm.exec.newGame(map)
  168. -- tfm.exec.newGame('#13')
  169. c_ez = c_ez - 1
  170. dificultadMap = "<font color='#00C17C'>Fácil</font>"
  171. elseif c_m ~= 0 then
  172. estado = 2
  173. local map = med_maps[math.random(#med_maps)]
  174. tfm.exec.newGame(map)
  175. c_m = c_m - 1
  176. dificultadMap = "<font color='#EBC244'>Medio</font>"
  177. elseif c_h ~= 0 then
  178. estado = 3
  179. local map = hard_maps[math.random(#hard_maps)]
  180. tfm.exec.newGame(map)
  181. dificultadMap = "<font color='#F93018'>Difícil</font>"
  182. -- print(time_map) --
  183. c_h = c_h - 1
  184.  
  185. elseif c_u ~= 0 then
  186. estado = 4
  187. local map = ultra_maps[math.random(#ultra_maps)]
  188. tfm.exec.newGame(map)
  189. dificultadMap = "<font color='#F93018'>Ultra</font>"
  190. c_u = c_u - 1
  191. -- else
  192. end
  193. for p, v in pairs(tfm.get.room.playerList) do
  194. if jugador_activo(p, lista_A) == false and
  195. jugador_activo(p, lista_B) == false then
  196. tfm.exec.killPlayer(p)
  197. end
  198. end
  199.  
  200. else
  201. juego_activo = true
  202. tfm.exec.newGame(7692692)
  203. -- tfm.exec.setGameTime(7)
  204. map_bc_actual = false
  205.  
  206. addpoints_time(times)
  207.  
  208. recordsLobby()
  209. if #times >= 1 then
  210. table.insert(bestTimes, {
  211. mapa = times[1].mapa,
  212. time = times[1].time,
  213. name = times[1].name
  214. })
  215. end
  216. end
  217. end
  218.  
  219. --function puntuacion_final()
  220.  
  221. --end
  222.  
  223.  
  224. estadisticasFinales = function()
  225.  
  226. -- equipo ganador --
  227. equipoGanador = ""
  228. if puntos.team1 > puntos.team2 then
  229. equipoGanador = "<font color = '#CB546B'>Team Red Wins</font>"
  230. elseif puntos.team1 < puntos.team2 then
  231. equipoGanador = "<font color = '#2F7FCC'>Team Blue Wins</font>"
  232. else
  233. equipoGanador = "<font color='#00C17C'>Empate jajaencerio</font>"
  234. end
  235. -- fin equipo ganador
  236.  
  237. -- mejores tiempos --
  238. mejoresTiempos = "\n<textformat tabstops='[75, 280]'>"
  239. for i, completion in ipairs(bestTimes) do
  240. if jugador_activo(completion.name, teams.Team1) then
  241. jugador = "<font color = '#CB546B'>" .. completion.name .. "</font>"
  242. elseif jugador_activo(completion.name, teams.Team2) then
  243. jugador = "<font color = '#2F7FCC'>" .. completion.name .. "</font>"
  244. end
  245. mejoresTiempos = mejoresTiempos ..
  246. ("<font color='#00C17C'>@" .. completion.mapa ..
  247. '</font>' .. "\t " .. jugador .. '\t ' ..
  248. " <font color='#00C17C'> " .. completion.time ..
  249. 's</font>\n')
  250. end
  251. mejoresTiempos = mejoresTiempos .. '</textformat>'
  252. -- fin mejores tiempos -
  253.  
  254. -- mejor jugador
  255. scoreTop = -1
  256. nombreTop = ""
  257. for name, p in pairs(tfm.get.room.playerList) do
  258. if p.score + 1 > scoreTop then
  259. scoreTop = p.score + 1
  260. nombreTop = name
  261. end
  262. end
  263. if jugador_activo(nombreTop, teams.Team1) then
  264. nombreTop = "<font color = '#CB546B'>" .. nombreTop .. "</font>"
  265. elseif jugador_activo(nombreTop, teams.Team2) then
  266. nombreTop = "<font color = '#2F7FCC'>" .. nombreTop .. "</font>"
  267. end
  268.  
  269. -- fin mejor jugador
  270.  
  271. -- cantidades
  272. jugadorCantidades = "\n<textformat tabstops='[150]'>"
  273. for i, cantidades in ipairs(cantidad_f) do
  274. if jugador_activo(cantidades.nom, teams.Team1) then
  275. jugadorCantidades = jugadorCantidades .. "<font color = '#CB546B'>" .. cantidades.nom .. "\t</font>" .. "<font color='#00C17C'> " .. cantidades.c .. "</font>\n"
  276. elseif jugador_activo(cantidades.nom, teams.Team2) then
  277. jugadorCantidades = jugadorCantidades .."<font color = '#2F7FCC'>" .. cantidades.nom .. "\t</font>" .. "<font color='#00C17C'> " .. cantidades.c .. "</font>\n"
  278. end
  279. end
  280.  
  281. -- fin cantidads
  282.  
  283.  
  284. texto = "<textformat tabstops='[310, 550]'><p align='left'>" .. nombreTop .. " MVP\t" .. equipoGanador .. "\t<font color='#CB546B'><b>Red: " .. puntos.team1 .. "<font color='#2F7FCC'> Blue: " .. puntos.team2
  285.  
  286. ui.addTextArea(31, "<p align='center'><font size ='16' color='#00C17C'><b>Estadísticas Finales\n\n\n\n\n\n\n\n\n\n\n\n" .. texto, nil, 20, 127, 760, 260, 0x1E1E1E, 0x121212, 1, true)
  287. ui.addTextArea(32, "<p align='center'><font size ='15' color='#00C17C'><b>Cantidades Totales</b></font></p>" .. jugadorCantidades, nil, 35, 160, 350, 170, 0x2B2B2B, 0x2B2B2B, 1, true)
  288. ui.addTextArea(33, "<p align='center'><font size ='15' color='#00C17C'><b>Mejores Tiempos</b></font></p>" .. mejoresTiempos, nil, 415, 160, 350, 170, 0x2B2B2B, 0x2B2B2B, 1, true)
  289.  
  290. end
  291.  
  292. eventNewGame = function()
  293. if juego_activo then mapActual = tfm.get.room.xmlMapInfo.mapCode end
  294.  
  295. for name in pairs(tfm.get.room.playerList) do colores(name) end
  296.  
  297. if map_bc_actual or new_map then
  298. ui.removeTextArea(40, player)
  299. ui.removeTextArea(41, player)
  300. tfm.exec.setGameTime(time_map)
  301. else
  302. tfm.exec.setGameTime(time_lobby)
  303. end
  304.  
  305. if firstMap then
  306. firstMap = false
  307. tfm.exec.setGameTime(10000)
  308. end
  309.  
  310. end
  311.  
  312. eventNewPlayer = function(player)
  313. respawnPlayer[player] = os.time()
  314. playerInfo.verTimes[player] = false
  315. teclas(player)
  316. end
  317.  
  318. teclas = function(player)
  319. tfm.exec.bindKeyboard(player, 76, false, true)
  320. tfm.exec.bindKeyboard(player, 46, false, true)
  321. tfm.exec.bindKeyboard(player, 16, false, true)
  322. tfm.exec.bindKeyboard(player, 80, false, true)
  323. end
  324.  
  325. for player in next, tfm.get.room.playerList do
  326. eventNewPlayer(player)
  327. playerInfo.verTimes[player] = false
  328. teclas(player)
  329. end
  330.  
  331. eventPlayerDied = function(player) respawnPlayer[player] = os.time() end
  332.  
  333. setNewMap = function()
  334. math.randomseed(os.time())
  335. if estado == 1 then
  336. local map = ez_maps[math.random(#ez_maps)]
  337. tfm.exec.newGame(map)
  338. elseif estado == 2 then
  339. local map = med_maps[math.random(#med_maps)]
  340. tfm.exec.newGame(map)
  341. elseif estado == 3 then
  342. local map = hard_maps[math.random(#hard_maps)]
  343. tfm.exec.newGame(map)
  344. elseif estado == 4 then
  345. local map = ultra_maps[math.random(#utra_maps)]
  346. tfm.exec.newGame(map)
  347. end
  348. end
  349.  
  350. eventLoop = function(elapsedTime, remaining)
  351. tiempoJugado = elapsedTime
  352. if new_map then
  353. setNewMap()
  354. new_map = false
  355. end
  356.  
  357. if remaining < 500 then newMap() end
  358.  
  359. for i, n in pairs(respawnPlayer) do
  360. if n <= os.time() - 1000 then
  361. lista_A = teams.Team1
  362. lista_B = teams.Team2
  363. if jugador_activo(i, lista_A) or jugador_activo(i, lista_B) then
  364. tfm.exec.respawnPlayer(i)
  365. colores(i)
  366. end
  367. end
  368. end
  369.  
  370. if juego_activo then
  371. minutos = "0" .. math.floor((remaining / 1000) / 60)
  372. segundos = math.floor(remaining / 1000) % 60
  373. if segundos <= 9 then segundos = "0" .. segundos end
  374. if #times >= 1 then
  375. mejorTiempo = times[1].name .. " " .. times[1].time .. "s"
  376. end
  377.  
  378. for i, n in pairs(removerText) do
  379. if n <= os.time() - 2000 then ui.removeTextArea(69, i) end
  380. end
  381. if (time_map == 1234567) then
  382. tfm.exec.setUIMapName(
  383. " <font color='#CB546B'>Red: " ..
  384. puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
  385. puntos.team2 .. "</font>\t|\t" .. "\t\t" .. "\n")
  386. else
  387. tfm.exec.setUIMapName(dificultadMap .. " <font color='#CB546B'>Red: " ..
  388. puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
  389. puntos.team2 .. "</font>\t|\t" .. minutos .. ":" .. segundos ..
  390. "\t|\t" .. mejorTiempo .. "\n")
  391. end
  392. end
  393. end
  394.  
  395. eventChatCommand = function(playerName, command)
  396. local args = {}
  397.  
  398. for arg in command:gmatch("[^%s]+") do table.insert(args, arg) end
  399. -- comandos para admins:
  400. if admin[playerName] then
  401. if args[1] == "team1" then -- y sigue con team1
  402. teams.Team1 = {}
  403. local k = 0
  404. for i = 2, #args do -- recorre toda la tabla args
  405. for j = 1, #teams.Team2 do -- recorre toda la tabla teams2
  406. if args[i] == teams.Team2[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
  407. table.remove(teams.Team2, j)
  408. end
  409. end
  410. if not jugador_activo(args[i], teams.Team1) then
  411. k = k + 1
  412. teams.Team1[k] = args[i]
  413. colores(args[i])
  414. end
  415. end -- fin for #args
  416. if juego_activo == false then grafico() end
  417. elseif args[1] == "team2" then -- y sigue con team2
  418. teams.Team2 = {}
  419. local k = 0
  420. for i = 2, #args do -- recorre toda la tabla args
  421. for j = 1, #teams.Team1 do -- recorre toda la tabla teams2
  422. if args[i] == teams.Team1[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
  423. table.remove(teams.Team1, j)
  424. end
  425. end
  426. if not jugador_activo(args[i], teams.Team2) then
  427. k = k + 1
  428. teams.Team2[k] = args[i]
  429. colores(args[i])
  430. end
  431. end -- fin for #args
  432. if juego_activo == false then grafico() end
  433.  
  434. elseif args[1] == "add" then
  435. if args[2] == "team1" then
  436. local k = #teams.Team1
  437. for i = 3, #args do -- recorre toda la tabla args
  438. for j = 1, #teams.Team2 do -- recorre toda la tabla teams2
  439. if args[i] == teams.Team2[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
  440. table.remove(teams.Team2, j)
  441. end
  442. end
  443. if not jugador_activo(args[i], teams.Team1) then
  444. k = k + 1
  445. teams.Team1[k] = args[i]
  446. colores(args[i])
  447. end
  448. end
  449. elseif args[2] == "team2" then
  450. local k = #teams.Team2
  451. for i = 3, #args do -- recorre toda la tabla args
  452. for j = 1, #teams.Team1 do -- recorre toda la tabla teams2
  453. if args[i] == teams.Team1[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
  454. table.remove(teams.Team1, j)
  455. end
  456. end
  457. if not jugador_activo(args[i], teams.Team2) then
  458. k = k + 1
  459. teams.Team2[k] = args[i]
  460. colores(args[i])
  461. end
  462. end
  463. end -- fin if add
  464.  
  465. if juego_activo == false then grafico() end
  466.  
  467. elseif args[1] == "records" then
  468. if recordsActivos[playerName] then
  469. recordsActivos[playerName] = false
  470. else
  471. recordsActivos[playerName] = true
  472. end
  473. verRecords(playerName)
  474.  
  475. elseif args[1] == "time" then
  476. tfm.exec.setGameTime(3)
  477. elseif args[1] == "fix" then
  478. tfm.exec.setGameTime(time_map - 3) -- le restamos los 3s del respawn
  479. elseif args[1] == "map" and juego_activo then
  480. new_map = true
  481. elseif args[1] == "mapas" then
  482. if tonumber(args[3]) ~= nil then
  483. if args[2] == "ez" then
  484. c_ez = tonumber(args[3])
  485. elseif args[2] == "med" then
  486. c_m = tonumber(args[3])
  487. elseif args[2] == "hard" then
  488. c_h = tonumber(args[3])
  489. elseif args[2] == "ultra" then
  490. c_u = tonumber(args[3])
  491. end
  492. cantidadMaps()
  493. end
  494. elseif args[1] == "t" then
  495. if tonumber(args[3]) ~= nil then
  496. if args[2] == "mapas" then
  497. time_map = tonumber(args[3])
  498. elseif args[2] == "lobby" then
  499. time_lobby = tonumber(args[3])
  500. end
  501. cantidadMaps()
  502. end
  503. end
  504. end -- admin[playername]
  505.  
  506. -- COMANDOS PARA NO ADMINS:
  507. if args[1] == "vertimes" then
  508. if playerInfo.verTimes[playerName] == false then
  509. playerInfo.verTimes[playerName] = true
  510. else
  511. playerInfo.verTimes[playerName] = false
  512. end
  513. end
  514. end
  515.  
  516. add_points = function(playerName, p)
  517. if jugador_activo(playerName, teams.Team1) then
  518. puntos.team1 = puntos.team1 + p
  519. elseif jugador_activo(playerName, teams.Team2) then
  520. puntos.team2 = puntos.team2 + p
  521. end
  522. end
  523.  
  524. eventPlayerWon = function (playerName, tiempoRonda, tiempoRespawn)
  525.  
  526. if puesto_1 == false then
  527. table.insert(lugares, {name = playerName, puesto = 1})
  528. puesto_1 = true
  529. tfm.exec.setPlayerScore(playerName, 4, true)
  530. add_points(playerName, 4)
  531. elseif puesto_2 == false then
  532. table.insert(lugares, {name = playerName, puesto = 2})
  533. puesto_2 = true
  534. tfm.exec.setPlayerScore(playerName, 3, true)
  535. add_points(playerName, 3)
  536.  
  537. elseif puesto_3 == false then
  538. table.insert(lugares, {name = playerName, puesto = 3})
  539. puesto_3 = true
  540. tfm.exec.setPlayerScore(playerName, 2, true)
  541. add_points(playerName, 2)
  542.  
  543. else
  544. tfm.exec.setPlayerScore(playerName, 1, true)
  545. add_points(playerName, 1)
  546. end
  547.  
  548. if playerInfo.verTimes[playerName] then
  549. if jugador_activo(playerName, teams.Team1) then
  550. ui.addTextArea(69,
  551. "<b><font size ='15' color='#CB546B'>" .. playerName ..
  552. "</font> <font size ='15'>" .. tiempoRespawn /
  553. 100 .. "s</font>", playerName, 9, 368, 0, 0,
  554. 0x2B2B2B, 0, 0.7, true)
  555. elseif jugador_activo(playerName, teams.Team2) then
  556. ui.addTextArea(69,
  557. "<b><font size ='15' color='#2F7FCC'>" .. playerName ..
  558. "</font> <font size ='15'>" .. tiempoRespawn /
  559. 100 .. "s</font>", playerName, 9, 368, 0, 0,
  560. 0x2B2B2B, 0, 0.7, true)
  561. end
  562. removerText[playerName] = os.time()
  563. end
  564.  
  565. str = "\n<textformat tabstops='[70, 170, 300]'>"
  566.  
  567. table.insert(times, {
  568. time = tiempoRespawn / 100,
  569. name = playerName,
  570. mapa = mapActual
  571. })
  572. if not playerInfo.alreadyRespawn[playerName] then
  573. times[#times].time = times[#times].time - 3
  574. end
  575. table.sort(times, function(i, v) return i.time < v.time end)
  576. for i, jugadores in ipairs(times) do
  577. if jugador_activo(jugadores.name, teams.Team1) then
  578. jugador = "<font color = '#CB546B'>" .. jugadores.name .. "</font>"
  579. elseif jugador_activo(jugadores.name, teams.Team2) then
  580. jugador = "<font color = '#2F7FCC'>" .. jugadores.name .. "</font>"
  581. end
  582.  
  583. if i <= 15 then
  584. if i < 10 then i = 0 .. i end
  585. str = str ..
  586. (i .. ' | ' .. jugador .. '\t| ' ..
  587. jugadores.time .. 's\n')
  588. end
  589. end
  590. str = str .. '</textformat>'
  591. for player, p in pairs(tfm.get.room.playerList) do verRecords(player) end
  592.  
  593. end
  594.  
  595. eventKeyboard = function(player, key, down, x, y)
  596. if key == 76 then
  597. if recordsActivos[player] then
  598. recordsActivos[player] = false
  599. else
  600. recordsActivos[player] = true
  601. end
  602. verRecords(player)
  603. elseif key == 46 or key == 16 then
  604. tfm.exec.killPlayer(player)
  605.  
  606. elseif key == 80 then
  607. if playerInfo.verTimes[player] == false then
  608. playerInfo.verTimes[player] = true
  609. else
  610. playerInfo.verTimes[player] = false
  611. end
  612. end
  613. end
  614.  
  615. colores = function (playerName)
  616. if jugador_activo(playerName, teams.Team1) then
  617. tfm.exec.setNameColor(playerName, 0xCB546B)
  618. elseif jugador_activo(playerName, teams.Team2) then
  619. tfm.exec.setNameColor(playerName, 0x2F7FCC)
  620. end
  621. end
  622.  
  623. jugador_activo = function(player, L) -- L lista de jugadores --
  624. for _, v in pairs(L) do if player == v then return true end end
  625. return false
  626. end
  627.  
  628. verRecords = function(player)
  629. if recordsActivos[player] then
  630. ui.addTextArea(40, str, player, 275, 80, 250, 200, 0x2B2B2B, 0x121212,
  631. 1, true)
  632. ui.addTextArea(41,
  633. "<p align='center'><font size ='13' color='#00C17C'><b>Tiempos",
  634. player, 352, 65, 100, 20, 0x2B2B2B, 0x121212, 1, true)
  635. else
  636. ui.removeTextArea(40, player)
  637. ui.removeTextArea(41, player)
  638. end
  639. end
  640.  
  641.  
  642. recordsLobby = function()
  643. jugador = "\n\n"
  644. jugadoresTimes = "\n<textformat tabstops='[175]'>"
  645. jugadorCantidad = {}
  646. jugadoresCantidad = "\n<textformat tabstops='[175]'>"
  647.  
  648. table.sort(lugares, function(i, v) return i.puesto < v.puesto end)
  649. for i, nombreJugador in ipairs(lugares) do
  650. if jugador_activo(nombreJugador.name, teams.Team1) then
  651. jugador = jugador .. "<font color='#00C17C'>" .. "0" .. nombreJugador.puesto .. "</font> " .. "<font color = '#CB546B'>" .. nombreJugador.name .. "</font>\n"
  652. elseif jugador_activo(nombreJugador.name, teams.Team2) then
  653. jugador = jugador .. "<font color='#00C17C'>" .. "0" .. nombreJugador.puesto .. "</font> " .. "<font color = '#2F7FCC'>" .. nombreJugador.name .. "</font>\n"
  654. end
  655. end
  656.  
  657. for i = 1, recorrerTimes() do
  658. if jugador_activo(times[i].name, teams.Team1) then
  659. jugadoresTimes = jugadoresTimes .. "<font color='#CB546B'>" .. times[i].name .. "\t</font><font color = '#00C17C'>" .. times[i].time .. "s</font>\n"
  660. elseif jugador_activo(times[i].name, teams.Team2) then
  661. jugadoresTimes = jugadoresTimes .. "<font color='#2F7FCC'>" .. times[i].name .. "\t</font><font color = '#00C17C'>" .. times[i].time .. "s</font>\n"
  662. end
  663. end
  664.  
  665. cantidades_mapa()
  666. cantidades_finales(name_cant)
  667.  
  668. for i, jugadorNombre in ipairs(name_cant) do
  669. if jugador_activo(jugadorNombre.nombre, teams.Team1) then
  670. jugadoresCantidad = jugadoresCantidad .. "<font color='#CB546B'>" .. jugadorNombre.nombre .. "\t</font><font color = '#00C17C'>" .. jugadorNombre.cantidad .. "</font>\n"
  671. elseif jugador_activo(jugadorNombre.nombre, teams.Team2) then
  672. jugadoresCantidad = jugadoresCantidad .. "<font color='#2F7FCC'>" .. jugadorNombre.nombre .. "\t</font><font color = '#00C17C'>" .. jugadorNombre.cantidad .. "</font>\n"
  673. end
  674. end
  675.  
  676.  
  677. ui.addTextArea(31, "<p align='center'> <font size ='16' color='#00C17C'><b>Estadísticas", nil, 20, 137, 760, 220, 0x1E1E1E, 0x121212,
  678. 1, true)
  679. ui.addTextArea(32, "<p align='center'><font size ='15' color='#00C17C'><b>Primeros Puestos</b></font>" .. jugador, nil, 35, 170, 230, 170, 0x2B2B2B, 0x2B2B2B, 1, true)
  680. ui.addTextArea(33, "<p align='center'><font size ='15' color='#00C17C'><b>Cantidades</b></font></p>" .. jugadoresCantidad, nil, 285, 170, 230, 170, 0x2B2B2B, 0x2B2B2B, 1, true)
  681. ui.addTextArea(34, "<p align='center'><font size ='15' color='#00C17C'><b>Tiempos</b></font></p>" .. jugadoresTimes, nil, 535, 170, 230, 170, 0x2B2B2B, 0x2B2B2B, 1, true)
  682.  
  683. end
  684.  
  685. cantidades_mapa = function()
  686. local cont = 1
  687. local cont_ult
  688. local names = {}
  689. name_cant = {}
  690. local canti = {}
  691.  
  692. for i = 1, #times do
  693. table.insert(names, times[i].name)
  694. end
  695.  
  696. table.sort(names, function(a,b) return a < b end)
  697.  
  698. for i = 1 , #names do
  699. if i+1 > #names or names[i] ~= names[i+1] then
  700. table.insert(name_cant, {nombre = names[i], cantidad = cont})
  701. cont = 1
  702. else
  703. cont = cont + 1
  704. end
  705. end
  706. end
  707.  
  708.  
  709. cantidades_finales = function(C) -- C array de personas que completaron el mapa
  710. local nom = {}
  711.  
  712. if #cantidad_f == 0 then
  713. for i = 1, #C do
  714. table.insert(cantidad_f, {nom = C[i].nombre, c = C[i].cantidad})
  715. end
  716.  
  717. else
  718. for i = 1, #cantidad_f do
  719. table.insert(nom, cantidad_f[i].nom)
  720. end
  721.  
  722. for i=1, #C do
  723. if not jugador_activo(C[i].nombre, nom) then
  724. table.insert(cantidad_f, {nom = C[i].nombre, c = C[i].cantidad})
  725. else
  726. for j=1, #cantidad_f do
  727. if cantidad_f[j].nom == C[i].nombre then
  728. cantidad_f[j].c = cantidad_f[j].c + C[i].cantidad
  729. end
  730. end
  731. end
  732. end
  733. end
  734. end
  735.  
  736.  
  737. recorrerTimes = function ()
  738. if #times >= 3 then
  739. return 3
  740. elseif #times == 2 then
  741. return 2
  742. elseif #times == 1 then
  743. return 1
  744. else
  745. return 0
  746. end
  747. end
  748.  
  749.  
  750. --
  751. rcorrer_times = function(L, cantidad_times)
  752. local t = 4
  753. for i = 1, cantidad_times, 1 do
  754. add_points(L[i].name, t)
  755. tfm.exec.setPlayerScore(L[i].name, t, true)
  756. t = t / 2
  757. end
  758. end
  759.  
  760. addpoints_time = function (L)
  761. if #L >= 3 then
  762. rcorrer_times(L, 3)
  763. elseif #L == 2 then
  764. rcorrer_times(L, 2)
  765. elseif #L == 1 then
  766. rcorrer_times(L, 1)
  767. end
  768. end
  769.  
  770. establecerEquipos = function()
  771. teams.Team1 = {}
  772. teams.Team2 = {}
  773. local equipo = 1
  774. local jugadoresTotal = {}
  775. for name, p in pairs(tfm.get.room.playerList) do
  776. table.insert(jugadoresTotal, name)
  777. end
  778. for i = 1, #jugadoresTotal do
  779. numJugador = math.random(#jugadoresTotal)
  780. agregarJugador = jugadoresTotal[numJugador]
  781. table.remove(jugadoresTotal, numJugador)
  782. if equipo == 1 then
  783. table.insert(teams.Team1, agregarJugador)
  784. equipo = 2
  785. elseif equipo == 2 then
  786. table.insert(teams.Team2, agregarJugador)
  787. equipo = 1
  788. end
  789. end
  790. grafico()
  791. end
  792.  
  793. establecerPuntos = function()
  794. for name in pairs(tfm.get.room.playerList) do
  795. tfm.exec.setPlayerScore(name, 0)
  796. end
  797. end
  798.  
  799. eventTextAreaCallback = function (id, player, callback)
  800. if admin[player] then
  801. if callback == 'iniciarJuego' and tiempoJugado >= 3383 then
  802. for i = 661, 671 do ui.removeTextArea(i) end
  803. establecerPuntos()
  804. newMap()
  805. elseif callback == 'equiposRandom' then
  806. establecerEquipos()
  807. colores()
  808. elseif callback == 'vaciarTeams' then
  809. teams.Team1 = {}
  810. teams.Team2 = {}
  811. grafico()
  812. end
  813. end
  814. end
  815.  
  816. grafico = function ()
  817. ui.addTextArea(668, "", nil, 300, 143, 200, 13, 0x2B2B2B, 0x121212, 0.7,
  818. true)
  819. ui.addTextArea(662, "", nil, 300, 243, 200, 13, 0x2B2B2B, 0x121212, 0.7,
  820. true)
  821. ui.addTextArea(666, "<p align='center'><font color='#CB546B'>" ..
  822. (table.concat(teams.Team1, "\n") or ""), nil, 150, 140,
  823. 175, 200, 0x2B2B2B, 0x121212, 1, true)
  824. ui.addTextArea(667, "<p align='center'><font color='#2F7FCC'>" ..
  825. (table.concat(teams.Team2, "\n") or ""), nil, 450, 140,
  826. 175, 200, 0x2B2B2B, 0x121212, 1, true)
  827. ui.addTextArea(664, "<p align='center'><font color='#CB546B'><b>Team 1",
  828. nil, 143, 115, 190, 20, 0x2B2B2B, 0x121212, 1, true)
  829. ui.addTextArea(665, "<p align='center'><font color='#2F7FCC'><b>Team 2",
  830. nil, 443, 115, 190, 20, 0x2B2B2B, 0x121212, 1, true)
  831. ui.addTextArea(661,
  832. "<p align='center'><V><a href='event:iniciarJuego'><font color='#F93018'><b>Iniciar",
  833. nil, 363, 140, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  834. ui.addTextArea(663, "", nil, 290, 343, 200, 13, 0x2B2B2B, 0x121212, 1, true)
  835. ui.addTextArea(669,
  836. "<p align='center'><V><a href='event:equiposRandom'><font color='#00C17C'><b>Llenar",
  837. nil, 463, 341, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  838. ui.addTextArea(670,
  839. "<p align='center'><V><a href='event:vaciarTeams'><font color='#00C17C'><b>Vaciar",
  840. nil, 263, 341, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  841. end
  842.  
  843. cantidadMaps = function()
  844. if juego_activo == false then
  845. for name in pairs(admin) do
  846. ui.addTextArea(671,
  847. "<b><font color='#00C17C' size ='12'>Ez Maps " ..
  848. c_ez ..
  849. "</font>\n<font color='#EBC244' size ='12'>Med Maps " ..
  850. c_m ..
  851. "</font>\n<font color='#CB546B' size ='12'>Hard Maps " ..
  852. c_h ..
  853. "</font>\n<font color='#F93018' size ='12'>Ult Maps " ..
  854. c_u ..
  855. "</font>\n\n<BV><font size ='12'>Time Map " ..
  856. time_map .. "\nTime Lob " .. time_lobby, name,
  857. 10, 143, 100, 0, 0x2B2B2B, 0x121212, 0.7, true)
  858. end
  859. end
  860. end
  861.  
  862. main = function ()
  863. tfm.exec.newGame(7692636)
  864. grafico()
  865. tfm.exec.setGameTime(10000)
  866. cantidadMaps()
  867. end
  868.  
  869. main()
  870.  
  871. eventPlayerRespawn = function(playerName) playerInfo.alreadyRespawn[playerName] = true end
  872. -- @306365 @1722755
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement