Advertisement
alditojeje

Untitled

Mar 26th, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.25 KB | None | 0 0
  1. --valiu
  2. -- djskjakjd
  3. tfm.exec.disableAutoScore(true)
  4. tfm.exec.disableAutoShaman(true)
  5. tfm.exec.disableAutoTimeLeft(true)
  6. tfm.exec.disableAutoNewGame(true)
  7. tfm.exec.disableAfkDeath(true)
  8. tfm.exec.disablePhysicalConsumables(true)
  9. -- te observo ^-^
  10. local removerText = {}
  11. local jugadorCantidad = {}
  12. local lugares = {}
  13. local verTimes = {}
  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
  69. }
  70. local med_maps = {
  71. 6892200, 6000050, 157004, 158345, 158417, 163094, 7288650, 3473925, 192560,
  72. 216171, 2795201, 263819, 4617716, 590775, 306655, 307324, 327743, 2914456,
  73. 372255, 391924, 392240, 397478, 3133917, 2932238, 438364, 482791, 500000,
  74. 522719, 552986, 557074, 560583, 587501, 2242899, 612415, 721319, 722837,
  75. 562897, 563436, 564198, 568122, 571683, 574183, 575497, 584783, 560526,
  76. 729863, 374995, 758595, 881158, 886744, 970919, 1046877, 1066607, 1130256,
  77. 1156092, 1226207, 1301649, 1303323, 1323048, 1333846, 1384078, 1410539,
  78. 1620703, 1955745, 1989803, 1990413, 2024960, 2178800, 2329940, 2416969,
  79. 2469365, 2788517, 2846829, 3038589, 3668888, 3690269, 3988424, 549666,
  80. 4114521, 1523082, 5960814, 1256085, 6137767, 4890068, 557132, 357892,
  81. 273373, 225484, 5000126, 6533602, 6574593, 293559, 6696038, 6600067,
  82. 4763378, 1601992, 4770120, 6774534, 4877895, 425533, 556973, 4769901,
  83. 406154, 6642996, 6675248, 223174, 6999009, 4895345, 655207, 823329, 2082776,
  84. 2309030, 2963166, 2999994, 3828508, 3976977, 4107909, 4632975, 5092739,
  85. 6593495, 6727980, 2803483, 4237910, 4538472, 3521460, 2128560, 3493490,
  86. 4362335, 2294519, 6000033, 6284671, 7196861, 7261219, 6640663, 7306627,
  87. 7324922, 6000044, 7110102, 7370291, 6931020, 7290999, 7000002, 7512725,
  88. 7598733
  89. }
  90. local hard_maps = {
  91. 329200, 2417098, 654894, 1111252, 2514792, 4224188, 290824, 5994088
  92. }
  93. local ultra_maps = {}
  94. local time_map = 363 -- (segundos)
  95. c_ez = 2
  96. c_m = 0
  97. c_h = 0
  98. c_u = 0
  99. local puesto_1 = false
  100. local puesto_2 = false
  101. local puesto_3 = false
  102. local admin = {
  103. ["Blood#3565"] = true,
  104. ["Misterthepro#0000"] = true,
  105. ["Edudekarly#3398"] = true,
  106. ["His#0439"] = true
  107. }
  108. local alreadyRespawn = {}
  109. local recordsActivos = {}
  110. local mapActual = ""
  111. -- local mapa_bc_actual = false LA QUE USAMOS SE LLAMA MAP_BC_ACTUAL LOL XD
  112. local mejorTiempo = " "
  113. local last_map = false
  114. local time_lobby = 666
  115. local firstMap = true
  116. local estado
  117. local new_map = false
  118. local dificultadMap = ""
  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. mejoresTimes()
  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. c_ez = c_ez - 1
  171. dificultadMap = "<font color='#00C17C'>Fácil</font>"
  172. elseif c_m ~= 0 then
  173. estado = 2
  174. local map = med_maps[math.random(#med_maps)]
  175. tfm.exec.newGame(map)
  176. c_m = c_m - 1
  177. dificultadMap = "<font color='#EBC244'>Medio</font>"
  178. elseif c_h ~= 0 then
  179. estado = 3
  180. local map = hard_maps[math.random(#hard_maps)]
  181. tfm.exec.newGame(map)
  182. dificultadMap = "<font color='#F93018'>Difícil</font>"
  183. -- print(time_map) --
  184. c_h = c_h - 1
  185.  
  186. elseif c_u ~= 0 then
  187. estado = 4
  188. local map = ultra_maps[math.random(#ultra_maps)]
  189. tfm.exec.newGame(map)
  190. dificultadMap = "<font color='#F93018'>Ultra</font>"
  191. c_u = c_u - 1
  192. -- else
  193. end
  194. for p, v in pairs(tfm.get.room.playerList) do
  195. if jugador_activo(p, lista_A) == false and
  196. jugador_activo(p, lista_B) == false then
  197. tfm.exec.killPlayer(p)
  198. end
  199. end
  200.  
  201. else
  202. juego_activo = true
  203. tfm.exec.newGame(7692692)
  204. -- tfm.exec.setGameTime(7)
  205. map_bc_actual = false
  206.  
  207. addpoints_time(times)
  208.  
  209. recordsLobby()
  210. if #times >= 1 then
  211. table.insert(bestTimes, {
  212. mapa = times[1].mapa,
  213. time = times[1].time,
  214. name = times[1].name
  215. })
  216. end
  217. end
  218. end
  219.  
  220. function puntuacion_final()
  221. ui.addTextArea ( 300, "<p align='center'><font size ='13' color='#00C17C'><b>Puntuacion Final", nil , 420, 125, 0, 20, 0x2B2B2B, 0x121212, 1, true)
  222. ui.addTextArea ( 301, "<p align='center'><font size ='13' color='#CB546B'><b>Red: " .. puntos.team1 .. "<p align='center'><font size ='13' color='#2F7FCC'><b>\nBlue: ".. puntos.team2 , nil , 420, 160, 0, 20, 0x2B2B2B, 0x121212, 1, true)
  223.  
  224. if puntos.team1 > puntos.team2 then
  225. ui.addTextArea ( 302, "<p align='center'><font size ='13' color='#CB546B'><b> WIN RED: " .. puntos.team1 .. " points " , nil , 420, 215, 0, 20, 0x2B2B2B, 0x121212, 1, true)
  226. elseif puntos.team1 < puntos.team2 then
  227. ui.addTextArea ( 302, "<p align='center'><font size ='13' color='#2F7FCC'><b> WIN BLUE: " .. puntos.team2 .. " points " , nil , 420, 215, 0, 20, 0x2B2B2B, 0x121212, 1, true)
  228. else
  229. ui.addTextArea ( 302, "<p align='center'><font size ='13' color='EEEFF6'><b> Empate con: " .. puntos.team1 .. " - " .. puntos.team2 , nil , 420, 215, 0, 20, 0x2B2B2B, 0x121212, 1, true)
  230. end
  231. end
  232.  
  233.  
  234. function mejoresTimes()
  235. mejoresTiempos = "\n<textformat tabstops='[75, 230]'>"
  236. color = ""
  237. for i, completion in ipairs(bestTimes) do
  238.  
  239. if jugador_activo(completion.name, teams.Team1) then
  240. jugador = "<font color = '#CB546B'>" .. completion.name .. "</font>"
  241. elseif jugador_activo(completion.name, teams.Team2) then
  242. jugador = "<font color = '#2F7FCC'>" .. completion.name .. "</font>"
  243. end
  244.  
  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.  
  253. ui.addTextArea(51, "<br>" .. mejoresTiempos, player, 100, 140, 0, 0,
  254. 0x2B2B2B, 0x121212, 1, true)
  255. ui.addTextArea(50,
  256. "<p align='center'><font size ='13' color='#00C17C'><b>Mejores Tiempos",
  257. player, 190, 125, 0, 20, 0x2B2B2B, 0x121212, 1, true)
  258. end
  259.  
  260. function eventNewGame()
  261. if juego_activo then mapActual = tfm.get.room.xmlMapInfo.mapCode end
  262.  
  263. for name in pairs(tfm.get.room.playerList) do colores(name) end
  264.  
  265. if map_bc_actual or new_map then
  266. ui.removeTextArea(40, player)
  267. ui.removeTextArea(41, player)
  268. tfm.exec.setGameTime(time_map)
  269. else
  270. tfm.exec.setGameTime(time_lobby)
  271. end
  272.  
  273. if firstMap then
  274. firstMap = false
  275. tfm.exec.setGameTime(10000)
  276. end
  277.  
  278. end
  279.  
  280. function eventNewPlayer(player)
  281. respawnPlayer[player] = os.time()
  282. verTimes[player] = false
  283. teclas(player)
  284. end
  285.  
  286. function teclas(player)
  287. tfm.exec.bindKeyboard(player, 76, false, true)
  288. tfm.exec.bindKeyboard(player, 46, false, true)
  289. tfm.exec.bindKeyboard(player, 16, false, true)
  290. end
  291.  
  292. for player in next, tfm.get.room.playerList do
  293. eventNewPlayer(player)
  294. verTimes[player] = false
  295. teclas(player)
  296. end
  297.  
  298. function eventPlayerDied(player) respawnPlayer[player] = os.time() end
  299.  
  300. function setNewMap()
  301. math.randomseed(os.time())
  302. if estado == 1 then
  303. local map = ez_maps[math.random(#ez_maps)]
  304. tfm.exec.newGame(map)
  305. elseif estado == 2 then
  306. local map = med_maps[math.random(#med_maps)]
  307. tfm.exec.newGame(map)
  308. elseif estado == 3 then
  309. local map = hard_maps[math.random(#hard_maps)]
  310. tfm.exec.newGame(map)
  311. elseif estado == 4 then
  312. local map = ultra_maps[math.random(#utra_maps)]
  313. tfm.exec.newGame(map)
  314. end
  315. end
  316.  
  317. function eventLoop(time, remaining)
  318. if new_map then
  319. setNewMap()
  320. new_map = false
  321. end
  322.  
  323. if remaining < 500 then newMap() end
  324.  
  325. for i, n in pairs(respawnPlayer) do
  326. if n <= os.time() - 1000 then
  327. lista_A = teams.Team1
  328. lista_B = teams.Team2
  329. if jugador_activo(i, lista_A) or jugador_activo(i, lista_B) then
  330. tfm.exec.respawnPlayer(i)
  331. colores(i)
  332. end
  333. end
  334. end
  335. if juego_activo then
  336. minutos = "0" .. math.floor((remaining / 1000) / 60)
  337. segundos = math.floor(remaining / 1000) % 60
  338. if segundos <= 9 then segundos = "0" .. segundos end
  339. if #times >= 1 then
  340. mejorTiempo = times[1].name .. " " .. times[1].time .. "s"
  341. end
  342.  
  343. for i, n in pairs(removerText) do
  344. if n <= os.time() - 2000 then ui.removeTextArea(69, i) end
  345. end
  346.  
  347. if (time_map == 1234567) then
  348. tfm.exec.setUIMapName(
  349. " <font color='#CB546B'>Red: " ..
  350. puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
  351. puntos.team2 .. "</font>\t|\t" .. "\t\t" .. "\n")
  352. else
  353.  
  354. --[[ barra = dificultadMap .. " <font color='#CB546B'>Red: " ..
  355. puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
  356. puntos.team2 .. "</font>\t|\t" .. minutos .. ":" .. segundos ..
  357. "\t|\t" .. mejorTiempo .. "\n"
  358.  
  359. print(#barra) ]]
  360.  
  361. tfm.exec.setUIMapName(dificultadMap .. " <font color='#CB546B'>Red: " ..
  362. puntos.team1 .. "</font>\t|\t<font color='#2F7FCC'> Blue: " ..
  363. puntos.team2 .. "</font>\t|\t" .. minutos .. ":" .. segundos ..
  364. "\t|\t" .. mejorTiempo .. "\n")
  365. end
  366. end
  367. end
  368.  
  369. function eventChatCommand(playerName, command)
  370. local args = {}
  371.  
  372. for arg in command:gmatch("[^%s]+") do table.insert(args, arg) end
  373. -- comandos para admins:
  374. if admin[playerName] then
  375. if args[1] == "team1" then -- y sigue con team1
  376. teams.Team1 = {}
  377. for i = 2, #args do -- recorre toda la tabla args
  378. for j = 1, #teams.Team2 do -- recorre toda la tabla teams2
  379. if args[i] == teams.Team2[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
  380. table.remove(teams.Team2, j)
  381. -- ui.updateTextArea(667, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil)
  382. end
  383. end
  384.  
  385. if not jugador_activo(args[i], teams.Team1) then
  386. table.insert(teams.Team1, args[i])
  387. colores(args[i])
  388. end
  389. end
  390.  
  391. if juego_activo == false then grafico() end
  392.  
  393. elseif args[1] == "team2" then -- y sigue con team2
  394. teams.Team2 = {}
  395. for i = 2, #args do -- recorre toda la tabla args
  396. for j = 1, #teams.Team1 do -- recorre toda la tabla teams1
  397. if args[i] == teams.Team1[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams1
  398. table.remove(teams.Team1, j)
  399. -- ui.updateTextArea(666, "<p align='center'><font color='#CB546B'>" .. (table.concat(teams.Team1,"\n") or ""), nil)
  400. end
  401. end
  402. if not jugador_activo(args[i], teams.Team2) then
  403. table.insert(teams.Team2, args[i])
  404. colores(args[i])
  405. end
  406. end
  407. if juego_activo == false then grafico() end
  408.  
  409. elseif args[1] == "add" then
  410. if args[2] == "team1" then
  411. for i = 3, #args do -- recorre toda la tabla args
  412. for j = 1, #teams.Team2 do -- recorre toda la tabla teams2
  413. if args[i] == teams.Team2[j] then -- si un elemento de la tabla args conicide con un elento de la tabla teams2
  414. table.remove(teams.Team2, j)
  415. -- ui.updateTextArea(4, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil)
  416. end
  417. end
  418. -- if jugadorSinEquipo(args[i]) then
  419. if not jugador_activo(args[i], teams.Team1) then
  420. table.insert(teams.Team1, args[i])
  421. colores(args[i])
  422. end
  423. -- end
  424. end
  425. end
  426. if args[2] == "team2" then
  427. for i = 3, #args do
  428. for j = 1, #teams.Team1 do
  429. if args[i] == teams.Team1[j] then
  430. table.remove(teams.Team1, j)
  431. ui.updateTextArea(3,
  432. "<p align='center'><font color='#CB546B'>" ..
  433. (table.concat(teams.Team1,
  434. "\n") or ""),
  435. nil)
  436. end
  437. end
  438. -- if jugadorSinEquipo(args[i]) then
  439. if not jugador_activo(args[i], teams.Team2) then
  440. table.insert(teams.Team2, args[i])
  441. colores(args[i])
  442. end
  443. -- end
  444. end
  445. end
  446. if juego_activo == false then grafico() end
  447.  
  448. elseif args[1] == "records" then
  449. if recordsActivos[playerName] then
  450. recordsActivos[playerName] = false
  451. else
  452. recordsActivos[playerName] = true
  453. end
  454. verRecords(playerName)
  455.  
  456. elseif args[1] == "time" then
  457. tfm.exec.setGameTime(3)
  458. elseif args[1] == "fix" then
  459. tfm.exec.setGameTime(time_map - 3) -- le restamos los 3s del respawn
  460. elseif args[1] == "map" and juego_activo then
  461. new_map = true
  462. elseif args[1] == "mapas" then
  463. if tonumber(args[3]) ~= nil then
  464. if args[2] == "ez" then
  465. c_ez = tonumber(args[3])
  466. elseif args[2] == "med" then
  467. c_m = tonumber(args[3])
  468. elseif args[2] == "hard" then
  469. c_h = tonumber(args[3])
  470. elseif args[2] == "ultra" then
  471. c_u = tonumber(args[3])
  472. end
  473. cantidadMaps()
  474. end
  475. elseif args[1] == "t" then
  476. if tonumber(args[3]) ~= nil then
  477. if args[2] == "mapas" then
  478. time_map = tonumber(args[3])
  479. elseif args[2] == "lobby" then
  480. time_lobby = tonumber(args[3])
  481. end
  482. cantidadMaps()
  483. end
  484. end
  485. end -- admin[playername]
  486.  
  487. -- COMANDOS PARA NO ADMINS:
  488. if args[1] == "vertimes" then
  489. if verTimes[playerName] == false then
  490. verTimes[playerName] = true
  491. else
  492. verTimes[playerName] = false
  493. end
  494. end
  495. end
  496.  
  497. function add_points(playerName, p)
  498. if jugador_activo(playerName, teams.Team1) then
  499. puntos.team1 = puntos.team1 + p
  500. elseif jugador_activo(playerName, teams.Team2) then
  501. puntos.team2 = puntos.team2 + p
  502. end
  503. end
  504.  
  505. function eventPlayerWon(playerName, tiempoRonda, tiempoRespawn)
  506.  
  507. if puesto_1 == false then
  508. table.insert(lugares, {name = playerName, puesto = 1})
  509. puesto_1 = true
  510. tfm.exec.setPlayerScore(playerName, 4, true)
  511. add_points(playerName, 4)
  512. elseif puesto_2 == false then
  513. table.insert(lugares, {name = playerName, puesto = 2})
  514. puesto_2 = true
  515. tfm.exec.setPlayerScore(playerName, 3, true)
  516. add_points(playerName, 3)
  517.  
  518. elseif puesto_3 == false then
  519. table.insert(lugares, {name = playerName, puesto = 3})
  520. puesto_3 = true
  521. tfm.exec.setPlayerScore(playerName, 2, true)
  522. add_points(playerName, 2)
  523.  
  524. else
  525. tfm.exec.setPlayerScore(playerName, 1, true)
  526. add_points(playerName, 1)
  527. end
  528.  
  529. if verTimes[playerName] then
  530. if jugador_activo(playerName, teams.Team1) then
  531. ui.addTextArea(69,
  532. "<b><font size ='15' color='#CB546B'>" .. playerName ..
  533. "</font> <font size ='15'>" .. tiempoRespawn /
  534. 100 .. "s</font>", playerName, 9, 368, 0, 0,
  535. 0x2B2B2B, 0, 0.7, true)
  536. elseif jugador_activo(playerName, teams.Team2) then
  537. ui.addTextArea(69,
  538. "<b><font size ='15' color='#2F7FCC'>" .. playerName ..
  539. "</font> <font size ='15'>" .. tiempoRespawn /
  540. 100 .. "s</font>", playerName, 9, 368, 0, 0,
  541. 0x2B2B2B, 0, 0.7, true)
  542. end
  543. end
  544.  
  545. str = "\n<textformat tabstops='[70, 170, 300]'>"
  546.  
  547. table.insert(times, {
  548. time = tiempoRespawn / 100,
  549. name = playerName,
  550. mapa = mapActual
  551. })
  552. if not alreadyRespawn[playerName] then
  553. times[#times].time = times[#times].time - 3
  554. end
  555. table.sort(times, function(i, v) return i.time < v.time end)
  556. for i, completion in ipairs(times) do
  557. if jugador_activo(completion.name, teams.Team1) then
  558. jugador = "<font color = '#CB546B'>" .. completion.name .. "</font>"
  559. elseif jugador_activo(completion.name, teams.Team2) then
  560. jugador = "<font color = '#2F7FCC'>" .. completion.name .. "</font>"
  561. end
  562. removerText[playerName] = os.time()
  563. if i <= 15 then
  564. if i < 10 then i = 0 .. i end
  565. str = str ..
  566. (i .. ' | ' .. jugador .. '\t| ' ..
  567. completion.time .. 's\n')
  568. end
  569. end
  570. str = str .. '</textformat>'
  571. for player, p in pairs(tfm.get.room.playerList) do verRecords(player) end
  572.  
  573. end
  574.  
  575. function eventKeyboard(player, key, down, x, y)
  576. if key == 76 then
  577. if recordsActivos[player] then
  578. recordsActivos[player] = false
  579. else
  580. recordsActivos[player] = true
  581. end
  582. verRecords(player)
  583. elseif key == 46 or key == 16 then
  584. tfm.exec.killPlayer(player)
  585. end
  586. end
  587.  
  588. function colores(playerName)
  589. if jugador_activo(playerName, teams.Team1) then
  590. tfm.exec.setNameColor(playerName, 0xCB546B)
  591. elseif jugador_activo(playerName, teams.Team2) then
  592. tfm.exec.setNameColor(playerName, 0x2F7FCC)
  593. end
  594. end
  595.  
  596. function jugador_activo(player, L) -- L lista de jugadores --
  597. for _, v in pairs(L) do if player == v then return true end end
  598. return false
  599. end
  600.  
  601. function verRecords(player)
  602. if recordsActivos[player] then
  603. ui.addTextArea(40, str, player, 275, 80, 250, 200, 0x2B2B2B, 0x121212,
  604. 1, true)
  605. ui.addTextArea(41,
  606. "<p align='center'><font size ='13' color='#00C17C'><b>Tiempos",
  607. player, 352, 65, 100, 20, 0x2B2B2B, 0x121212, 1, true)
  608. else
  609. ui.removeTextArea(40, player)
  610. ui.removeTextArea(41, player)
  611. end
  612. end
  613.  
  614. function recordsLobby()
  615. jugador = "\n\n"
  616. jugadoresTimes = "\n<textformat tabstops='[190]'>"
  617. jugadorCantidad = {}
  618. jugadoresCantidad = "\n<textformat tabstops='[190]'>"
  619.  
  620. table.sort(lugares, function(i, v) return i.puesto < v.puesto end)
  621. for i, nombreJugador in ipairs(lugares) do
  622. if jugador_activo(nombreJugador.name, teams.Team1) then
  623. jugador = jugador .. "<font color='#00C17C'>" .. "0" .. nombreJugador.puesto .. "</font> " .. "<font color = '#CB546B'>" .. nombreJugador.name .. "</font>\n"
  624. elseif jugador_activo(nombreJugador.name, teams.Team2) then
  625. jugador = jugador .. "<font color='#00C17C'>" .. "0" .. nombreJugador.puesto .. "</font> " .. "<font color = '#2F7FCC'>" .. nombreJugador.name .. "</font>\n"
  626. end
  627. end
  628.  
  629. for i = 1, 3 do
  630. if jugador_activo(times[i].name, teams.Team1) then
  631. jugadoresTimes = jugadoresTimes .. "<font color='#CB546B'>" .. times[i].name .. "\t</font><font color = '#00C17C'>" .. times[i].time .. "s</font>\n"
  632. elseif jugador_activo(times[i].name, teams.Team2) then
  633. jugadoresTimes = jugadoresTimes .. "<font color='#2F7FCC'>" .. times[i].name .. "\t</font><font color = '#00C17C'>" .. times[i].time .. "s</font>\n"
  634. end
  635. end
  636.  
  637. local cont = 1
  638. local cont_ult
  639. local names = {}
  640. local name_cant = {}
  641. local canti = {}
  642.  
  643. for i = 1, #times do
  644. table.insert(names, times[i].name)
  645. end
  646.  
  647. table.sort(names, function(a,b) return #a < #b end)
  648. if #times == 1 then
  649. table.insert(name_cant, {nombre = names[1], cantidad = 1})
  650. elseif #times == 2 then
  651. if names[1] == names[2] then
  652. table.insert(name_cant, {nombre = names[1], cantidad = 2})
  653.  
  654. else
  655. table.insert(name_cant, {nombre = names[1], cantidad = 1})
  656. table.insert(name_cant, {nombre = names[2], cantidad = 1})
  657.  
  658. end
  659. else
  660. local nombre_actual
  661. for i = 2 , #times do
  662. nombre_actual = names[i-1]
  663. if names[i-1] == names[i] then
  664. cont = cont + 1
  665. cont_ult = cont
  666. else
  667. table.insert(name_cant, {nombre = nombre_actual, cantidad = cont})
  668. cont = 1
  669. end
  670. end
  671. table.insert(name_cant, {nombre = nombre_actual, cantidad = cont_ult})
  672. end
  673.  
  674. for i, jugadorNombre in ipairs(name_cant) do
  675. if jugador_activo(jugadorNombre.nombre, teams.Team1) then
  676. jugadoresCantidad = jugadoresCantidad .. "<font color='#CB546B'>" .. jugadorNombre.nombre .. "\t</font><font color = '#00C17C'>" .. jugadorNombre.cantidad .. "</font>\n"
  677. elseif jugador_activo(jugadorNombre.nombre, teams.Team2) then
  678. jugadoresCantidad = jugadoresCantidad .. "<font color='#2F7FCC'>" .. jugadorNombre.nombre .. "\t</font><font color = '#00C17C'>" .. jugadorNombre.cantidad .. "</font>\n"
  679. end
  680. end
  681.  
  682.  
  683. ui.addTextArea(31, "<p align='center'> <font size ='16' color='#00C17C'><b>Estadísticas", nil, 20, 137, 760, 220, 0x1E1E1E, 0x121212,
  684. 1, true)
  685. ui.addTextArea(32, "<p align='center'><font size ='15' color='#00C17C'><b>Tiempos</b></font></p>" .. jugadoresTimes, nil, 35, 170, 230, 170, 0x2B2B2B, 0x2B2B2B,
  686. 1, true)
  687. ui.addTextArea(33, "<p align='center'><font size ='15' color='#00C17C'><b>Cantidades</b></font></p>" .. jugadoresCantidad, nil, 285, 170, 230, 170, 0x2B2B2B, 0x2B2B2B,
  688. 1, true)
  689. ui.addTextArea(34, "<p align='center'><font size ='15' color='#00C17C'><b>Lugares</b></font>" .. jugador, nil, 535, 170, 230, 170, 0x2B2B2B, 0x2B2B2B,
  690. 1, true)
  691.  
  692. end
  693. --
  694. function rcorrer_times(L, cantidad_times)
  695. local t = 4
  696. for i = 1, cantidad_times, 1 do
  697. add_points(L[i].name, t)
  698. tfm.exec.setPlayerScore(L[i].name, t, true)
  699. t = t / 2
  700. end
  701. end
  702.  
  703. function addpoints_time(L)
  704. if #L >= 3 then
  705. rcorrer_times(L, 3)
  706. elseif #L == 2 then
  707. rcorrer_times(L, 2)
  708. elseif #L == 1 then
  709. rcorrer_times(L, 1)
  710. end
  711. end
  712.  
  713. function establecerEquipos()
  714. teams.Team1 = {}
  715. teams.Team2 = {}
  716. local equipo = 1
  717. local jugadoresTotal = {}
  718. for name, p in pairs(tfm.get.room.playerList) do
  719. table.insert(jugadoresTotal, name)
  720. end
  721. for i = 1, #jugadoresTotal do
  722. numJugador = math.random(#jugadoresTotal)
  723. agregarJugador = jugadoresTotal[numJugador]
  724. table.remove(jugadoresTotal, numJugador)
  725. if equipo == 1 then
  726. table.insert(teams.Team1, agregarJugador)
  727. equipo = 2
  728. elseif equipo == 2 then
  729. table.insert(teams.Team2, agregarJugador)
  730. equipo = 1
  731. end
  732. end
  733. grafico()
  734. end
  735.  
  736. function establecerPuntos()
  737. for name in pairs(tfm.get.room.playerList) do
  738. tfm.exec.setPlayerScore(name, 0)
  739. end
  740. end
  741.  
  742. function eventTextAreaCallback(id, player, callback)
  743. if admin[player] then
  744. if callback == 'equiposRandom' then
  745. establecerEquipos()
  746. colores()
  747. elseif callback == 'vaciarTeams' then
  748. teams.Team1 = {}
  749. teams.Team2 = {}
  750. grafico()
  751. elseif callback == 'iniciarJuego' then
  752. for i = 661, 671 do ui.removeTextArea(i) end
  753. newMap()
  754. establecerPuntos()
  755.  
  756. end
  757. end
  758. end
  759.  
  760. function grafico()
  761. ui.addTextArea(661, "", nil, 300, 143, 200, 13, 0x2B2B2B, 0x121212, 0.7,
  762. true)
  763. ui.addTextArea(662, "", nil, 300, 243, 200, 13, 0x2B2B2B, 0x121212, 0.7,
  764. true)
  765. ui.addTextArea(666, "<p align='center'><font color='#CB546B'>" ..
  766. (table.concat(teams.Team1, "\n") or ""), nil, 150, 140,
  767. 175, 200, 0x2B2B2B, 0x121212, 1, true)
  768. ui.addTextArea(667, "<p align='center'><font color='#2F7FCC'>" ..
  769. (table.concat(teams.Team2, "\n") or ""), nil, 450, 140,
  770. 175, 200, 0x2B2B2B, 0x121212, 1, true)
  771. ui.addTextArea(664, "<p align='center'><font color='#CB546B'><b>Team 1",
  772. nil, 143, 115, 190, 20, 0x2B2B2B, 0x121212, 1, true)
  773. ui.addTextArea(665, "<p align='center'><font color='#2F7FCC'><b>Team 2",
  774. nil, 443, 115, 190, 20, 0x2B2B2B, 0x121212, 1, true)
  775. ui.addTextArea(668,
  776. "<p align='center'><V><a href='event:iniciarJuego'><font color='#F93018'><b>Iniciar",
  777. nil, 363, 140, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  778. ui.addTextArea(663, "", nil, 290, 343, 200, 13, 0x2B2B2B, 0x121212, 1, true)
  779. ui.addTextArea(669,
  780. "<p align='center'><V><a href='event:equiposRandom'><font color='#00C17C'><b>Llenar",
  781. nil, 463, 341, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  782. ui.addTextArea(670,
  783. "<p align='center'><V><a href='event:vaciarTeams'><font color='#00C17C'><b>Vaciar",
  784. nil, 263, 341, 0, 0, 0x2B2B2B, 0x121212, 1, true)
  785. end
  786.  
  787. function cantidadMaps()
  788. if juego_activo == false then
  789. for name in pairs(admin) do
  790. ui.addTextArea(671,
  791. "<b><font color='#00C17C' size ='12'>Ez Maps " ..
  792. c_ez ..
  793. "</font>\n<font color='#EBC244' size ='12'>Med Maps " ..
  794. c_m ..
  795. "</font>\n<font color='#CB546B' size ='12'>Hard Maps " ..
  796. c_h ..
  797. "</font>\n<font color='#F93018' size ='12'>Ult Maps " ..
  798. c_u ..
  799. "</font>\n\n<BV><font size ='12'>Time Map " ..
  800. time_map .. "\nTime Lob " .. time_lobby, name,
  801. 10, 143, 100, 0, 0x2B2B2B, 0x121212, 0.7, true)
  802. end
  803. end
  804. end
  805.  
  806. function main()
  807. tfm.exec.newGame(7692636)
  808. grafico()
  809. tfm.exec.setGameTime(10000)
  810. cantidadMaps()
  811. end
  812.  
  813. main()
  814.  
  815. function eventPlayerRespawn(playerName) alreadyRespawn[playerName] = true end
  816.  
  817. -- hola amiguitos
  818.  
  819. -- ui.addTextArea ( id, texto, jogador, x, y, largura, altura, corFundo, corBorda, opacidade, posicaoFixa )
  820. --Mostra uma textarea.
  821. -- Parâmetros:
  822. --  - id (Int) : o id da textarea
  823. --  - texto (String) : o texto a ser mostrado
  824. -- - jogador (String) : o jogador que poderá ver a popup (se nil, aplica-se para todos os jogadores)
  825. --  - x (Int) : a coordenada horizontal do topo, a esquerda (valor padrão = 50)
  826. --  - y (Int) : a coordenada vertical do topo, a esquerda (valor padrão = 50)
  827. -- - largura (Int) : a largura em pixeis da textarea (se 0, será ajustado de acordo com a largura do texto) (valor padrão = 0)
  828. -- - altura (Int) : a altura em pixeis da textarea (se 0, será ajustado de acordo com a altura do texto) (valor padrão = 0)
  829. -- - corFundo (Int) : a cor de fundo da textarea (valor padrão = 0x324650)
  830. -- - corBorda (Int) : a cor da borda da textarea (valor padrão = 0)
  831. -- - opacidade (Number) : a opacidade do fundo da textarea, de 0 (transparente) até 1 (opaco) (valor padrão = 1)
  832. -- - 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