Advertisement
Guest User

Untitled

a guest
May 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.24 KB | None | 0 0
  1. --[[
  2. __ __ __ ___ __ _ __ __ ____
  3. / / / / / / / _ | / / | | / / _/_/ / __/
  4. / /__/ /_/ / / __ | / / | |/ / _/_/ _\ \
  5. /____/\____/ /_/ |_| / / |___/ /_/ /___/
  6. /_/
  7. V4.9
  8. -----------------------------------------------------------------------------------]]
  9. local ADMINISTRATOR = "Maxxxiee#0000" -- Change this to your name
  10. -----------------------------------------------------------------------------------]]
  11. -----------------------------------------------------------------------------------]]
  12. local WINS = 15 -- How many points needed for the win?
  13. ------------------------------------------------------------------------------------]]
  14.  
  15. --[[
  16. COMMANDS:
  17.  
  18. !skip - To quickly change the map
  19. !puntos - Set a team's points, for example: !puntos team1 5
  20. !np @mapcode - play a map
  21. !pause - Pause the match
  22. !team - Add multiple players to a team: !team1 Maxxxiee, Avebi
  23. !d NUMBER - Change the amount of wins needed, for example: !d 20
  24. !add team nick - Add a specific player to a team, for example: !add team4 Maxxxiee
  25. !reset - Reset the game
  26. !kick NAME - kick a player from the match
  27.  
  28. --------------------------------------------------------------------
  29. ]]
  30.  
  31. system.disableChatCommandDisplay("np", true)
  32. system.disableChatCommandDisplay("pause", true)
  33. system.disableChatCommandDisplay("skip", true)
  34. system.disableChatCommandDisplay("puntaje", true)
  35. system.disableChatCommandDisplay("info", true)
  36. tfm.exec.disablePhysicalConsumables()
  37. tfm.exec.disableAutoScore()
  38. tfm.exec.disableAutoShaman()
  39. tfm.exec.disableAutoNewGame()
  40. tfm.exec.disableAutoTimeLeft()
  41. local teams = {
  42. [1] = {},
  43. [2] = {},
  44. [3] = {},
  45. [4] = {},
  46. }
  47. local points = {
  48. [1] = 0,
  49. [2] = 0,
  50. [3] = 0,
  51. [4] = 0,
  52. }
  53. local cant1 = 0
  54. local cant2 = 0
  55. local cant3 = 0
  56. local cant4 = 0
  57. local equipos = {}
  58. local puntos = {}
  59. local modeb = "racing"
  60. local mode = "bootcamp"
  61. local mode2 = "Deathmatch"
  62. local mode2b = "normal"
  63. local tiempo = 60
  64. tonumber(tiempo)
  65. local isfirst = false
  66. local gameRunning = false
  67. local winTime = false
  68. local playersInGame = {}
  69. local distanciax = 30
  70. local distanciay = 80
  71. local textarealugar = 300
  72. local textareaid = 0
  73. local mapasmix = {203664,375455,394132,173816,171776,199210,562897,172951,171148,166430,169076,330933,179488,172621,168754,159145,163596,152733,410040,158909,261814,195453,281985,191205,159932,2176211,586901,285589,257324,236768,303151,270924,1324259,1225867,563436,424604,523270,172547,2693587,168204,2693344,193662,1788490,305680,149451,176253,342035,2466489,292808,176615,438333,394125,162482,304861,458528,159298,184648,268915,329318,373105,261298,302080,449496,159187,176710,161023,366260,1852910,201172,549759,257715,397478,261298,177652,408643,447805,155606,176619,460961,455271,172512,320607,166271,299942,150664,186066,152260,155628,166805,178297,313138,167903,223947,191177,185873,113156,156720,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,172520,157098,225744,608368,215933,266398,343875,327354,331344,333002,223174,332130,254785,295487,184817,159691,235717,169228,191203,503679,506032,2747525,192255,208056,171480,182681,219956,270143,2887929,247329,250610,2118599,445133,149853,212903,220737,397296,2617003,629731,329627,221767,422655,417816,164931,245152,371072,2458243,214788,274963,2439335,269534,8679,321268,398041,5591416,5650343,5650250,161730,4273207,4091580,5650303,5172709,5650469,214660,3579335,4003729,508451,314205,156510,5545443,606723,3946626,332467,1665516,1614563,3679884,414899,1531388,905496,3834905,3821104,1851411,3816991,2331474,313245,266854,193588,2141379,3738767,232791,285752,278506,406266,1976857,301315,180469,3693822,280896,403698,259604,418022,323366,594883,477603,437860,590641,3688419,3682405,645288,419374,664949,704015,398942,195720,314159,613985,3683383,3683201,3680223,3680221,363625,1693705,319524,3667358,1718723,1490438,3630433,3620542,3617674,3556489,3548406,3548376,3408247,2953315,2883986,2683170,2645615,2536577,2453022,2372538,2287914,2286056,2223685,2150335,2150335,2101747,2018511,2007205,1975684,1964752,1964700,1956555,1923785,1862800,1716949,1674534,1658171,1659639,1657360,1657021,1654105,1651658,1643157,1634741,1632706,1622737,1619934,1618110,1613550,1612796,1612436,1608638,6212895,1602654,1601492,1586439,1588884,1573997,1567620,1542618,1539791,1513407,1509474,1503393,1487161,1450554,1425101,1394120,1393405,1373000,1371239,1368222,1359797,1358446,1352534,1346440,1321664,1321417,1281981,1255130,1222899,1214182,1195842,1143815,1132357,1058681,979179,829657,813156,798953,749102,737841,627609,624721,608459,616373,594049,606719,586688,580031,564033,558790,551126,545493,536235,528428,511275,508106,501711,496945,496091,483924,472665,472379,447556,445133,444490,441047,438154,436447,436107,431373,430145,429822,428517,427300,425806,424795,422361,421302,420956,420806,418658,418600,416142,412316,410813,412211,410565,410532,410230,407457,407455,407230,407165,406982,406881,406486,405295,403910,401995,401945,401778,397938,397812,397296,396861,396645,391625,387270,387180,386046,385295,386029,379745,378826,379866,364998,359055,352885,352710,350251,344952,340069,339896,339643,337774,323600,319841,317754,309029,308711,308435,306213,292348,278916,277784,275514,270819,1017676,160762,2089069,234039,267187,263163,262144,330590,403698,396105,6538564,396105,419735,6547536,355658,6607378,191716,292348,6456247,5326916,6077025,356722,2564883,1450554,494706,254291,1503393,6467947,6263285,2953315,6114281,412752,4038817,5461992,319841,359901,191716,452016,1450554,397296,250610,499684,5848412,238791,2283,232274,1716693,330590,459349,6583596,455167,6460747,251459,244888,5755208,240973,235501,235034,234039,233398,232274,230510,216735,216439,216505,214037,212542,211565,198715,193936,191716,186604,180274,176263,178657,146801,145020,3154,2283,5382692,5249500,4412890,5163891,789128,2245005,2030343,5712914,372401,5087373,4953687,2369254,4853690,226069,422509,5436200,732880,4038817,400866,3730656,3985806,355658,5175727,5699298,5588646,3921436,3639993,3984750,508796,1985019,4734427,1703617,289068,197219,333666,6077025,5710586,322321,331572,4741601,158128,6310411,6312498,6310396,6312188,6473912,6389619,6854536,6854539,6312173,6315208,6312203,6310370,6310383,6853060,6310440,6547670,7062105,6545742,6985344,960547}
  74. local mapasbootcamp= {203664,375455,394132,173816,562897,171148,166430,169076,330933,168754,159145,163596,152733,410040,158909,261814,281985,2176211,270924,1324259,1225867,563436,424604,172547,168204,2693344,193662,305680,149451,2466489,292808,438333,394125,162482,304861,458528,159298,184648,268915,329318,261298,302080,449496,159187,176710,161023,366260,1852910,201172,549759,257715,397478,261298,177652,408643,447805,155606,176619,460961,455271,172512,320607,166271,299942,150664,186066,152260,155628,166805,178297,313138,167903,223947,191177,185873,113156,156720,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,172520,157098,225744,608368,215933,266398,343875,327354,331344,333002,223174,332130,254785,295487,184817,159691,235717,169228,191203,503679,506032,2747525,192255,208056,171480,182681,219956,270143,2887929,2789121,492399,314743,6924913,2918822,232469,397469,280949,176729,292668,242291,294478,2669415,354984,514311,814311,295465,2239788,187478,212322,249760,476706,298424,263819,175280,3920916,330841,554154,439092,232678,395216,399364,4000008,543010,571683,3958217,329571,6680648,3603631,272402,3161324,2682583,371579,2961800,3734998,2719419,255943,313214}
  75. local mapasracing = {7591932,7591938,7591948,7591952}
  76. local maps = mapasracing
  77. local equipoc= {}
  78. local colors = {
  79. [1] = "e54427",
  80. [2] = "0a98db",
  81. [3] = "00ff00",
  82. [4] = "ffff00",
  83. }
  84. local queue = {}
  85. local nteam = 1
  86. local azar = {}
  87. local posicion = {}
  88. local modeazar = ""
  89. local numeroposicion = 1
  90. local totales = 0
  91. local totales2 = 0
  92. local jugando = {}
  93. local totaljugando = 1
  94. local jugandoposicion = {}
  95. function newMap()
  96. local mapcode = maps[math.random(#maps)]
  97. if #queue > 0 then
  98. mapcode = queue[1]
  99. table.remove(queue, 1)
  100. end
  101. tfm.exec.newGame(mapcode)
  102. for player, data in pairs(tfm.get.room.playerList) do
  103. if not playersInGame[player] then
  104. tfm.exec.killPlayer(player)
  105. end
  106. end
  107. tfm.exec.setGameTime(tiempo)
  108. tfm.exec.setUIMapName("")
  109. if mode2b == "Deathmatch" then
  110. borrarScoreDeathmatch()
  111. end
  112. end
  113. function modealazar()
  114. ui.addTextArea(38, "", nil, 235, 30, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  115. ui.addTextArea(37, "<p align='center'><V>Administrador: "..ADMINISTRATOR, nil, 235, 30, 300, 20, 0x324650, 0x324650, 1, true)
  116. ui.addTextArea(2, "", nil, 142, 71, 516, 290, 0x0E1417, 0x0E1417, 1, true)
  117. ui.addTextArea(4, "", nil, 231, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  118. ui.addTextArea(5, "<p align='center'><V>Team 1", nil, 232, 80, 140, 20, 0x324650, 0x324650, 1, true)
  119. ui.addTextArea(6, "", nil, 399, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  120. ui.addTextArea(7, "<p align='center'><V>Team 2", nil, 400, 80, 140, 20, 0x324650, 0x324650, 1, true)
  121. for i=8, 11 do
  122. ui.removeTextArea(i)
  123. end
  124. ui.addTextArea(40, "", nil, 231, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  125. ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 232, 121, 138, 198, 0x324650, 0x324650, 1, true)
  126. for i=32, 35 do
  127. ui.removeTextArea(i)
  128. end
  129. ui.addTextArea(36, "", nil, 399, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  130. ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 400, 121, 138, 198, 0x324650, 0x324650, 1, true)
  131. ui.addTextArea(14, "<p align='center'><font color='#5A7A8B'>____ ____</font>", nil, 320, 197, 140, 200, 0, 0, 0, true)
  132. ui.addTextArea(15, "", nil, 367, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  133. ui.addTextArea(16, "<p align='center'><V>VS", nil, 368, 203, 38, 18, 0x324650, 0x324650, 1, true)
  134. ui.addTextArea(42, "", ADMINISTRATOR, 600, 81, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  135. ui.addTextArea(41, "<p align='center'><V><a href='event:salir'>X", ADMINISTRATOR, 601, 82, 38, 18, 0x324650, 0x324650, 1, true)
  136. ui.addTextArea(45, "", ADMINISTRATOR, 600, 139, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  137. ui.addTextArea(46, "<p align='center'><V><a href='event:reset'>Reset", ADMINISTRATOR, 601, 140, 50, 18, 0x324650, 0x324650, 1, true)
  138. ui.addTextArea(47, "", ADMINISTRATOR, 600, 173, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  139. ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modeb,mode2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  140. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRATOR, 368, 203, 38, 18, 0x324650, 0x324650, 1, true)
  141. ui.addTextArea(57, "", ADMINISTRATOR, 600, 207, 57, 25, 0x5A7A8B, 0x5A7A8B, 1, true)
  142. ui.addTextArea(58, "<p align='center'><V><a href='event:volver'><font size='10'>4 Teams", ADMINISTRATOR, 601, 208, 55, 23, 0x324650, 0x324650, 1, true)
  143. ui.removeTextArea(59)
  144. ui.removeTextArea(60)
  145. ui.removeTextArea(53)
  146. ui.removeTextArea(51)
  147. ui.removeTextArea(54)
  148. ui.addTextArea(56, "<p align='center'><V><a href='event:azart'><font size='12'>Azar", ADMINISTRATOR, 601, 246, 55, 18, 0x324650, 0x324650, 1, true)
  149.  
  150.  
  151. verificarmode2()
  152. end
  153. function eventPlayerWon(player)
  154. if not isfirst then
  155. isfirst = true
  156. ui.addTextArea(27, string.format("<p align='center'><font size='37' color='#000000'>+1 punto para %s", player), nil, 0, 100, 800, 100, 0, 0, 0, true)
  157. tfm.exec.setPlayerScore(player, 1 ,true)
  158. tfm.exec.setGameTime(3)
  159. if mode2b == "Deathmatch" then
  160. if puntos[player] >= WINS - 1 then
  161. gameRunning = false
  162. winTime = os.time()
  163. ui.addTextArea(29, string.format("<p align='center'><font size='37' color='#000000'>%s ganó\n", player), nil, 3, 168, 800, 500, 0, 0, 0, true)
  164. ui.addTextArea(30, string.format("<p align='center'><font size='37'><font color='#cecece'><font color='#ff0000'>%s </font>ganó\n", player), nil, 1, 170, 800, 500, 0, 0, 0, true)
  165. ui.addTextArea(16, "<p align='center'><font color='#225066' size='18' face='Tw Cen MT Condensed'><a href='event:iniciarJogo'>DE NUEVO", ADMINISTRATOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
  166. end
  167. tfm.exec.setGameTime(3)
  168. puntos[player] = puntos[player]+1
  169. equipoc[player] = "0x115b17"
  170. displayScoreDeathmatch()
  171. elseif mode2b == "normal" then
  172. if table.contains(teams[1], player) then
  173. tfm.exec.setGameTime(3)
  174.  
  175. points[1] = points[1]+1
  176. elseif table.contains(teams[2], player) then
  177. tfm.exec.setGameTime(3)
  178.  
  179. points[2] = points[2]+1
  180. elseif table.contains(teams[3], player) then
  181. tfm.exec.setGameTime(3)
  182.  
  183. points[3] = points[3]+1
  184. elseif table.contains(teams[4], player) then
  185. tfm.exec.setGameTime(3)
  186.  
  187. points[4] = points[4]+1
  188. else
  189. isfirst = false
  190. end
  191. winner = false
  192. if points[1] >= WINS then
  193. winner = 1
  194. elseif points[2] >= WINS then
  195. winner = 2
  196. elseif points[3] >= WINS then
  197. winner = 3
  198. elseif points[4] >= WINS then
  199. winner = 4
  200. end
  201. if winner then
  202. gameRunning = false
  203. winTime = os.time()
  204. local names = {
  205. "Rojo",
  206. "Azul",
  207. "Verde",
  208. "Amarillo",
  209. }
  210. ui.addTextArea(28, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\n", names[winner]), nil, 2, 169, 800, 500, 0, 0, 0, true)
  211. ui.addTextArea(29, string.format("<p align='center'><font size='37' color='#000000'>El equipo %s Ganó\n", names[winner]), nil, 3, 168, 800, 500, 0, 0, 0, true)
  212. ui.addTextArea(30, string.format("<p align='center'><font size='37'><font color='#cecece'>El equipo <font color='#%s'>%s</font> Ganó\n", colors[winner], names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
  213. ui.addTextArea(16, "<p align='center'><font color='#225066' size='18' face='Tw Cen MT Condensed'><a href='event:iniciarJogo'>REVANCHA", ADMINISTRATOR, 350, 270, 100, 20, 0xFFFFFF, 0xFFFFFF, 1, true)
  214. end
  215. displayScore()
  216. end
  217. end
  218. end
  219. function eventLoop(elapsed, remain)
  220. if gameRunning then
  221. remain = remain/1000
  222. if remain < 0 then
  223. remain = 100
  224. newMap()
  225. end
  226. else
  227. if winTime then
  228. if winTime > os.time()-30000 then
  229. else
  230. winTime = false
  231. ui.removeTextArea(26)
  232. ui.removeTextArea(27)
  233. ui.removeTextArea(28)
  234. ui.removeTextArea(29)
  235. ui.removeTextArea(30)
  236. displayTeams()
  237. teams = {
  238. [1] = {},
  239. [2] = {},
  240. [3] = {},
  241. [4] = {},
  242. }
  243. points = {
  244. [1] = 0,
  245. [2] = 0,
  246. [3] = 0,
  247. [4] = 0,
  248. }
  249. playersInGame = {}
  250. end
  251. end
  252. end
  253. end
  254. function string.title(s)
  255. return string.gsub(s, "%a", function(c)
  256. return string.upper(c)
  257. end, 1)
  258. end
  259. function resetmostrarjugadoresdeathmatch()
  260. distanciax = 30
  261. distanciay = 80
  262. textarealugar = 302
  263. textareaid = 0
  264. end
  265. function eventChatCommand(player, command)
  266. if mode2b == "Deathmatch" then
  267. args = string.split(command, " ")
  268. if string.upper(args[1]) == "PUNTAJE" then
  269. resetmostrarjugadoresdeathmatch()
  270. ui.addTextArea(300, "<p align='center'><V><a href='event:cerrarpuntaje'>X", player, 30, 50, 30, 16, 0x324650, 0x324650, 1, true)
  271. ui.addTextArea(301, string.format("<p align='center'><V>Deathmatch a %s puntos",WINS), player, 80, 45, 180, 18, 0x324650, 0x000000, 1, true)
  272. for k,players in pairs(tfm.get.room.playerList) do
  273. if puntos[k] then
  274. equipos[k] = k
  275. playersInGame[k] = true
  276. if textareaid >= 32 then
  277. else
  278. ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), player, distanciax, distanciay, 140, 18, 0x324650, 0x000000, 1, true)
  279. distanciay = distanciay + 37
  280. textareaid = textareaid + 1
  281. textarealugar = textarealugar + 1
  282. if textareaid == 8 then
  283. distanciax = distanciax + 190
  284. distanciay = 80
  285. textareaid = 0
  286. end
  287. end
  288. end
  289. end
  290. end
  291. end
  292. if player:lower() == ADMINISTRATOR:lower() then
  293. args = string.split(command, " ")
  294. if string.upper(args[1]) == "TEAM1" then
  295. if mode2b == "normal" then
  296. table.remove(args, 1)
  297. teams[1] = {}
  298. points[1] = 0
  299. for index, player in pairs(args) do
  300. player = string.title(player)
  301. table.insert(teams[1], player)
  302. playersInGame[player] = true
  303. end
  304. if modeazar == "true" then
  305. modealazar()
  306. else
  307. displayTeams()
  308. end
  309. end
  310. elseif string.upper(args[1]) == "TEAM2" and mode2b == "normal" then
  311. table.remove(args, 1)
  312. teams[2] = {}
  313. points[2] = 0
  314. for index, player in pairs(args) do
  315. player = string.title(player)
  316. table.insert(teams[2], player)
  317. playersInGame[player] = true
  318. end
  319. if modeazar == "true" then
  320. modealazar()
  321. else
  322. displayTeams()
  323. end
  324. elseif string.upper(args[1]) == "TEAM3" and mode2b == "normal" then
  325. table.remove(args, 1)
  326. teams[3] = {}
  327. points[3] = 0
  328. for index, player in pairs(args) do
  329. player = string.title(player)
  330. table.insert(teams[3], player)
  331. playersInGame[player] = true
  332. end
  333. if modeazar == "true" then
  334. modealazar()
  335. else
  336. displayTeams()
  337. end
  338. elseif string.upper(args[1]) == "TEAM4" and mode2b == "normal" then
  339. table.remove(args, 1)
  340. teams[4] = {}
  341. points[4] = 0
  342. for index, player in pairs(args) do
  343. player = string.title(player)
  344. table.insert(teams[4], player)
  345. playersInGame[player] = true
  346. end
  347. if modeazar == "true" then
  348. modealazar()
  349. else
  350. displayTeams()
  351. end
  352. elseif string.upper(args[1]) == "SKIP" then
  353. newMap()
  354. elseif string.upper(args[1]) == "NP" then
  355. if args[2] then
  356. table.insert(queue, args[2])
  357. end
  358. elseif string.upper(args[1]) == "D" then
  359. if args[2] then
  360. WINS = tonumber(args[2])
  361. displayScore()
  362. end
  363. elseif string.upper(args[1]) == "ADD" and mode2b == "Deathmatch" then
  364. if args[2] then
  365. table.remove(args, 1)
  366. for index, player in pairs(args) do
  367. equipos[player] = player
  368. puntos[player] = 0
  369. playersInGame[player] = true
  370. end
  371. end
  372. elseif string.upper(args[1]) == "ADD" and mode2b == "normal" then
  373. if args[2] and args[3] then
  374. if string.upper(args[2]) == "TEAM1" and mode2b == "normal" then
  375. table.remove(args, 1)
  376. table.remove(args, 1)
  377. for index, player in pairs(args) do
  378. player = string.title(player)
  379. table.insert(teams[1], player)
  380. playersInGame[player] = true
  381. end
  382. end
  383. if string.upper(args[2]) == "TEAM2" and mode2b == "normal" then
  384. table.remove(args, 1)
  385. table.remove(args, 1)
  386. for index, player in pairs(args, 3) do
  387. player = string.title(player)
  388. table.insert(teams[2], player)
  389. playersInGame[player] = true
  390. end
  391. end
  392. if string.upper(args[2]) == "TEAM3" and mode2b == "normal" then
  393. table.remove(args, 1)
  394. table.remove(args, 1)
  395. for index, player in pairs(args) do
  396. player = string.title(player)
  397. table.insert(teams[3], player)
  398. playersInGame[player] = true
  399. end
  400. end
  401. if string.upper(args[2]) == "TEAM4" and mode2b == "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[4], player)
  407. playersInGame[player] = true
  408. end
  409. end
  410. end
  411. elseif string.upper(args[1]) == "KICK" then
  412. if args[2] then
  413. for index, player in pairs(args) do
  414. player = string.title(player)
  415. playersInGame[player] = false
  416. end
  417. end
  418. elseif string.upper(args[1]) == "RESET" then
  419. teams[1] = {}
  420. points[1] = 0
  421. teams[2] = {}
  422. points[2] = 0
  423. teams[3] = {}
  424. points[3] = 0
  425. teams[4] = {}
  426. points[4] = 0
  427. equipos = {}
  428. puntos = {}
  429. modeb = "racing"
  430. mode = "bootcamp"
  431. mode2 = "Deathmatch"
  432. mode2b = "normal"
  433. displayTeams()
  434.  
  435.  
  436. elseif string.upper(args[1]) == "PUNTOS" and mode2b == "normal" then
  437. if args[2] and args[3] then
  438. local team = tonumber(args[2]:match("team(%d+)") or 0)
  439. if team > 0 and team < 5 then
  440. local newScore = tonumber(args[3]) or points[team]
  441. points[team] = newScore
  442. displayScore()
  443. end
  444. end
  445. elseif string.upper(args[1]) == "PAUSE" then
  446. gameRunning = not gameRunning
  447. if not gameRunning then
  448. ui.addTextArea(90, "", nil, 235, 200, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  449. ui.addTextArea(91, "<p align='center'><V> Game paused ", nil, 235, 200, 300, 20, 0x324650, 0x324650, 1, true)
  450. tfm.exec.disableAutoTimeLeft(true)
  451. else
  452. ui.removeTextArea(90)
  453. ui.removeTextArea(91)
  454. tfm.exec.disableAutoTimeLeft(false)
  455. end
  456. end
  457. end
  458. end
  459. function eventNewGame()
  460. ui.removeTextArea(27)
  461. if gameRunning then
  462. if mode2b == "normal" then
  463. isfirst = false
  464. for i, p in pairs(teams[1]) do
  465. tfm.exec.setNameColor(p, "0x"..colors[1])
  466. end
  467. for i, p in pairs(teams[2]) do
  468. tfm.exec.setNameColor(p, "0x"..colors[2])
  469. end
  470. for i, p in pairs(teams[3]) do
  471. tfm.exec.setNameColor(p, "0x"..colors[3])
  472. end
  473. for i, p in pairs(teams[4]) do
  474. tfm.exec.setNameColor(p, "0x"..colors[4])
  475. end
  476. displayScore()
  477. elseif mode2b == "Deathmatch" then
  478. isfirst = false
  479. for k,players in pairs(tfm.get.room.playerList) do
  480. tfm.exec.setNameColor(k, "0xff0000")
  481. equipoc[k] = "0x324650"
  482. end
  483. displayScore()
  484. end
  485. end
  486. end
  487. function displayScore()
  488. if mode2b == "normal" then
  489. if modeazar == "true" then
  490. 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)
  491. elseif modeazar == "false" then
  492. 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)
  493. end
  494. end
  495. end
  496. function displayScoreDeathmatch()
  497. resetmostrarjugadoresdeathmatch()
  498. ui.addTextArea(300, string.format("<p align='center'><V>Deathmatch a %s puntos",WINS), nil, 80, 45, 180, 18, 0x324650, 0x000000, 1, true)
  499. for k,players in pairs(tfm.get.room.playerList) do
  500. if puntos[k] then
  501. equipos[k] = k
  502. playersInGame[k] = true
  503. if textareaid >= 32 then
  504. else
  505. ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), nil, distanciax, distanciay, 140, 18, equipoc[k], 0x000000, 1, true)
  506. distanciay = distanciay + 37
  507. textareaid = textareaid + 1
  508. textarealugar = textarealugar + 1
  509. if textareaid == 8 then
  510. distanciax = distanciax + 190
  511. distanciay = 80
  512. textareaid = 0
  513. end
  514. end
  515. end
  516. end
  517. end
  518. function borrarScoreDeathmatch()
  519. for i = 300, 334 do
  520. ui.removeTextArea(i)
  521. end
  522. end
  523. function displayTeams()
  524. borrarScoreDeathmatch()
  525. modeazar = "false"
  526. ui.addTextArea(38, "", nil, 235, 30, 302, 22, 0x324650, 0x5A7A8B, 1, true)
  527. ui.addTextArea(37, "<p align='center'><V>Administrador: "..ADMINISTRATOR, nil, 235, 30, 300, 20, 0x324650, 0x324650, 1, true)
  528. ui.addTextArea(2, "", nil, 0, 71, 800, 290, 0x0E1417, 0x0E1417, 1, true)
  529. ui.addTextArea(4, "", nil, 57, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  530. ui.addTextArea(5, "<p align='center'><V>Team 1", nil, 58, 80, 140, 20, 0x324650, 0x324650, 1, true)
  531. ui.addTextArea(6, "", nil, 227, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  532. ui.addTextArea(7, "<p align='center'><V>Team 2", nil, 228, 80, 140, 20, 0x324650, 0x324650, 1, true)
  533. ui.addTextArea(8, "", nil, 417, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  534. ui.addTextArea(9, "<p align='center'><V>Team 3", nil, 418, 80, 140, 20, 0x324650, 0x324650, 1, true)
  535. ui.addTextArea(10, "", nil, 587, 79, 142, 22, 0x324650, 0x5A7A8B, 1, true)
  536. ui.addTextArea(11, "<p align='center'><V>Team 4", nil, 588, 80, 140, 20, 0x324650, 0x324650, 1, true)
  537. ui.addTextArea(12, "<p align='center'><font color='#5A7A8B'>|</font>", nil, 210, 102, 140, 200, 0, 0, 0, true)
  538. ui.addTextArea(39, "<p align='center'><font color='#5A7A8B'>|</font>", nil, 450, 102, 140, 200, 0, 0, 0, true)
  539. ui.addTextArea(40, "", nil, 59, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  540. ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 60, 121, 138, 198, 0x324650, 0x324650, 1, true)
  541. ui.addTextArea(32, "", nil, 419, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  542. ui.addTextArea(33, "<p align='center'><font color='#"..colors[3].."'>"..table.concat(teams[3], "\n"), nil, 420, 121, 138, 198, 0x324650, 0x324650, 1, true)
  543. ui.addTextArea(34, "", nil, 589, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  544. ui.addTextArea(35, "<p align='center'><font color='#"..colors[4].."'>"..table.concat(teams[4], "\n"), nil, 590, 121, 138, 198, 0x324650, 0x324650, 1, true)
  545. ui.addTextArea(36, "", nil, 229, 120, 140, 200, 0x5A7A8B, 0x5A7A8B, 1, true)
  546. ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 230, 121, 138, 198, 0x324650, 0x324650, 1, true)
  547. ui.addTextArea(14, "<p align='center'><font color='#5A7A8B'>____ ____</font>", nil, 325, 197, 140, 200, 0, 0, 0, true)
  548. ui.addTextArea(15, "", nil, 374, 202, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  549. ui.addTextArea(16, "<p align='center'><V>VS", nil, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
  550. ui.addTextArea(42, "", ADMINISTRATOR, 749, 81, 40, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  551. ui.addTextArea(41, "<p align='center'><V><a href='event:salir'>X", ADMINISTRATOR, 750, 82, 38, 18, 0x324650, 0x324650, 1, true)
  552. ui.addTextArea(45, "", ADMINISTRATOR, 744, 139, 52, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  553. ui.addTextArea(46, "<p align='center'><V><a href='event:reset'>Reset", ADMINISTRATOR, 745, 140, 50, 18, 0x324650, 0x324650, 1, true)
  554. ui.addTextArea(47, "", ADMINISTRATOR, 741, 173, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  555. ui.addTextArea(54, "", ADMINISTRATOR, 741, 209, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  556. if mode2 == "Deathmatch" then
  557. ui.addTextArea(51, "<p align='center'><V><a href='event:Deathmatch'><font size='8'>"..mode2, ADMINISTRATOR, 742, 210, 55, 18, 0x324650, 0x324650, 1, true)
  558. end
  559. verificarmode()
  560. ui.addTextArea(53, "", ADMINISTRATOR, 741, 245, 57, 20, 0x5A7A8B, 0x5A7A8B, 1, true)
  561. ui.addTextArea(56, "<p align='center'><V><a href='event:llenar'><font size='8'>Randomize", ADMINISTRATOR, 742, 246, 55, 18, 0x324650, 0x324650, 1, true)
  562. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRATOR, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
  563. ui.addTextArea(57, "", ADMINISTRATOR, 741, 281, 57, 25, 0x5A7A8B, 0x5A7A8B, 1, true)
  564. ui.addTextArea(58, "<p align='center'><V><a href='event:azart'><font size='12'>", ADMINISTRATOR, 742, 282, 55, 23, 0x324650, 0x324650, 1, true)
  565. ui.addTextArea(59, "<p align='center'><V><a href='event:azart'><font size='10'>2 teams", ADMINISTRATOR, 742, 290, 55, 23, 0x000000, 0x000000, 1, true)
  566. ui.addTextArea(60, "<p align='center'><V><a href='event:azart'><font size='12'>Random", ADMINISTRATOR, 742, 278, 55, 23, 0x000000, 0x000000, 1, true)
  567. end
  568. function verificarmode()
  569. ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modeb,mode2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  570. if mode2 == "normal" then
  571. ui.addTextArea(51, "<p align='center'><V><a href='event:normal'><font size='8'>"..mode2, ADMINISTRATOR, 742, 210, 55, 18, 0x324650, 0x324650, 1, true)
  572. end
  573. if mode == "bootcamp" then
  574. ui.addTextArea(48, "<p align='center'><V><a href='event:bootcamp'><font size='9'>"..mode, ADMINISTRATOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  575. end
  576. if mode == "racing" then
  577. ui.addTextArea(48, "<p align='center'><V><a href='event:racing'><font size='9'>"..mode, ADMINISTRATOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  578. end
  579. if mode == "mix" then
  580. ui.addTextArea(48, "<p align='center'><V><a href='event:mix'><font size='9'>"..mode, ADMINISTRATOR, 742, 174, 55, 18, 0x324650, 0x324650, 1, true)
  581. end
  582. end
  583. function contarjugadores()
  584. local players=0
  585. function eventPlayerLeft(name)--Cuando un jugador salga de la sala...
  586. players=players-1--Restamos 1 a nuestra tabla
  587. end
  588. for name in pairs(tfm.get.room.playerList) do--Por cada jugador que esté en la sala...
  589. players=players+1--Le ejecutamos la función eventNewPlayer
  590. tfm.exec.setPlayerScore(name, 0 ,false)
  591. end
  592. end
  593.  
  594. function eventTextAreaCallback(id, player, callback)
  595. if callback == 'iniciarJogo' then
  596. gameRunning = true
  597. for i = 1, 20 do
  598. ui.removeTextArea(i)
  599. end
  600. for i = 26, 60 do
  601. ui.removeTextArea(i)
  602. end
  603. borrarScoreDeathmatch()
  604. contarjugadores()
  605. newMap()
  606. if mode2b == "normal" then
  607. points[1] = 0
  608. points[2] = 0
  609. points[3] = 0
  610. points[4] = 0
  611. displayScore()
  612. end
  613. if mode2b == "Deathmatch" then
  614. for k,v in pairs(tfm.get.room.playerList) do
  615. puntos[k] = 0
  616. end
  617. end
  618. elseif callback == 'salir' then
  619. tfm.system.exit()
  620. elseif callback == 'llenar' then
  621. nteam = 1
  622. azar = {}
  623. playersInGame = {}
  624.  
  625. teams = {
  626. [1] = {},
  627. [2] = {},
  628. [3] = {},
  629. [4] = {},
  630. }
  631. contarjugadores()
  632. for k,players in pairs(tfm.get.room.playerList) do
  633. if nteam > 4 then
  634. nteam = 1
  635. end
  636. table.insert(teams[nteam], k)
  637. playersInGame[k] = true
  638. nteam = nteam + 1
  639. displayTeams()
  640. end
  641. elseif callback == 'reset' then
  642. teams[1] = {}
  643. points[1] = 0
  644. teams[2] = {}
  645. points[2] = 0
  646. teams[3] = {}
  647. points[3] = 0
  648. teams[4] = {}
  649. points[4] = 0
  650. equipos = {}
  651. puntos = {}
  652. modeb = "racing"
  653. mode = "bootcamp"
  654. mode2 = "Deathmatch"
  655. mode2b = "normal"
  656. displayTeams()
  657.  
  658.  
  659. elseif callback == 'bootcamp' then
  660. tiempo = 150
  661. modeb = "bootcamp"
  662. mode = "mix"
  663. verificarmode()
  664. maps = mapasbootcamp
  665.  
  666. elseif callback == 'racing' then
  667.  
  668. tiempo = 60
  669. modeb = "racing"
  670. mode = "bootcamp"
  671. verificarmode()
  672. maps = mapasracing
  673.  
  674. elseif callback == 'mix' then
  675. tiempo = 90
  676. modeb = "mix"
  677. mode = "racing"
  678. verificarmode()
  679. maps = mapasmix
  680.  
  681. elseif callback == 'Deathmatch' then
  682. mode2b = "Deathmatch"
  683. mode2 = "normal"
  684. displayTeams()
  685. for i = 4, 15 do
  686. ui.removeTextArea(i)
  687. end
  688. for i = 31, 36 do
  689. ui.removeTextArea(i)
  690. end
  691. for i = 39, 40 do
  692. ui.removeTextArea(i)
  693. end
  694. ui.removeTextArea(53)
  695. ui.removeTextArea(56)
  696. contarjugadores()
  697. for k,players in pairs(tfm.get.room.playerList) do
  698. equipos[k] = k
  699. puntos[k] = 0
  700. equipoc[k] = "0x324650"
  701. playersInGame[k] = true
  702. if textareaid >= 32 then
  703. else
  704. ui.addTextArea(textarealugar, "<p align='center'><V>"..k, nil, distanciax, distanciay, 140, 18, 0x324650, 0x324650, 1, true)
  705. distanciay = distanciay + 37
  706. textareaid = textareaid + 1
  707. textarealugar = textarealugar + 1
  708. if textareaid == 8 then
  709. distanciax = distanciax + 190
  710. distanciay = 80
  711. textareaid = 0
  712. end
  713. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", ADMINISTRATOR, 375, 203, 38, 18, 0x324650, 0x324650, 1, true)
  714. end
  715. end
  716.  
  717. elseif callback == 'normal' then
  718. mode2b = "normal"
  719. mode2 = "Deathmatch"
  720. resetmostrarjugadoresdeathmatch()
  721. displayTeams()
  722.  
  723. elseif callback == 'cerrarpuntaje' then
  724. borrarScoreDeathmatch()
  725.  
  726. elseif callback == 'azart' then
  727. totales = 0
  728. totales2 = 0
  729. jugando = {}
  730. totaljugando = 1
  731. jugandoposicion = {}
  732. playersInGame = {}
  733. teams[1] = {}
  734. teams[2] = {}
  735. teams[3] = {}
  736. teams[4] = {}
  737. alazar()
  738. borrarScoreDeathmatch()
  739. modeazar = "true"
  740. modealazar()
  741.  
  742. elseif callback == 'volver' then
  743. totales = 0
  744. totales2 = 0
  745. jugando = {}
  746. totaljugando = 1
  747. jugandoposicion = {}
  748. playersInGame = {}
  749. teams[1] = {}
  750. teams[2] = {}
  751. teams[3] = {}
  752. teams[4] = {}
  753. displayTeams()
  754.  
  755. elseif callback == 'bootcamp2' then
  756. tiempo = 150
  757. modeb = "bootcamp"
  758. mode = "mix"
  759. verificarmode2()
  760. maps = mapasbootcamp
  761.  
  762. elseif callback == 'racing2' then
  763.  
  764. tiempo = 60
  765. modeb = "racing"
  766. mode = "bootcamp"
  767. verificarmode2()
  768. maps = mapasracing
  769.  
  770. elseif callback == 'mix2' then
  771. tiempo = 90
  772. modeb = "mix"
  773. mode = "racing"
  774. verificarmode2()
  775. maps = mapasmix
  776. end
  777. end
  778. function alazar()
  779. t = 0
  780. for k,v in pairs(tfm.get.room.playerList) do
  781. if t == 1 then
  782. table.insert(teams[2], k)
  783. playersInGame[k] = true
  784. t = 0
  785. elseif t == 0 then
  786. table.insert(teams[1], k)
  787. playersInGame[k] = true
  788. t = 1
  789. end
  790. end
  791. end
  792.  
  793.  
  794.  
  795. function verificarmode2()
  796. ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modeb,mode2b),nil, 235, 375, 300, 17, 0x324650, 0x324650, 1, true)
  797. if mode == "bootcamp" then
  798. ui.addTextArea(48, "<p align='center'><V><a href='event:bootcamp2'><font size='9'>"..mode, ADMINISTRATOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  799. end
  800. if mode == "racing" then
  801. ui.addTextArea(48, "<p align='center'><V><a href='event:racing2'><font size='9'>"..mode, ADMINISTRATOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  802. end
  803. if mode == "mix" then
  804. ui.addTextArea(48, "<p align='center'><V><a href='event:mix2'><font size='9'>"..mode, ADMINISTRATOR, 601, 174, 55, 18, 0x324650, 0x324650, 1, true)
  805. end
  806. end
  807. function string.split(s, pattern, n)
  808. local st = {}
  809. for sb in string.gmatch(s, "[^"..pattern.."]+") do
  810. if not n or n > -1 then
  811. table.insert(st,sb)
  812. else
  813. st[#st] = st[#st]..pattern..sb
  814. end
  815. n = n and n-1 or false
  816. end
  817. return st
  818. end
  819. function table.contains(tableT, element)
  820. for _, value in pairs(tableT) do
  821. if value == element then
  822. return true
  823. end
  824. end
  825. return false
  826. end
  827. function eventPlayerDied()
  828. local alive = 0
  829. for k,v in pairs(tfm.get.room.playerList) do
  830. if not v.isDead then
  831. alive = alive+1
  832. end
  833. end
  834. if alive == 0 then
  835. newMap()
  836. end
  837. end
  838. displayTeams()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement