Advertisement
alditojeje

Untitled

Mar 29th, 2020
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.27 KB | None | 0 0
  1. -- chocha
  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. -- te observo ^-^
  9. local removerText = {}
  10. local jugadorCantidad = {}
  11. local lugares = {}
  12.  
  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. -- local mapa_bc_actual = false LA QUE USAMOS SE LLAMA MAP_BC_ACTUAL LOL XD -- LOOOOOOOOOOOOL
  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 cantidades_f_nombre = {}
  119. ---te amo---
  120. --- uwu --
  121.  
  122. function newMap()
  123. puesto_1 = false
  124. puesto_2 = false
  125. puesto_3 = false
  126.  
  127. primero = ""
  128. segundo = ""
  129. tercero = ""
  130.  
  131. for i = 31, 40 do
  132. ui.removeTextArea(i, nil)
  133. end
  134.  
  135. if c_ez == 0 and c_m == 0 and c_h == 0 and c_u == 0 then
  136. addpoints_time(times)
  137.  
  138. if #times >= 1 then
  139. table.insert(bestTimes, {
  140. mapa = times[1].mapa,
  141. time = times[1].time,
  142. name = times[1].name
  143. })
  144. end
  145. last_map = true
  146. end
  147.  
  148. if last_map then
  149. tfm.exec.newGame(7692692)
  150. time_map = 1234567
  151. tfm.exec.setGameTime(time_map)
  152. estadisticasFinales()
  153. -- puntuacion_final()
  154. juego_activo = false
  155.  
  156. elseif not map_bc_actual then
  157. mejorTiempo = " "
  158. times = {}
  159. str = "\n<textformat tabstops='[70, 170, 300]'>"
  160. lugares = {}
  161.  
  162. juego_activo = true
  163. map_bc_actual = true
  164.  
  165. math.randomseed(os.time())
  166. if c_ez ~= 0 then
  167. estado = 1
  168. local map = ez_maps[math.random(#ez_maps)]
  169. tfm.exec.newGame(map)
  170. -- tfm.exec.newGame('#13')
  171. c_ez = c_ez - 1
  172. dificultadMap = "<font color='#00C17C'>Fácil</font>"
  173. elseif c_m ~= 0 then
  174. estado = 2
  175. local map = med_maps[math.random(#med_maps)]
  176. tfm.exec.newGame(map)
  177. c_m = c_m - 1
  178. dificultadMap = "<font color='#EBC244'>Medio</font>"
  179. elseif c_h ~= 0 then
  180. estado = 3
  181. local map = hard_maps[math.random(#hard_maps)]
  182. tfm.exec.newGame(map)
  183. dificultadMap = "<font color='#F93018'>Difícil</font>"
  184. -- print(time_map) --
  185. c_h = c_h - 1
  186.  
  187. elseif c_u ~= 0 then
  188. estado = 4
  189. local map = ultra_maps[math.random(#ultra_maps)]
  190. tfm.exec.newGame(map)
  191. dificultadMap = "<font color='#F93018'>Ultra</font>"
  192. c_u = c_u - 1
  193. -- else
  194. end
  195. for p, v in pairs(tfm.get.room.playerList) do
  196. if jugador_activo(p, lista_A) == false and
  197. jugador_activo(p, lista_B) == false then
  198. tfm.exec.killPlayer(p)
  199. end
  200. end
  201.  
  202. else
  203. juego_activo = true
  204. tfm.exec.newGame(7692692)
  205. -- tfm.exec.setGameTime(7)
  206. map_bc_actual = false
  207.  
  208. addpoints_time(times)
  209.  
  210. recordsLobby()
  211. if #times >= 1 then
  212. table.insert(bestTimes, {
  213. mapa = times[1].mapa,
  214. time = times[1].time,
  215. name = times[1].name
  216. })
  217. end
  218. end
  219. end
  220.  
  221. --function puntuacion_final()
  222.  
  223. --end
  224.  
  225.  
  226. function estadisticasFinales()
  227.  
  228. -- equipo ganador --
  229. equipoGanador = ""
  230. if puntos.team1 > puntos.team2 then
  231. equipoGanador = "<font color = '#CB546B'>Team Red Wins</font>"
  232. elseif puntos.team1 < puntos.team2 then
  233. equipoGanador = "<font color = '#2F7FCC'>Team Blue Wins</font>"
  234. else
  235. equipoGanador = "<font color='#00C17C'>Empate jajaencerio</font>"
  236. end
  237. -- fin equipo ganador
  238.  
  239. -- mejores tiempos --
  240. mejoresTiempos = "\n<textformat tabstops='[75, 280]'>"
  241. for i, completion in ipairs(bestTimes) do
  242. if jugador_activo(completion.name, teams.Team1) then
  243. jugador = "<font color = '#CB546B'>" .. completion.name .. "</font>"
  244. elseif jugador_activo(completion.name, teams.Team2) then
  245. jugador = "<font color = '#2F7FCC'>" .. completion.name .. "</font>"
  246. end
  247. mejoresTiempos = mejoresTiempos ..
  248. ("<font color='#00C17C'>@" .. completion.mapa ..
  249. '</font>' .. "\t " .. jugador .. '\t ' ..
  250. " <font color='#00C17C'> " .. completion.time ..
  251. 's</font>\n')
  252. end
  253. mejoresTiempos = mejoresTiempos .. '</textformat>'
  254. -- fin mejores tiempos -
  255.  
  256. -- mejor jugador
  257. scoreTop = -1
  258. nombreTop = ""
  259. for name, p in pairs(tfm.get.room.playerList) do
  260. if p.score + 1 > scoreTop then
  261. scoreTop = p.score + 1
  262. nombreTop = name
  263. end
  264. end
  265. if jugador_activo(nombreTop, teams.Team1) then
  266. nombreTop = "<font color = '#CB546B'>" .. nombreTop .. "</font>"
  267. elseif jugador_activo(nombreTop, teams.Team2) then
  268. nombreTop = "<font color = '#2F7FCC'>" .. nombreTop .. "</font>"
  269. end
  270.  
  271. -- fin mejor jugador
  272.  
  273.  
  274. 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
  275.  
  276. 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, 250, 0x1E1E1E, 0x121212, 1, true)
  277. ui.addTextArea(32, "<p align='center'><font size ='15' color='#00C17C'><b>Cantidades Totales</b></font></p>" .. jugadoresCantidad, nil, 35, 160, 350, 170, 0x2B2B2B, 0x2B2B2B, 1, true)
  278. 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)
  279.  
  280. end
  281.  
  282. function eventNewGame()
  283. if juego_activo then mapActual = tfm.get.room.xmlMapInfo.mapCode end
  284.  
  285. for name in pairs(tfm.get.room.playerList) do colores(name) end
  286.  
  287. if map_bc_actual or new_map then
  288. ui.removeTextArea(40, player)
  289. ui.removeTextArea(41, player)
  290. tfm.exec.setGameTime(time_map)
  291. else
  292. tfm.exec.setGameTime(time_lobby)
  293. end
  294.  
  295. if firstMap then
  296. firstMap = false
  297. tfm.exec.setGameTime(10000)
  298. end
  299.  
  300. end
  301.  
  302. function eventNewPlayer(player)
  303. respawnPlayer[player] = os.time()
  304. playerInfo.verTimes[player] = false
  305. teclas(player)
  306. end
  307.  
  308. function teclas(player)
  309. tfm.exec.bindKeyboard(player, 76, false, true)
  310. tfm.exec.bindKeyboard(player, 46, false, true)
  311. tfm.exec.bindKeyboard(player, 16, false, true)
  312. tfm.exec.bindKeyboard(player, 80, false, true)
  313. end
  314.  
  315. for player in next, tfm.get.room.playerList do
  316. eventNewPlayer(player)
  317. playerInfo.verTimes[player] = false
  318. teclas(player)
  319. end
  320.  
  321. function eventPlayerDied(player) respawnPlayer[player] = os.time() end
  322.  
  323. function setNewMap()
  324. math.randomseed(os.time())
  325. if estado == 1 then
  326. local map = ez_maps[math.random(#ez_maps)]
  327. tfm.exec.newGame(map)
  328. elseif estado == 2 then
  329. local map = med_maps[math.random(#med_maps)]
  330. tfm.exec.newGame(map)
  331. elseif estado == 3 then
  332. local map = hard_maps[math.random(#hard_maps)]
  333. tfm.exec.newGame(map)
  334. elseif estado == 4 then
  335. local map = ultra_maps[math.random(#utra_maps)]
  336. tfm.exec.newGame(map)
  337. end
  338. end
  339.  
  340. function eventLoop(time, remaining)
  341. if new_map then
  342. setNewMap()
  343. new_map = false
  344. end
  345.  
  346. if remaining < 500 then newMap() end
  347.  
  348. for i, n in pairs(respawnPlayer) do
  349. if n <= os.time() - 1000 then
  350. lista_A = teams.Team1
  351. lista_B = teams.Team2
  352. if jugador_activo(i, lista_A) or jugador_activo(i, lista_B) then
  353. tfm.exec.respawnPlayer(i)
  354. colores(i)
  355. end
  356. end
  357. end
  358. if juego_activo then
  359. minutos = "0" .. math.floor((remaining / 1000) / 60)
  360. segundos = math.floor(remaining / 1000) % 60
  361. if segundos <= 9 then segundos = "0" .. segundos end
  362. if #times >= 1 then
  363. mejorTiempo = times[1].name .. " " .. times[1].time .. "s"
  364. end
  365.  
  366. for i, n in pairs(removerText) do
  367. if n <= os.time() - 2000 then ui.removeTextArea(69, i) end
  368. end
  369.  
  370. if (time_map == 1234567) then
  371. tfm.exec.setUIMapName(
  372. " <font color='#CB546B'>Red: " ..
  373. puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
  374. puntos.team2 .. "</font>\t|\t" .. "\t\t" .. "\n")
  375. else
  376.  
  377. --[[ barra = dificultadMap .. " <font color='#CB546B'>Red: " ..
  378. puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
  379. puntos.team2 .. "</font>\t|\t" .. minutos .. ":" .. segundos ..
  380. "\t|\t" .. mejorTiempo .. "\n"
  381.  
  382. print(#barra) ]]
  383.  
  384. tfm.exec.setUIMapName(dificultadMap .. " <font color='#CB546B'>Red: " ..
  385. puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
  386. puntos.team2 .. "</font>\t|\t" .. minutos .. ":" .. segundos ..
  387. "\t|\t" .. mejorTiempo .. "\n")
  388. end
  389. end
  390. end
  391.  
  392. function eventChatCommand(playerName, command)
  393. local args = {}
  394.  
  395. for arg in command:gmatch("[^%s]+") do table.insert(args, arg) end
  396. -- comandos para admins:
  397. if admin[playerName] then
  398. if args[1] == "team1" then -- y sigue con team1
  399. teams.Team1 = {}
  400. for i = 2, #args do -- recorre toda la tabla args
  401. for j = 1, #teams.Team2 do -- recorre toda la tabla teams2
  402. if args[i] == teams.Team2[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
  403. table.remove(teams.Team2, j)
  404. -- ui.updateTextArea(667, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil)
  405. end
  406. end
  407.  
  408. if not jugador_activo(args[i], teams.Team1) then
  409. table.insert(teams.Team1, args[i])
  410. colores(args[i])
  411. end
  412. end
  413.  
  414. if juego_activo == false then grafico() end
  415.  
  416. elseif args[1] == "team2" then -- y sigue con team2
  417. teams.Team2 = {}
  418. for i = 2, #args do -- recorre toda la tabla args
  419. for j = 1, #teams.Team1 do -- recorre toda la tabla teams1
  420. if args[i] == teams.Team1[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams1
  421. table.remove(teams.Team1, j)
  422. -- ui.updateTextArea(666, "<p align='center'><font color='#CB546B'>" .. (table.concat(teams.Team1,"\n") or ""), nil)
  423. end
  424. end
  425. if not jugador_activo(args[i], teams.Team2) then
  426. table.insert(teams.Team2, args[i])
  427. colores(args[i])
  428. end
  429. end
  430. if juego_activo == false then grafico() end
  431.  
  432. elseif args[1] == "add" then
  433. if args[2] == "team1" then
  434. for i = 3, #args do -- recorre toda la tabla args
  435. for j = 1, #teams.Team2 do -- recorre toda la tabla teams2
  436. if args[i] == teams.Team2[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
  437. table.remove(teams.Team2, j)
  438. -- ui.updateTextArea(4, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil)
  439. end
  440. end
  441. -- if jugadorSinEquipo(args[i]) then
  442. if not jugador_activo(args[i], teams.Team1) then
  443. table.insert(teams.Team1, args[i])
  444. colores(args[i])
  445. end
  446. -- end
  447. end
  448. end
  449. if args[2] == "team2" then
  450. for i = 3, #args do
  451. for j = 1, #teams.Team1 do
  452. if args[i] == teams.Team1[j] then
  453. table.remove(teams.Team1, j)
  454. ui.updateTextArea(3,
  455. "<p align='center'><font color='#CB546B'>" ..
  456. (table.concat(teams.Team1,
  457. "\n") or ""),
  458. nil)
  459. end
  460. end
  461. -- if jugadorSinEquipo(args[i]) then
  462. if not jugador_activo(args[i], teams.Team2) then
  463. table.insert(teams.Team2, args[i])
  464. colores(args[i])
  465. end
  466. -- end
  467. end
  468. end
  469. if juego_activo == false then grafico() end
  470.  
  471. elseif args[1] == "records" then
  472. if recordsActivos[playerName] then
  473. recordsActivos[playerName] = false
  474. else
  475. recordsActivos[playerName] = true
  476. end
  477. verRecords(playerName)
  478.  
  479. elseif args[1] == "time" then
  480. tfm.exec.setGameTime(3)
  481. elseif args[1] == "fix" then
  482. tfm.exec.setGameTime(time_map - 3) -- le restamos los 3s del respawn
  483. elseif args[1] == "map" and juego_activo then
  484. new_map = true
  485. elseif args[1] == "mapas" then
  486. if tonumber(args[3]) ~= nil then
  487. if args[2] == "ez" then
  488. c_ez = tonumber(args[3])
  489. elseif args[2] == "med" then
  490. c_m = tonumber(args[3])
  491. elseif args[2] == "hard" then
  492. c_h = tonumber(args[3])
  493. elseif args[2] == "ultra" then
  494. c_u = tonumber(args[3])
  495. end
  496. cantidadMaps()
  497. end
  498. elseif args[1] == "t" then
  499. if tonumber(args[3]) ~= nil then
  500. if args[2] == "mapas" then
  501. time_map = tonumber(args[3])
  502. elseif args[2] == "lobby" then
  503. time_lobby = tonumber(args[3])
  504. end
  505. cantidadMaps()
  506. end
  507. end
  508. end -- admin[playername]
  509.  
  510. -- COMANDOS PARA NO ADMINS:
  511. if args[1] == "vertimes" then
  512. if playerInfo.verTimes[playerName] == false then
  513. playerInfo.verTimes[playerName] = true
  514. else
  515. playerInfo.verTimes[playerName] = false
  516. end
  517. end
  518. end
  519.  
  520. function add_points(playerName, p)
  521. if jugador_activo(playerName, teams.Team1) then
  522. puntos.team1 = puntos.team1 + p
  523. elseif jugador_activo(playerName, teams.Team2) then
  524. puntos.team2 = puntos.team2 + p
  525. end
  526. end
  527.  
  528. function eventPlayerWon(playerName, tiempoRonda, tiempoRespawn)
  529.  
  530. if puesto_1 == false then
  531. table.insert(lugares, {name = playerName, puesto = 1})
  532. puesto_1 = true
  533. tfm.exec.setPlayerScore(playerName, 4, true)
  534. add_points(playerName, 4)
  535. elseif puesto_2 == false then
  536. table.insert(lugares, {name = playerName, puesto = 2})
  537. puesto_2 = true
  538. tfm.exec.setPlayerScore(playerName, 3, true)
  539. add_points(playerName, 3)
  540.  
  541. elseif puesto_3 == false then
  542. table.insert(lugares, {name = playerName, puesto = 3})
  543. puesto_3 = true
  544. tfm.exec.setPlayerScore(playerName, 2, true)
  545. add_points(playerName, 2)
  546.  
  547. else
  548. tfm.exec.setPlayerScore(playerName, 1, true)
  549. add_points(playerName, 1)
  550. end
  551.  
  552. if playerInfo.verTimes[playerName] then
  553. if jugador_activo(playerName, teams.Team1) then
  554. ui.addTextArea(69,
  555. "<b><font size ='15' color='#CB546B'>" .. playerName ..
  556. "</font> <font size ='15'>" .. tiempoRespawn /
  557. 100 .. "s</font>", playerName, 9, 368, 0, 0,
  558. 0x2B2B2B, 0, 0.7, true)
  559. elseif jugador_activo(playerName, teams.Team2) then
  560. ui.addTextArea(69,
  561. "<b><font size ='15' color='#2F7FCC'>" .. playerName ..
  562. "</font> <font size ='15'>" .. tiempoRespawn /
  563. 100 .. "s</font>", playerName, 9, 368, 0, 0,
  564. 0x2B2B2B, 0, 0.7, true)
  565. end
  566. end
  567.  
  568. str = "\n<textformat tabstops='[70, 170, 300]'>"
  569.  
  570. table.insert(times, {
  571. time = tiempoRespawn / 100,
  572. name = playerName,
  573. mapa = mapActual
  574. })
  575. if not playerInfo.alreadyRespawn[playerName] then
  576. times[#times].time = times[#times].time - 3
  577. end
  578. table.sort(times, function(i, v) return i.time < v.time end)
  579. for i, completion in ipairs(times) do
  580. if jugador_activo(completion.name, teams.Team1) then
  581. jugador = "<font color = '#CB546B'>" .. completion.name .. "</font>"
  582. elseif jugador_activo(completion.name, teams.Team2) then
  583. jugador = "<font color = '#2F7FCC'>" .. completion.name .. "</font>"
  584. end
  585. removerText[playerName] = os.time()
  586. if i <= 15 then
  587. if i < 10 then i = 0 .. i end
  588. str = str ..
  589. (i .. ' | ' .. jugador .. '\t| ' ..
  590. completion.time .. 's\n')
  591. end
  592. end
  593. str = str .. '</textformat>'
  594. for player, p in pairs(tfm.get.room.playerList) do verRecords(player) end
  595.  
  596. end
  597.  
  598. function eventKeyboard(player, key, down, x, y)
  599. if key == 76 then
  600. if recordsActivos[player] then
  601. recordsActivos[player] = false
  602. else
  603. recordsActivos[player] = true
  604. end
  605. verRecords(player)
  606. elseif key == 46 or key == 16 then
  607. tfm.exec.killPlayer(player)
  608. elseif key == 80 then
  609. if playerInfo.verTimes[player] == false then
  610. playerInfo.verTimes[player] = true
  611. else
  612. playerInfo.verTimes[player] = false
  613. end
  614. end
  615. end
  616.  
  617. function colores(playerName)
  618. if jugador_activo(playerName, teams.Team1) then
  619. tfm.exec.setNameColor(playerName, 0xCB546B)
  620. elseif jugador_activo(playerName, teams.Team2) then
  621. tfm.exec.setNameColor(playerName, 0x2F7FCC)
  622. end
  623. end
  624.  
  625. function jugador_activo(player, L) -- L lista de jugadores --
  626. for _, v in pairs(L) do if player == v then return true end end
  627. return false
  628. end
  629.  
  630. function verRecords(player)
  631. if recordsActivos[player] then
  632. ui.addTextArea(40, str, player, 275, 80, 250, 200, 0x2B2B2B, 0x121212,
  633. 1, true)
  634. ui.addTextArea(41,
  635. "<p align='center'><font size ='13' color='#00C17C'><b>Tiempos",
  636. player, 352, 65, 100, 20, 0x2B2B2B, 0x121212, 1, true)
  637. else
  638. ui.removeTextArea(40, player)
  639. ui.removeTextArea(41, player)
  640. end
  641. end
  642.  
  643.  
  644. function recordsLobby()
  645. jugador = "\n\n"
  646. jugadoresTimes = "\n<textformat tabstops='[175]'>"
  647. jugadorCantidad = {}
  648. jugadoresCantidad = "\n<textformat tabstops='[175]'>"
  649.  
  650. table.sort(lugares, function(i, v) return i.puesto < v.puesto end)
  651. for i, nombreJugador in ipairs(lugares) do
  652. if jugador_activo(nombreJugador.name, teams.Team1) then
  653. jugador = jugador .. "<font color='#00C17C'>" .. "0" .. nombreJugador.puesto .. "</font> " .. "<font color = '#CB546B'>" .. nombreJugador.name .. "</font>\n"
  654. elseif jugador_activo(nombreJugador.name, teams.Team2) then
  655. jugador = jugador .. "<font color='#00C17C'>" .. "0" .. nombreJugador.puesto .. "</font> " .. "<font color = '#2F7FCC'>" .. nombreJugador.name .. "</font>\n"
  656. end
  657. end
  658.  
  659. for i = 1, recorrerTimes() do
  660. if jugador_activo(times[i].name, teams.Team1) then
  661. jugadoresTimes = jugadoresTimes .. "<font color='#CB546B'>" .. times[i].name .. "\t</font><font color = '#00C17C'>" .. times[i].time .. "s</font>\n"
  662. elseif jugador_activo(times[i].name, teams.Team2) then
  663. jugadoresTimes = jugadoresTimes .. "<font color='#2F7FCC'>" .. times[i].name .. "\t</font><font color = '#00C17C'>" .. times[i].time .. "s</font>\n"
  664. end
  665. end
  666.  
  667. local cont = 1
  668. local cont_ult
  669. local names = {}
  670. local name_cant = {}
  671. local canti = {}
  672.  
  673. for i = 1, #times do
  674. table.insert(names, times[i].name)
  675. end
  676.  
  677. table.sort(names, function(a,b) return a < b end)
  678. for i = 1, #names do
  679. end
  680.  
  681. for i = 1 , #names do
  682. if i+1 > #names or names[i] ~= names[i+1] then
  683. table.insert(name_cant, {nombre = names[i], cantidad = cont})
  684. cont = 1
  685. else
  686. cont = cont + 1
  687. end
  688. end
  689.  
  690. for i, jugadorNombre in ipairs(name_cant) do
  691. if jugador_activo(jugadorNombre.nombre, teams.Team1) then
  692. jugadoresCantidad = jugadoresCantidad .. "<font color='#CB546B'>" .. jugadorNombre.nombre .. "\t</font><font color = '#00C17C'>" .. jugadorNombre.cantidad .. "</font>\n"
  693. elseif jugador_activo(jugadorNombre.nombre, teams.Team2) then
  694. jugadoresCantidad = jugadoresCantidad .. "<font color='#2F7FCC'>" .. jugadorNombre.nombre .. "\t</font><font color = '#00C17C'>" .. jugadorNombre.cantidad .. "</font>\n"
  695. end
  696. end
  697.  
  698.  
  699. ui.addTextArea(31, "<p align='center'> <font size ='16' color='#00C17C'><b>Estadísticas", nil, 20, 137, 760, 220, 0x1E1E1E, 0x121212,
  700. 1, true)
  701. 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)
  702. 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)
  703. 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)
  704.  
  705. end
  706.  
  707. function recorrerTimes()
  708. if #times >= 3 then
  709. return 3
  710. elseif #times == 2 then
  711. return 2
  712. elseif #times == 1 then
  713. return 1
  714. else
  715. return 0
  716. end
  717. end
  718.  
  719.  
  720. --
  721. function rcorrer_times(L, cantidad_times)
  722. local t = 4
  723. for i = 1, cantidad_times, 1 do
  724. add_points(L[i].name, t)
  725. tfm.exec.setPlayerScore(L[i].name, t, true)
  726. t = t / 2
  727. end
  728. end
  729.  
  730. function addpoints_time(L)
  731. if #L >= 3 then
  732. rcorrer_times(L, 3)
  733. elseif #L == 2 then
  734. rcorrer_times(L, 2)
  735. elseif #L == 1 then
  736. rcorrer_times(L, 1)
  737. end
  738. end
  739.  
  740. function establecerEquipos()
  741. teams.Team1 = {}
  742. teams.Team2 = {}
  743. local equipo = 1
  744. local jugadoresTotal = {}
  745. for name, p in pairs(tfm.get.room.playerList) do
  746. table.insert(jugadoresTotal, name)
  747. end
  748. for i = 1, #jugadoresTotal do
  749. numJugador = math.random(#jugadoresTotal)
  750. agregarJugador = jugadoresTotal[numJugador]
  751. table.remove(jugadoresTotal, numJugador)
  752. if equipo == 1 then
  753. table.insert(teams.Team1, agregarJugador)
  754. equipo = 2
  755. elseif equipo == 2 then
  756. table.insert(teams.Team2, agregarJugador)
  757. equipo = 1
  758. end
  759. end
  760. grafico()
  761. end
  762.  
  763. function establecerPuntos()
  764. for name in pairs(tfm.get.room.playerList) do
  765. tfm.exec.setPlayerScore(name, 0)
  766. end
  767. end
  768.  
  769. function eventTextAreaCallback(id, player, callback)
  770. if admin[player] then
  771. if callback == 'equiposRandom' then
  772. establecerEquipos()
  773. colores()
  774. elseif callback == 'vaciarTeams' then
  775. teams.Team1 = {}
  776. teams.Team2 = {}
  777. grafico()
  778. elseif callback == 'iniciarJuego' then
  779. for i = 661, 671 do ui.removeTextArea(i) end
  780. newMap()
  781. establecerPuntos()
  782.  
  783. end
  784. end
  785. end
  786.  
  787. function grafico()
  788. ui.addTextArea(661, "", nil, 300, 143, 200, 13, 0x2B2B2B, 0x121212, 0.7,
  789. true)
  790. ui.addTextArea(662, "", nil, 300, 243, 200, 13, 0x2B2B2B, 0x121212, 0.7,
  791. true)
  792. ui.addTextArea(666, "<p align='center'><font color='#CB546B'>" ..
  793. (table.concat(teams.Team1, "\n") or ""), nil, 150, 140,
  794. 175, 200, 0x2B2B2B, 0x121212, 1, true)
  795. ui.addTextArea(667, "<p align='center'><font color='#2F7FCC'>" ..
  796. (table.concat(teams.Team2, "\n") or ""), nil, 450, 140,
  797. 175, 200, 0x2B2B2B, 0x121212, 1, true)
  798. ui.addTextArea(664, "<p align='center'><font color='#CB546B'><b>Team 1",
  799. nil, 143, 115, 190, 20, 0x2B2B2B, 0x121212, 1, true)
  800. ui.addTextArea(665, "<p align='center'><font color='#2F7FCC'><b>Team 2",
  801. nil, 443, 115, 190, 20, 0x2B2B2B, 0x121212, 1, true)
  802. ui.addTextArea(668,
  803. "<p align='center'><V><a href='event:iniciarJuego'><font color='#F93018'><b>Iniciar",
  804. nil, 363, 140, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  805. ui.addTextArea(663, "", nil, 290, 343, 200, 13, 0x2B2B2B, 0x121212, 1, true)
  806. ui.addTextArea(669,
  807. "<p align='center'><V><a href='event:equiposRandom'><font color='#00C17C'><b>Llenar",
  808. nil, 463, 341, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  809. ui.addTextArea(670,
  810. "<p align='center'><V><a href='event:vaciarTeams'><font color='#00C17C'><b>Vaciar",
  811. nil, 263, 341, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  812. end
  813.  
  814. function cantidadMaps()
  815. if juego_activo == false then
  816. for name in pairs(admin) do
  817. ui.addTextArea(671,
  818. "<b><font color='#00C17C' size ='12'>Ez Maps " ..
  819. c_ez ..
  820. "</font>\n<font color='#EBC244' size ='12'>Med Maps " ..
  821. c_m ..
  822. "</font>\n<font color='#CB546B' size ='12'>Hard Maps " ..
  823. c_h ..
  824. "</font>\n<font color='#F93018' size ='12'>Ult Maps " ..
  825. c_u ..
  826. "</font>\n\n<BV><font size ='12'>Time Map " ..
  827. time_map .. "\nTime Lob " .. time_lobby, name,
  828. 10, 143, 100, 0, 0x2B2B2B, 0x121212, 0.7, true)
  829. end
  830. end
  831. end
  832.  
  833. function main()
  834. tfm.exec.newGame(7692636)
  835. grafico()
  836. tfm.exec.setGameTime(10000)
  837. cantidadMaps()
  838. end
  839.  
  840. main()
  841.  
  842. function eventPlayerRespawn(playerName) playerInfo.alreadyRespawn[playerName] = true end
  843.  
  844. -- hola amiguitos
  845.  
  846. -- ui.addTextArea ( id, texto, jogador, x, y, largura, altura, corFundo, corBorda, opacidade, posicaoFixa )
  847. --Mostra uma textarea.
  848. -- Parâmetros:
  849. --  - id (Int) : o id da textarea
  850. --  - texto (String) : o texto a ser mostrado
  851. -- - jogador (String) : o jogador que poderá ver a popup (se nil, aplica-se para todos os jogadores)
  852. --  - x (Int) : a coordenada horizontal do topo, a esquerda (valor padrão = 50)
  853. --  - y (Int) : a coordenada vertical do topo, a esquerda (valor padrão = 50)
  854. -- - largura (Int) : a largura em pixeis da textarea (se 0, será ajustado de acordo com a largura do texto) (valor padrão = 0)
  855. -- - altura (Int) : a altura em pixeis da textarea (se 0, será ajustado de acordo com a altura do texto) (valor padrão = 0)
  856. -- - corFundo (Int) : a cor de fundo da textarea (valor padrão = 0x324650)
  857. -- - corBorda (Int) : a cor da borda da textarea (valor padrão = 0)
  858. -- - opacidade (Number) : a opacidade do fundo da textarea, de 0 (transparente) até 1 (opaco) (valor padrão = 1)
  859. -- - posicaoFixa (Boolean) : se a posição é fixa ou se deve seguir o jogador em mapas longos (valor padrão = false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement