Advertisement
Guest User

lua by hurley

a guest
Dec 6th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.55 KB | None | 0 0
  1. --[[
  2. __ __ __ ___ __ _ __ __ ____
  3. / / / / / / / _ | / / | | / / _/_/ / __/
  4. / /__/ /_/ / / __ | / / | |/ / _/_/ _\ \
  5. /____/\____/ /_/ |_| / / |___/ /_/ /___/
  6. /_/
  7. _____ _ _ _ _
  8. |_ _| | || | | | | |
  9. | | _ __ ___ | || | ___ __ _ _ __ __| | ___ | | ___
  10. | | | '__| / _ \ | || | / _ \ / _` || '_ \ / _` | / _ \ | | / _ \
  11. | | | | | (_) || || || __/| (_| || | | || (_| || (_) || || (_) |
  12. \_/ |_| \___/ |_||_| \___| \__,_||_| |_| \__,_| \___/ |_| \___/
  13. V4.9
  14. -----------------------------------------------------------------------------------]]
  15. local ADMINISTRADOR = "Hurley#8256" -- Cambia tu nombre para ser administrador
  16. -----------------------------------------------------------------------------------]]
  17. --[[
  18. Comandos:
  19. !saltar - Para cambiar de mapa
  20. !puntos - Para cambiar el puntaje, ej: !puntos team1 5
  21. !np @codigo - Para poner cualquier mapa
  22. !pausa - Para pausar el juego
  23. !team - Para asignar jugadores a un equipo, ej: !team1 Trolleandolo
  24. !d NUMERO - Asigna el puntaje para ganar, ej: !d 20
  25. !añadir team nick - Añade un jugador a el equipo especificado, ej: !añadir team4 Trolleandolo
  26. !reset - Resetea el juego
  27. !quitar NOMBRE - saca a un jugador del juego
  28. !puntaje - para ver el puntaje [SOLO EN MODO DEATHMATCH]
  29. --------------------------------------------------------------------
  30. ]]
  31. -----------------------------------------------------------------------------------
  32. local WINS = 15 -- Puntaje para ganar.
  33. ------------------------------------------------------------------------------------
  34. --[[
  35. MEJORAS DE LA VERSIÓN
  36. [BOTÓN REVANCHA EN DEATHMATCH Y TEAMS]
  37. [SE QUITÓ UN BUG]
  38. [SE AÑADIERON MAPAS DE BOOTCAMP]
  39. [SE REDUJERON LAS PROBABILIDADES DE BUG]
  40. [SE AÑADIÓ MODO 2 TEAMS AL AZAR]
  41. ]]
  42.  
  43. system.disableChatCommandDisplay("np", true)
  44. system.disableChatCommandDisplay("pause", true)
  45. system.disableChatCommandDisplay("saltar", true)
  46. system.disableChatCommandDisplay("puntaje", true)
  47. tfm.exec.disablePhysicalConsumables()
  48. tfm.exec.disableAutoShaman()
  49. tfm.exec.disableAutoNewGame()
  50. tfm.exec.disableAutoTimeLeft()
  51. local teams = {
  52. [1] = {},
  53. [2] = {},
  54. [3] = {},
  55. [4] = {},
  56. }
  57. local points = {
  58. [1] = 0,
  59. [2] = 0,
  60. [3] = 0,
  61. [4] = 0,
  62. }
  63. local equipos = {}
  64. local puntos = {}
  65. local modob = "racing"
  66. local modo = "bootcamp"
  67. local modo2 = "Deathmatch"
  68. local modo2b = "normal"
  69. local tiempo = 60
  70. tonumber(tiempo)
  71. local isfirst = false
  72. local gameRunning = false
  73. local winTime = false
  74. local playersInGame = {}
  75. local distanciax = 30
  76. local distanciay = 80
  77. local textarealugar = 300
  78. local textareaid = 0
  79. local mapasmix = {}
  80. local mapasbootcamp= {}
  81. local mapasracing = {2806,2283,166705,112790,138678,180619,191753,209708,209799,5053907,152299,168776,401945,185760,150692,362549,589026,1589026,1975684,155168,507308,255542,429897,444490,545493,168776,401945,185760,150692,2262476,1975684,155168,507308,255542,429897,164802,410565,443309,1321417,171152,3453351,215938,410608,2894072,2683170,330441,4238784,2286056,180191,392492,339418,402453,1405249,3778128,178657,2030343,447556,496091,407495,387290,1976007,2806,262144,178545,1595600,1174107,220500,223810,1256845,1448760,232699,2455250,261720,314205,283715,208914,3575425,240973,1252122,759128,355957,6563851,1281700,404440,414683,250610,363638,505963,1987990,138036,586622,360273,382977,136966,1327182,412316,2287914,3822290,1373000,327254,214775,418337,238380,3801780,1694602,6050338,340069,5408572,463195,5422102,262144,586622,418658,397938,4469627,423517,531569,3680220,402274,349389,2423312,2577060,5699298,1975753,4681759,361382,483924,385295,410230,3548376,2134537,3967150,206810,395459,1364063,214037,1208798,391625,359055,401945,117548,216553,130763,217881,144468,219548,223293,225017,229827,229835,232140,232699,233687,234959,235034,235501,246790,245223,248098,252759,253883,261959,263182,278916,422580,387270,146801,1639996,5053907,399673,405295,324355,616433,3639993,1555532,426638,6571336,1973574,407686}
  82.  
  83.  
  84.  
  85. local maps = mapasracing
  86. local equipoc= {}
  87. local colors = {
  88. [1] = "e54427",
  89. [2] = "0a98db",
  90. [3] = "00ff00",
  91. [4] = "ffff00",
  92. }
  93. local queue = {}
  94. local nteam = 1
  95. local azar = {}
  96. local posicion = {}
  97. local modoazar = ""
  98. local numeroposicion = 1
  99. local totales = 0
  100. local totales2 = 0
  101. local jugando = {}
  102. local totaljugando = 1
  103. local jugandoposicion = {}
  104. function newMap()
  105. local mapcode = maps[math.random(#maps)]
  106. if #queue > 0 then
  107. mapcode = queue[1]
  108. table.remove(queue, 1)
  109. end
  110. tfm.exec.newGame(mapcode)
  111. for player, data in pairs(tfm.get.room.playerList) do
  112. if not playersInGame[player] then
  113. tfm.exec.killPlayer(player)
  114. end
  115. end
  116. tfm.exec.setGameTime(tiempo)
  117. if modo2b == "Deathmatch" then
  118. borrarScoreDeathmatch()
  119. end
  120. end
  121. function modoalazar()
  122. ui.addTextArea(38, "", nil, 235, 30, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  123. ui.addTextArea(37, "<p align='center'><V>Administrador: "..ADMINISTRADOR, nil, 235, 30, 300, 20, 0x324650, 0x324650, 1, true)
  124. ui.addTextArea(2, "", nil, 142, 71, 516, 290, 0x0E1417, 0x0E1417, 1, true)
  125. ui.addTextArea(4, "", nil, 231, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  126. ui.addTextArea(5, "<p align='center'><V>Team 1", nil, 232, 80, 140, 20, 0x324650, 0x324650, 1, true)
  127. ui.addTextArea(6, "", nil, 399, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  128. ui.addTextArea(7, "<p align='center'><V>Team 2", nil, 400, 80, 140, 20, 0x324650, 0x324650, 1, true)
  129. for i=8, 11 do
  130. ui.removeTextArea(i)
  131. end
  132. ui.addTextArea(40, "", nil, 231, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  133. ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 232, 121, 138, 198, 0x324650, 0x324650, 1, true)
  134. for i=32, 35 do
  135. ui.removeTextArea(i)
  136. end
  137. ui.addTextArea(36, "", nil, 399, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  138. ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 400, 121, 138, 198, 0x324650, 0x324650, 1, true)
  139. ui.addTextArea(14, "<p align='center'><font color='#5A7A8B'>____ ____</font>", nil, 320, 197, 140, 200, 0, 0, 0, true)
  140. ui.addTextArea(15, "", nil, 367, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  141. ui.addTextArea(16, "<p align='center'><V>VS", nil, 368, 203, 38, 18, 0x324650, 0x324650, 1, true)
  142. ui.addTextArea(42, "", ADMINISTRADOR, 600, 81, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  143. ui.addTextArea(41, "<p align='center'><V><a href='event:salir'>X", ADMINISTRADOR, 601, 82, 38, 18, 0x324650, 0x324650, 1, true)
  144. ui.addTextArea(45, "", ADMINISTRADOR, 600, 139, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  145. ui.addTextArea(46, "<p align='center'><V><a href='event:reset'>Reset", ADMINISTRADOR, 601, 140, 50, 18, 0x324650, 0x324650, 1, true)
  146. ui.addTextArea(47, "", ADMINISTRADOR, 600, 173, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  147. ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  148. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 368, 203, 38, 18, 0x324650, 0x324650, 1, true)
  149. ui.addTextArea(57, "", ADMINISTRADOR, 600, 207, 57, 25, 0x5A7A8B, 0x5A7A8B, 1, true)
  150. ui.addTextArea(58, "<p align='center'><V><a href='event:volver'><font size='10'>4 Teams", ADMINISTRADOR, 601, 208, 55, 23, 0x324650, 0x324650, 1, true)
  151. ui.removeTextArea(59)
  152. ui.removeTextArea(60)
  153. ui.removeTextArea(53)
  154. ui.removeTextArea(51)
  155. ui.removeTextArea(54)
  156. ui.addTextArea(56, "<p align='center'><V><a href='event:azart'><font size='12'>Azar", ADMINISTRADOR, 601, 246, 55, 18, 0x324650, 0x324650, 1, true)
  157.  
  158.  
  159. verificarmodo2()
  160. end
  161. function eventPlayerWon(player)
  162. if not isfirst then
  163. isfirst = true
  164. tfm.exec.setGameTime(3)
  165. if modo2b == "Deathmatch" then
  166. if puntos[player] >= WINS - 1 then
  167. gameRunning = false
  168. winTime = os.time()
  169. ui.addTextArea(29, string.format("<p align='center'><font size='37' color='#000000'>%s ganó\nLos otros son perdedores xdxdxd", player), nil, 3, 168, 800, 500, 0, 0, 0, true)
  170. ui.addTextArea(30, string.format("<p align='center'><font size='37'><font color='#cecece'><font color='#ff0000'>%s </font>ganó\nLos otros son perdedores xdxdxd", player), nil, 1, 170, 800, 500, 0, 0, 0, true)
  171. ui.addTextArea(16, "<p align='center'><font color='#225066' size='18' face='Tw Cen MT Condensed'><a href='event:iniciarJogo'>DE NUEVO", ADMINISTRADOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
  172. end
  173. tfm.exec.setGameTime(3)
  174. puntos[player] = puntos[player]+1
  175. equipoc[player] = "0x115b17"
  176. displayScoreDeathmatch()
  177. end
  178. if modo2b == "normal" then
  179. if table.contains(teams[1], player) then
  180. tfm.exec.setGameTime(3)
  181.  
  182. points[1] = points[1]+1
  183. elseif table.contains(teams[2], player) then
  184. tfm.exec.setGameTime(3)
  185.  
  186. points[2] = points[2]+1
  187. elseif table.contains(teams[3], player) then
  188. tfm.exec.setGameTime(3)
  189.  
  190. points[3] = points[3]+1
  191. elseif table.contains(teams[4], player) then
  192. tfm.exec.setGameTime(3)
  193.  
  194. points[4] = points[4]+1
  195. else
  196. isfirst = false
  197. end
  198. winner = false
  199. if points[1] >= WINS then
  200. winner = 1
  201. elseif points[2] >= WINS then
  202. winner = 2
  203. elseif points[3] >= WINS then
  204. winner = 3
  205. elseif points[4] >= WINS then
  206. winner = 4
  207. end
  208. if winner then
  209. gameRunning = false
  210. winTime = os.time()
  211. local names = {
  212. "Rojo",
  213. "Azul",
  214. "Verde",
  215. "Amarillo",
  216. }
  217. ui.addTextArea(26, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\nLos otros son perdedores xdxdxd", names[winner]), nil, 0, 171, 800, 500, 0, 0, 0, true)
  218. ui.addTextArea(27, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\nLos otros son perdedores xdxdxd", names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
  219. ui.addTextArea(28, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\nLos otros son perdedores xdxdxd", names[winner]), nil, 2, 169, 800, 500, 0, 0, 0, true)
  220. ui.addTextArea(29, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\nLos otros son perdedores xdxdxd", names[winner]), nil, 3, 168, 800, 500, 0, 0, 0, true)
  221. ui.addTextArea(30, string.format("<p align='center'><font size='37'><font color='#cecece'>El equipo <font color='#%s'>%s</font> Ganó\nLos otros son perdedores xdxdxd", colors[winner], names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
  222. ui.addTextArea(16, "<p align='center'><font color='#225066' size='18' face='Tw Cen MT Condensed'><a href='event:iniciarJogo'>REVANCHA", ADMINISTRADOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
  223. end
  224. displayScore()
  225. end
  226. end
  227. end
  228. function eventLoop(elapsed, remain)
  229. if gameRunning then
  230. remain = remain/1000
  231. if remain < 0 then
  232. remain = 100
  233. newMap()
  234. end
  235. else
  236. if winTime then
  237. if winTime > os.time()-30000 then
  238. else
  239. winTime = false
  240. ui.removeTextArea(26)
  241. ui.removeTextArea(27)
  242. ui.removeTextArea(28)
  243. ui.removeTextArea(29)
  244. ui.removeTextArea(30)
  245. displayTeams()
  246. teams = {
  247. [1] = {},
  248. [2] = {},
  249. [3] = {},
  250. [4] = {},
  251. }
  252. points = {
  253. [1] = 0,
  254. [2] = 0,
  255. [3] = 0,
  256. [4] = 0,
  257. }
  258. playersInGame = {}
  259. end
  260. end
  261. end
  262. end
  263. function string.title(s)
  264. return string.gsub(s, "%a", function(c)
  265. return string.upper(c)
  266. end, 1)
  267. end
  268. function resetmostrarjugadoresdeathmatch()
  269. distanciax = 30
  270. distanciay = 80
  271. textarealugar = 302
  272. textareaid = 0
  273. end
  274. function eventChatCommand(player, command)
  275. if modo2b == "Deathmatch" then
  276. args = string.split(command, " ")
  277. if args[1] == "puntaje" then
  278. resetmostrarjugadoresdeathmatch()
  279. ui.addTextArea(300, "<p align='center'><V><a href='event:cerrarpuntaje'>X", player, 30, 50, 30, 16, 0x324650, 0x324650, 1, true)
  280. ui.addTextArea(301, string.format("<p align='center'><V>Deathmatch a %s puntos",WINS), player, 80, 45, 180, 18, 0x324650, 0x000000, 1, true)
  281. for k,players in pairs(tfm.get.room.playerList) do
  282. if puntos[k] then
  283. equipos[k] = k
  284. playersInGame[k] = true
  285. if textareaid >= 32 then
  286. else
  287. ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), player, distanciax, distanciay, 140, 18, 0x324650, 0x000000, 1, true)
  288. distanciay = distanciay + 37
  289. textareaid = textareaid + 1
  290. textarealugar = textarealugar + 1
  291. if textareaid == 8 then
  292. distanciax = distanciax + 190
  293. distanciay = 80
  294. textareaid = 0
  295. end
  296. end
  297. end
  298. end
  299. end
  300. end
  301. if player:lower() == ADMINISTRADOR:lower() then
  302. args = string.split(command, " ")
  303. if args[1] == "team1" then
  304. if modo2b == "normal" then
  305. table.remove(args, 1)
  306. teams[1] = {}
  307. points[1] = 0
  308. for index, player in pairs(args) do
  309. player = string.title(player)
  310. table.insert(teams[1], player)
  311. playersInGame[player] = true
  312. end
  313. if modoazar == "true" then
  314. modoalazar()
  315. else
  316. displayTeams()
  317. end
  318. end
  319. elseif args[1] == "team2" and modo2b == "normal" then
  320. table.remove(args, 1)
  321. teams[2] = {}
  322. points[2] = 0
  323. for index, player in pairs(args) do
  324. player = string.title(player)
  325. table.insert(teams[2], player)
  326. playersInGame[player] = true
  327. end
  328. if modoazar == "true" then
  329. modoalazar()
  330. else
  331. displayTeams()
  332. end
  333. elseif args[1] == "team3" and modo2b == "normal" then
  334. table.remove(args, 1)
  335. teams[3] = {}
  336. points[3] = 0
  337. for index, player in pairs(args) do
  338. player = string.title(player)
  339. table.insert(teams[3], player)
  340. playersInGame[player] = true
  341. end
  342. if modoazar == "true" then
  343. modoalazar()
  344. else
  345. displayTeams()
  346. end
  347. elseif args[1] == "team4" and modo2b == "normal" then
  348. table.remove(args, 1)
  349. teams[4] = {}
  350. points[4] = 0
  351. for index, player in pairs(args) do
  352. player = string.title(player)
  353. table.insert(teams[4], player)
  354. playersInGame[player] = true
  355. end
  356. if modoazar == "true" then
  357. modoalazar()
  358. else
  359. displayTeams()
  360. end
  361. elseif args[1] == "saltar" then
  362. newMap()
  363. elseif args[1] == "np" then
  364. if args[2] then
  365. table.insert(queue, args[2])
  366. end
  367. elseif args[1] == "d" then
  368. if args[2] then
  369. WINS = tonumber(args[2])
  370. displayScore()
  371. end
  372. elseif args[1] == "añadir" and modo2b == "Deathmatch" then
  373. if args[2] then
  374. table.remove(args, 1)
  375. for index, player in pairs(args) do
  376. equipos[player] = player
  377. puntos[player] = 0
  378. playersInGame[player] = true
  379. end
  380. end
  381. elseif args[1] == "añadir" and modo2b == "normal" then
  382. if args[2] and args[3] then
  383. if args[2] == "team1" and modo2b == "normal" then
  384. table.remove(args, 1)
  385. table.remove(args, 1)
  386. for index, player in pairs(args) do
  387. player = string.title(player)
  388. table.insert(teams[1], player)
  389. playersInGame[player] = true
  390. end
  391. end
  392. if args[2] == "team2" and modo2b == "normal" then
  393. table.remove(args, 1)
  394. table.remove(args, 1)
  395. for index, player in pairs(args, 3) do
  396. player = string.title(player)
  397. table.insert(teams[2], player)
  398. playersInGame[player] = true
  399. end
  400. end
  401. if args[2] == "team3" and modo2b == "normal" then
  402. table.remove(args, 1)
  403. table.remove(args, 1)
  404. for index, player in pairs(args) do
  405. player = string.title(player)
  406. table.insert(teams[3], player)
  407. playersInGame[player] = true
  408. end
  409. end
  410. if args[2] == "team4" and modo2b == "normal" then
  411. table.remove(args, 1)
  412. table.remove(args, 1)
  413. for index, player in pairs(args) do
  414. player = string.title(player)
  415. table.insert(teams[4], player)
  416. playersInGame[player] = true
  417. end
  418. end
  419. end
  420. elseif args[1] == "quitar" then
  421. if args[2] then
  422. for index, player in pairs(args) do
  423. player = string.title(player)
  424. playersInGame[player] = false
  425. end
  426. end
  427. elseif args[1] == "reset" then
  428. teams[1] = {}
  429. points[1] = 0
  430. teams[2] = {}
  431. points[2] = 0
  432. teams[3] = {}
  433. points[3] = 0
  434. teams[4] = {}
  435. points[4] = 0
  436. equipos = {}
  437. puntos = {}
  438. modob = "racing"
  439. modo = "bootcamp"
  440. modo2 = "Deathmatch"
  441. modo2b = "normal"
  442. displayTeams()
  443.  
  444.  
  445. elseif args[1] == "puntos" and modo2b == "normal" then
  446. if args[2] and args[3] then
  447. local team = tonumber(args[2]:match("team(%d+)") or 0)
  448. if team > 0 and team < 5 then
  449. local newScore = tonumber(args[3]) or points[team]
  450. points[team] = newScore
  451. displayScore()
  452. end
  453. end
  454. elseif args[1] == "pausa" then
  455. gameRunning = not gameRunning
  456. if not gameRunning then
  457. ui.addTextArea(90, "", nil, 235, 200, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  458. ui.addTextArea(91, "<p align='center'><V> Juego pausado ", nil, 235, 200, 300, 20, 0x324650, 0x324650, 1, true)
  459. tfm.exec.disableAutoTimeLeft(true)
  460. else
  461. ui.removeTextArea(90)
  462. ui.removeTextArea(91)
  463. tfm.exec.disableAutoTimeLeft(false)
  464. end
  465. end
  466. end
  467. end
  468. function eventNewGame()
  469. if gameRunning then
  470. if modo2b == "normal" then
  471. isfirst = false
  472. for i, p in pairs(teams[1]) do
  473. tfm.exec.setNameColor(p, "0x"..colors[1])
  474. end
  475. for i, p in pairs(teams[2]) do
  476. tfm.exec.setNameColor(p, "0x"..colors[2])
  477. end
  478. for i, p in pairs(teams[3]) do
  479. tfm.exec.setNameColor(p, "0x"..colors[3])
  480. end
  481. for i, p in pairs(teams[4]) do
  482. tfm.exec.setNameColor(p, "0x"..colors[4])
  483. end
  484. displayScore()
  485. end
  486. if modo2b == "Deathmatch" then
  487. isfirst = false
  488. for k,players in pairs(tfm.get.room.playerList) do
  489. tfm.exec.setNameColor(k, "0xff0000")
  490. equipoc[k] = "0x324650"
  491. end
  492. displayScore()
  493. end
  494. end
  495. end
  496. function displayScore()
  497. if modo2b == "normal" then
  498. if modoazar == "true" then
  499. ui.addTextArea(25, string.format("<p align='center'><font size='20'><font color='#%s'>%s<N> x <font color='#%s'>%s <N> / <font color='#111111'>%s", colors[1], points[1], colors[2], points[2], WINS), nil, 0, 22, 800, 30, 0, 0, 0, true)
  500. end
  501. if modoazar == "false" then
  502. ui.addTextArea(25, string.format("<p align='center'><font size='20'><font color='#%s'>%s<N> x <font color='#%s'>%s <N> x <font color='#%s'>%s <N> x <font color='#%s'>%s <N> / <font color='#111111'>%s", colors[1], points[1], colors[2], points[2], colors[3], points[3], colors[4], points[4], WINS), nil, 0, 22, 800, 30, 0, 0, 0, true)
  503. end
  504. end
  505. end
  506. function displayScoreDeathmatch()
  507. resetmostrarjugadoresdeathmatch()
  508. ui.addTextArea(300, string.format("<p align='center'><V>Deathmatch a %s puntos",WINS), nil, 80, 45, 180, 18, 0x324650, 0x000000, 1, true)
  509. for k,players in pairs(tfm.get.room.playerList) do
  510. if puntos[k] then
  511. equipos[k] = k
  512. playersInGame[k] = true
  513. if textareaid >= 32 then
  514. else
  515. ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), nil, distanciax, distanciay, 140, 18, equipoc[k], 0x000000, 1, true)
  516. distanciay = distanciay + 37
  517. textareaid = textareaid + 1
  518. textarealugar = textarealugar + 1
  519. if textareaid == 8 then
  520. distanciax = distanciax + 190
  521. distanciay = 80
  522. textareaid = 0
  523. end
  524. end
  525. end
  526. end
  527. end
  528. function borrarScoreDeathmatch()
  529. for i = 300, 334 do
  530. ui.removeTextArea(i)
  531. end
  532. end
  533. function displayTeams()
  534. borrarScoreDeathmatch()
  535. modoazar = "false"
  536. ui.addTextArea(38, "", nil, 235, 30, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  537. ui.addTextArea(37, "<p align='center'><V>Administrador: "..ADMINISTRADOR, nil, 235, 30, 300, 20, 0x324650, 0x324650, 1, true)
  538. ui.addTextArea(2, "", nil, 0, 71, 800, 290, 0x0E1417, 0x0E1417, 1, true)
  539. ui.addTextArea(4, "", nil, 57, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  540. ui.addTextArea(5, "<p align='center'><V>Team 1", nil, 58, 80, 140, 20, 0x324650, 0x324650, 1, true)
  541. ui.addTextArea(6, "", nil, 227, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  542. ui.addTextArea(7, "<p align='center'><V>Team 2", nil, 228, 80, 140, 20, 0x324650, 0x324650, 1, true)
  543. ui.addTextArea(8, "", nil, 417, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  544. ui.addTextArea(9, "<p align='center'><V>Team 3", nil, 418, 80, 140, 20, 0x324650, 0x324650, 1, true)
  545. ui.addTextArea(10, "", nil, 587, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  546. ui.addTextArea(11, "<p align='center'><V>Team 4", nil, 588, 80, 140, 20, 0x324650, 0x324650, 1, true)
  547. ui.addTextArea(12, "<p align='center'><font color='#5A7A8B'>|</font>", nil, 210, 102, 140, 200, 0, 0, 0, true)
  548. ui.addTextArea(39, "<p align='center'><font color='#5A7A8B'>|</font>", nil, 450, 102, 140, 200, 0, 0, 0, true)
  549. ui.addTextArea(40, "", nil, 59, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  550. ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 60, 121, 138, 198, 0x324650, 0x324650, 1, true)
  551. ui.addTextArea(32, "", nil, 419, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  552. ui.addTextArea(33, "<p align='center'><font color='#"..colors[3].."'>"..table.concat(teams[3], "\n"), nil, 420, 121, 138, 198, 0x324650, 0x324650, 1, true)
  553. ui.addTextArea(34, "", nil, 589, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  554. ui.addTextArea(35, "<p align='center'><font color='#"..colors[4].."'>"..table.concat(teams[4], "\n"), nil, 590, 121, 138, 198, 0x324650, 0x324650, 1, true)
  555. ui.addTextArea(36, "", nil, 229, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  556. ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 230, 121, 138, 198, 0x324650, 0x324650, 1, true)
  557. ui.addTextArea(14, "<p align='center'><font color='#5A7A8B'>____ ____</font>", nil, 325, 197, 140, 200, 0, 0, 0, true)
  558. ui.addTextArea(15, "", nil, 374, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  559. ui.addTextArea(16, "<p align='center'><V>VS", nil, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
  560. ui.addTextArea(42, "", ADMINISTRADOR, 749, 81, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  561. ui.addTextArea(41, "<p align='center'><V><a href='event:salir'>X", ADMINISTRADOR, 750, 82, 38, 18, 0x324650, 0x324650, 1, true)
  562. ui.addTextArea(45, "", ADMINISTRADOR, 744, 139, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  563. ui.addTextArea(46, "<p align='center'><V><a href='event:reset'>Reset", ADMINISTRADOR, 745, 140, 50, 18, 0x324650, 0x324650, 1, true)
  564. ui.addTextArea(47, "", ADMINISTRADOR, 741, 173, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  565. ui.addTextArea(54, "", ADMINISTRADOR, 741, 209, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  566. if modo2 == "Deathmatch" then
  567. ui.addTextArea(51, "<p align='center'><V><a href='event:Deathmatch'><font size='8'>"..modo2, ADMINISTRADOR, 742, 210, 55, 18, 0x324650, 0x324650, 1, true)
  568. end
  569. verificarmodo()
  570. ui.addTextArea(53, "", ADMINISTRADOR, 741, 245, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  571. ui.addTextArea(56, "<p align='center'><V><a href='event:llenar'><font size='12'>Llenar", ADMINISTRADOR, 742, 246, 55, 18, 0x324650, 0x324650, 1, true)
  572. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
  573. ui.addTextArea(57, "", ADMINISTRADOR, 741, 281, 57, 25, 0x5A7A8B, 0x5A7A8B, 1, true)
  574. ui.addTextArea(58, "<p align='center'><V><a href='event:azart'><font size='12'>", ADMINISTRADOR, 742, 282, 55, 23, 0x324650, 0x324650, 1, true)
  575. ui.addTextArea(59, "<p align='center'><V><a href='event:azart'><font size='12'>teams", ADMINISTRADOR, 742, 290, 55, 23, 0x000000, 0x000000, 1, true)
  576. ui.addTextArea(60, "<p align='center'><V><a href='event:azart'><font size='12'>Azar 2", ADMINISTRADOR, 742, 278, 55, 23, 0x000000, 0x000000, 1, true)
  577. end
  578. function verificarmodo()
  579. ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  580. if modo2 == "normal" then
  581. ui.addTextArea(51, "<p align='center'><V><a href='event:normal'><font size='8'>"..modo2, ADMINISTRADOR, 742, 210, 55, 18, 0x324650, 0x324650, 1, true)
  582. end
  583. if modo == "bootcamp" then
  584. ui.addTextArea(48, "<p align='center'><V><a href='event:bootcamp'><font size='9'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  585. end
  586. if modo == "racing" then
  587. ui.addTextArea(48, "<p align='center'><V><a href='event:racing'><font size='9'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  588. end
  589. if modo == "mix" then
  590. ui.addTextArea(48, "<p align='center'><V><a href='event:mix'><font size='9'>"..modo, ADMINISTRADOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  591. end
  592. end
  593. function contarjugadores()
  594. local players=0
  595. function eventNewPlayer(name)--Cuando un jugador entre a la sala...
  596. players=players+1--Sumamos 1 a nuestra tabla
  597. end
  598. function eventPlayerLeft(name)--Cuando un jugador salga de la sala...
  599. players=players-1--Restamos 1 a nuestra tabla
  600. end
  601. for name in pairs(tfm.get.room.playerList) do--Por cada jugador que esté en la sala...
  602. eventNewPlayer(name)--Le ejecutamos la función eventNewPlayer
  603. end
  604. end
  605. function eventTextAreaCallback(id, player, callback)
  606. if callback == 'iniciarJogo' then
  607. gameRunning = true
  608. for i = 1, 20 do
  609. ui.removeTextArea(i)
  610. end
  611. for i = 26, 60 do
  612. ui.removeTextArea(i)
  613. end
  614. borrarScoreDeathmatch()
  615. newMap()
  616. if modo2b == "normal" then
  617. points[1] = 0
  618. points[2] = 0
  619. points[3] = 0
  620. points[4] = 0
  621. displayScore()
  622. end
  623. if modo2b == "Deathmatch" then
  624. for k,v in pairs(tfm.get.room.playerList) do
  625. puntos[k] = 0
  626. end
  627. end
  628. end
  629. if callback == 'salir' then
  630. tfm.system.exit()
  631. end
  632.  
  633. if callback == 'llenar' then
  634. nteam = 1
  635. azar = {}
  636. playersInGame = {}
  637.  
  638. teams = {
  639. [1] = {},
  640. [2] = {},
  641. [3] = {},
  642. [4] = {},
  643. }
  644. contarjugadores()
  645. for k,players in pairs(tfm.get.room.playerList) do
  646. if nteam > 4 then
  647. nteam = 1
  648. end
  649. table.insert(teams[nteam], k)
  650. playersInGame[k] = true
  651. nteam = nteam + 1
  652. displayTeams()
  653. end
  654. end
  655.  
  656.  
  657.  
  658. if callback == 'reset' then
  659. teams[1] = {}
  660. points[1] = 0
  661. teams[2] = {}
  662. points[2] = 0
  663. teams[3] = {}
  664. points[3] = 0
  665. teams[4] = {}
  666. points[4] = 0
  667. equipos = {}
  668. puntos = {}
  669. modob = "racing"
  670. modo = "bootcamp"
  671. modo2 = "Deathmatch"
  672. modo2b = "normal"
  673. displayTeams()
  674.  
  675. end
  676. if callback == 'bootcamp' then
  677. tiempo = 150
  678. modob = "bootcamp"
  679. modo = "mix"
  680. verificarmodo()
  681. maps = mapasbootcamp
  682. end
  683. if callback == 'racing' then
  684.  
  685. tiempo = 60
  686. modob = "racing"
  687. modo = "bootcamp"
  688. verificarmodo()
  689. maps = mapasracing
  690. end
  691. if callback == 'mix' then
  692. tiempo = 90
  693. modob = "mix"
  694. modo = "racing"
  695. verificarmodo()
  696. maps = mapasmix
  697. end
  698. if callback == 'Deathmatch' then
  699. modo2b = "Deathmatch"
  700. modo2 = "normal"
  701. displayTeams()
  702. for i = 4, 15 do
  703. ui.removeTextArea(i)
  704. end
  705. for i = 31, 36 do
  706. ui.removeTextArea(i)
  707. end
  708. for i = 39, 40 do
  709. ui.removeTextArea(i)
  710. end
  711. ui.removeTextArea(53)
  712. ui.removeTextArea(56)
  713. contarjugadores()
  714. for k,players in pairs(tfm.get.room.playerList) do
  715. equipos[k] = k
  716. puntos[k] = 0
  717. equipoc[k] = "0x324650"
  718. playersInGame[k] = true
  719. if textareaid >= 32 then
  720. else
  721. ui.addTextArea(textarealugar, "<p align='center'><V>"..k, nil, distanciax, distanciay, 140, 18, 0x324650, 0x324650, 1, true)
  722. distanciay = distanciay + 37
  723. textareaid = textareaid + 1
  724. textarealugar = textarealugar + 1
  725. if textareaid == 8 then
  726. distanciax = distanciax + 190
  727. distanciay = 80
  728. textareaid = 0
  729. end
  730. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRADOR, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
  731. end
  732. end
  733. end
  734. if callback == 'normal' then
  735. modo2b = "normal"
  736. modo2 = "Deathmatch"
  737. resetmostrarjugadoresdeathmatch()
  738. displayTeams()
  739. end
  740. if callback == 'cerrarpuntaje' then
  741. borrarScoreDeathmatch()
  742. end
  743. if callback == 'azart' then
  744. totales = 0
  745. totales2 = 0
  746. jugando = {}
  747. totaljugando = 1
  748. jugandoposicion = {}
  749. playersInGame = {}
  750. teams[1] = {}
  751. teams[2] = {}
  752. teams[3] = {}
  753. teams[4] = {}
  754. alazar()
  755. borrarScoreDeathmatch()
  756. modoazar = "true"
  757. modoalazar()
  758. end
  759. if callback == 'volver' then
  760. totales = 0
  761. totales2 = 0
  762. jugando = {}
  763. totaljugando = 1
  764. jugandoposicion = {}
  765. playersInGame = {}
  766. teams[1] = {}
  767. teams[2] = {}
  768. teams[3] = {}
  769. teams[4] = {}
  770. displayTeams()
  771. end
  772. if callback == 'bootcamp2' then
  773. tiempo = 150
  774. modob = "bootcamp"
  775. modo = "mix"
  776. verificarmodo2()
  777. maps = mapasbootcamp
  778. end
  779. if callback == 'racing2' then
  780.  
  781. tiempo = 60
  782. modob = "racing"
  783. modo = "bootcamp"
  784. verificarmodo2()
  785. maps = mapasracing
  786. end
  787. if callback == 'mix2' then
  788. tiempo = 90
  789. modob = "mix"
  790. modo = "racing"
  791. verificarmodo2()
  792. maps = mapasmix
  793. end
  794. end
  795. function alazar()
  796. t = 0
  797. for k,v in pairs(tfm.get.room.playerList) do
  798. if t == 1 then
  799. table.insert(teams[2], k)
  800. playersInGame[k] = true
  801. t = 0
  802. elseif t == 0 then
  803. table.insert(teams[1], k)
  804. playersInGame[k] = true
  805. t = 1
  806. end
  807. end
  808. end
  809.  
  810.  
  811.  
  812. function verificarmodo2()
  813. ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  814. if modo == "bootcamp" then
  815. ui.addTextArea(48, "<p align='center'><V><a href='event:bootcamp2'><font size='9'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  816. end
  817. if modo == "racing" then
  818. ui.addTextArea(48, "<p align='center'><V><a href='event:racing2'><font size='9'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  819. end
  820. if modo == "mix" then
  821. ui.addTextArea(48, "<p align='center'><V><a href='event:mix2'><font size='9'>"..modo, ADMINISTRADOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  822. end
  823. end
  824. function string.split(s, pattern, n)
  825. local st = {}
  826. for sb in string.gmatch(s, "[^"..pattern.."]+") do
  827. if not n or n > -1 then
  828. table.insert(st,sb)
  829. else
  830. st[#st] = st[#st]..pattern..sb
  831. end
  832. n = n and n-1 or false
  833. end
  834. return st
  835. end
  836. function table.contains(tableT, element)
  837. for _, value in pairs(tableT) do
  838. if value == element then
  839. return true
  840. end
  841. end
  842. return false
  843. end
  844. function eventPlayerDied()
  845. local alive = 0
  846. for k,v in pairs(tfm.get.room.playerList) do
  847. if not v.isDead then
  848. alive = alive+1
  849. end
  850. end
  851. if alive == 0 then
  852. newMap()
  853. end
  854. end
  855. displayTeams()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement