Advertisement
Guest User

Untitled

a guest
May 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.80 KB | None | 0 0
  1. --[[
  2. __ __ __ ___ __ _ __ __ ____
  3. / / / / / / / _ | / / | | / / _/_/ / __/
  4. / /__/ /_/ / / __ | / / | |/ / _/_/ _\ \
  5. /____/\____/ /_/ |_| / / |___/ /_/ /___/
  6. /_/
  7. _____ _ _ _ _
  8. |_ _| | || | | | | |
  9. | | _ __ ___ | || | ___ __ _ _ __ __| | ___ | | ___
  10. | | | '__| / _ \ | || | / _ \ / _` || '_ \ / _` | / _ \ | | / _ \
  11. | | | | | (_) || || || __/| (_| || | | || (_| || (_) || || (_) |
  12. \_/ |_| \___/ |_||_| \___| \__,_||_| |_| \__,_| \___/ |_| \___/
  13. V4.5
  14. -------------------------------------------------------------------
  15. No olvides cambiar tu nombre desde "local ADMINISTRADOR"
  16. -------------------------------------------------------------------
  17. Comandos:
  18. !geç - Para cambiar de mapa
  19. !puntos - Para cambiar el puntaje, ej: !puntos team1 5
  20. !np @codigo - Para poner cualquier mapa
  21. !pausa - Para pausar el juego
  22. !team - Para asignar jugadores a un equipo, ej: !team1 Gurbetana
  23. !d NUMERO - Asigna el puntaje para ganar, ej: !d 20
  24. !ekle team nick - Añade un jugador a el equipo especificado, ej: !añadir team4 Gurbetana
  25. !reset - Resetea el juego
  26. !quitar TEAM NOMBRE - saca a un jugador del equipo
  27. !puntaje - para ver el puntaje [SOLO EN MODO SOLO]
  28. --------------------------------------------------------------------
  29. ]]
  30. -----------------------------------------------------------------------------------
  31. -----------------------------------------------------------------------------------
  32. local Admin = "Edwin#7374" -- Cambia tu nombre para ser ADMINISTRADOR
  33. -----------------------------------------------------------------------------------
  34. -----------------------------------------------------------------------------------
  35. local WINS = 20 -- Puntaje para ganar.
  36. ------------------------------------------------------------------------------------
  37. system.disableChatCommandDisplay("np", true)
  38. system.disableChatCommandDisplay("pause", true)
  39. system.disableChatCommandDisplay("saltar", true)
  40. system.disableChatCommandDisplay("puntaje", true)
  41. tfm.exec.disablePhysicalConsumables()
  42. tfm.exec.disableAutoShaman()
  43. tfm.exec.disableAutoNewGame()
  44. tfm.exec.disableAutoTimeLeft()
  45. local teams = {
  46. [1] = {},
  47. [2] = {},
  48. [3] = {},
  49. [4] = {},
  50. }
  51. local points = {
  52. [1] = 0,
  53. [2] = 0,
  54. [3] = 0,
  55. [4] = 0,
  56. }
  57. local equipos = {}
  58. local puntos = {}
  59. local modob = "racing"
  60. local modo = "bootcamp"
  61. local modo2 = "Solo"
  62. local modo2b = "normal"
  63. local tiempo = 60
  64. tonumber(tiempo)
  65. local isfirst = true
  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 = {7102662,157805,157004,156720,153996,151655,150651,149422,124000,203664,375455,394132,170514,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,186066,152260,155628,166805,178297,313138,167903,223947,191177,113156,150664,157203,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,172520,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= {157960,157805,157004,156720,153996,151655,150651,149422,124000,203664,375455,394132,170514,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,186066,152260,155628,166805,178297,313138,167903,223947,191177,113156,150664,157203,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,172520}
  75. local mapasracing = {7591932,7591938,7591948,7591952,7591954,7591956,7591958,7592124,7592125,7592132,7592134,7592140,7592143,7592147,7592150,7592154,7592156,7592354,7592356,7592358,7592360,7592361,7592365,7592367,7592372,7592431,7592432,7592439,7592441,7592442,7592444,7592445,7592446,7592448,7592451,7592460,7592610,7592626,7592638,7592642,7592654,7592658,7592660,7592662,7592924,7592926,7592937,7592938,7592939,7592940,7592942,7592943,7592944,7592946,7592947,7592952,7592953,7592954,7592956,7592958,7592959,7592961,7592962,7592963,7592968,7592971,7592973,7592993,7593074,7593080,7593084,7593085,7593088,7593092,7595834,7595842,7595848,7595852,7595856,7595858,7596102,7596103,7596104,7596106,7596109,7596113,7596116,7596120,7596123,7596124,7596128,7596129,7596133,7596134,7596135,7596137,7596144,7596150,7596151,7596157,7596159,7596160,7597476,7597478,7597481,7597482,7597483,7597484,7597485,7597486,7597488,7597489,7597490,7597494,7597500,7597504,7597509,7597516,7597522,7597525,7597527,7597528,7600803,7600805,7600809,7600813,7600818,7600821,7600828,7600830,7600831,7601033,7601038,7601039,7601044,7601381,7601386,7601389,7601390,7601393,7601395,7601408,7601410,7601416,7601419,7601434,7601436,7601439,7601441,7601442,7601445,7601448,7601449,7601453,7602567,7602568}
  76.  
  77. local maps = mapasracing
  78. local equipoc= {}
  79. local colors = {
  80. [1] = "000000",
  81. [2] = "0000FF",
  82. [3] = "FEFF00",
  83. [4] = "FF0000",
  84. }
  85. local queue = {}
  86. local nteam = 1
  87. local kapat = {}
  88. local posicion = {}
  89. local numeroposicion = 1
  90. function newMap()
  91. local mapcode = maps[math.random(#maps)]
  92. if #queue > 0 then
  93. mapcode = queue[1]
  94. table.remove(queue, 1)
  95. end
  96. tfm.exec.newGame(mapcode)
  97. for player, data in pairs(tfm.get.room.playerList) do
  98. if not playersInGame[player] then
  99. tfm.exec.killPlayer(player)
  100. end
  101. end
  102. tfm.exec.setGameTime(tiempo)
  103. borrarScoreSolo()
  104. end
  105. function eventPlayerWon(player)
  106. if not isfirst then
  107. isfirst = true
  108. tfm.exec.setGameTime(3)
  109. if modo2b == "Solo" then
  110. if puntos[player] >= WINS - 1 then
  111. gameRunning = false
  112. winTime = os.time()
  113. 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)
  114. 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)
  115. end
  116. tfm.exec.setGameTime(3)
  117. for i = 0, 3 do
  118. defaultEffect(9, {13}, math.random(800), math.random(400), 20)
  119. end
  120. puntos[player] = puntos[player]+1
  121. equipoc[player] = "0x115b17"
  122. displayScoreSolo()
  123. end
  124. if modo2b == "normal" then
  125. if table.contains(teams[1], player) then
  126. tfm.exec.setGameTime(3)
  127. for i = 0, 3 do
  128. defaultEffect(9, {13}, math.random(800), math.random(400), 20)
  129. end
  130. points[1] = points[1]+1
  131. elseif table.contains(teams[2], player) then
  132. tfm.exec.setGameTime(3)
  133. for i = 0, 3 do
  134. defaultEffect(9, {9}, math.random(800), math.random(400), 20)
  135. end
  136. points[2] = points[2]+1
  137. elseif table.contains(teams[3], player) then
  138. tfm.exec.setGameTime(3)
  139. for i = 0, 3 do
  140. defaultEffect(9, {9}, math.random(800), math.random(400), 20)
  141. end
  142. points[3] = points[3]+1
  143. elseif table.contains(teams[4], player) then
  144. tfm.exec.setGameTime(3)
  145. for i = 0, 3 do
  146. defaultEffect(9, {9}, math.random(800), math.random(400), 20)
  147. end
  148. points[4] = points[4]+1
  149. else
  150. isfirst = false
  151. end
  152. winner = false
  153. if points[1] >= WINS then
  154. winner = 1
  155. elseif points[2] >= WINS then
  156. winner = 2
  157. elseif points[3] >= WINS then
  158. winner = 3
  159. elseif points[4] >= WINS then
  160. winner = 4
  161. end
  162. if winner then
  163. gameRunning = false
  164. winTime = os.time()
  165. local names = {
  166. "Team White",
  167. "Team Blue",
  168. "Team Yellow",
  169. "Team Red",
  170. }
  171. ui.addTextArea(26, string.format("<p align='center'><font size='37' color='#000000'GG Ocs %s BY\nGURBETANA", names[winner]), nil, 0, 171, 800, 500, 0, 0, 0, true)
  172. ui.addTextArea(27, string.format("<p align='center'><font size='37' color='#000000'>GG Ocs %s BY\nGURBETANA", names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
  173. ui.addTextArea(28, string.format("<p align='center'><font size='37' color='#000000'>GG Ocs %s BY\nGURBETANA", names[winner]), nil, 2, 169, 800, 500, 0, 0, 0, true)
  174. ui.addTextArea(29, string.format("<p align='center'><font size='37' color='#000000'>GG Ocs %s BY\nGURBETANA", names[winner]), nil, 3, 168, 800, 500, 0, 0, 0, true)
  175. ui.addTextArea(30, string.format("<p align='center'><font size='37'><font color='#cecece'>GG Ocs <font color='#%s'>%s</font> BY\nGURBETANA", colors[winner], names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
  176. end
  177. displayScore()
  178. end
  179. end
  180. end
  181. function eventLoop(elapsed, remain)
  182. if gameRunning then
  183. remain = remain/1000
  184. if remain < 0 then
  185. remain = 100
  186. newMap()
  187. end
  188. else
  189. if winTime then
  190. if winTime > os.time()-30000 then
  191. for i = 0, 2 do
  192. defaultEffect(9, {11, 9, 0, 13}, math.random(800), math.random(400), 80)
  193. end
  194. else
  195. winTime = false
  196. ui.removeTextArea(26)
  197. ui.removeTextArea(27)
  198. ui.removeTextArea(28)
  199. ui.removeTextArea(29)
  200. ui.removeTextArea(30)
  201. displayTeams()
  202. teams = {
  203. [1] = {},
  204. [2] = {},
  205. [3] = {},
  206. [4] = {},
  207. }
  208. points = {
  209. [1] = 0,
  210. [2] = 0,
  211. [3] = 0,
  212. [4] = 0,
  213. }
  214. playersInGame = {}
  215. end
  216. end
  217. end
  218. end
  219. function string.title(s)
  220. return string.gsub(s, "%a", function(c)
  221. return string.upper(c)
  222. end, 1)
  223. end
  224. function resetmostrarjugadoresSolo()
  225. distanciax = 30
  226. distanciay = 80
  227. textarealugar = 302
  228. textareaid = 0
  229. end
  230. function eventChatCommand(player, command)
  231. if modo2b == "Solo" then
  232. args = string.split(command, " ")
  233. if args[1] == "puntaje" then
  234. resetmostrarjugadoresSolo()
  235. ui.addTextArea(300, "<p align='center'><V><a href='event:cerrarpuntaje'>X", player, 30, 50, 30, 16, FF0000, FF0000, 1, true)
  236. ui.addTextArea(301, string.format("<p align='center'><V>Solo a %s puntos",WINS), player, 80, 45, 180, 18, FF0000, FF0000, 1, true)
  237. for k,players in pairs(tfm.get.room.playerList) do
  238. if puntos[k] then
  239. equipos[k] = k
  240. playersInGame[k] = true
  241. if textareaid >= 32 then
  242. else
  243. ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), player, distanciax, distanciay, 140, 18, FF0000, FF0000, 1, true)
  244. distanciay = distanciay + 37
  245. textareaid = textareaid + 1
  246. textarealugar = textarealugar + 1
  247. if textareaid == 8 then
  248. distanciax = distanciax + 190
  249. distanciay = 80
  250. textareaid = 0
  251. end
  252. end
  253. end
  254. end
  255. end
  256. end
  257. if player:lower() == Admin:lower() then
  258. args = string.split(command, " ")
  259. if args[1] == "team1" then
  260. if modo2b == "normal" then
  261. table.remove(args, 1)
  262. teams[1] = {}
  263. points[1] = 0
  264. for index, player in pairs(args) do
  265. player = string.title(player)
  266. table.insert(teams[1], player)
  267. playersInGame[player] = true
  268. end
  269. displayTeams()
  270. end
  271. elseif args[1] == "team2" and modo2b == "normal" then
  272. table.remove(args, 1)
  273. teams[2] = {}
  274. points[2] = 0
  275. for index, player in pairs(args) do
  276. player = string.title(player)
  277. table.insert(teams[2], player)
  278. playersInGame[player] = true
  279. end
  280. displayTeams()
  281. elseif args[1] == "team3" and modo2b == "normal" then
  282. table.remove(args, 1)
  283. teams[3] = {}
  284. points[3] = 0
  285. for index, player in pairs(args) do
  286. player = string.title(player)
  287. table.insert(teams[3], player)
  288. playersInGame[player] = true
  289. end
  290. displayTeams()
  291. elseif args[1] == "team4" and modo2b == "normal" then
  292. table.remove(args, 1)
  293. teams[4] = {}
  294. points[4] = 0
  295. for index, player in pairs(args) do
  296. player = string.title(player)
  297. table.insert(teams[4], player)
  298. playersInGame[player] = true
  299. end
  300. displayTeams()
  301. elseif args[1] == "geç" then
  302. newMap()
  303. elseif args[1] == "np" then
  304. if args[2] then
  305. table.insert(queue, args[2])
  306. end
  307. elseif args[1] == "d" then
  308. if args[2] then
  309. WINS = tonumber(args[2])
  310. displayScore()
  311. end
  312. elseif args[1] == "ekle" and modo2b == "Solo" then
  313. if args[2] then
  314. table.remove(args, 1)
  315. for index, player in pairs(args) do
  316. equipos[player] = player
  317. puntos[player] = 0
  318. playersInGame[player] = true
  319. end
  320. end
  321. elseif args[1] == "ekle" and modo2b == "normal" then
  322. if args[2] and args[3] then
  323. if args[2] == "team1" and modo2b == "normal" then
  324. table.remove(args, 1)
  325. table.remove(args, 1)
  326. for index, player in pairs(args) do
  327. player = string.title(player)
  328. table.insert(teams[1], player)
  329. playersInGame[player] = true
  330. end
  331. end
  332. if args[2] == "team2" and modo2b == "normal" then
  333. table.remove(args, 1)
  334. table.remove(args, 1)
  335. for index, player in pairs(args, 3) do
  336. player = string.title(player)
  337. table.insert(teams[2], player)
  338. playersInGame[player] = true
  339. end
  340. end
  341. if args[2] == "team3" and modo2b == "normal" then
  342. table.remove(args, 1)
  343. table.remove(args, 1)
  344. for index, player in pairs(args) do
  345. player = string.title(player)
  346. table.insert(teams[3], player)
  347. playersInGame[player] = true
  348. end
  349. end
  350. if args[2] == "team4" and modo2b == "normal" then
  351. table.remove(args, 1)
  352. table.remove(args, 1)
  353. for index, player in pairs(args) do
  354. player = string.title(player)
  355. table.insert(teams[4], player)
  356. playersInGame[player] = true
  357. end
  358. end
  359. end
  360. elseif args[1] == "quitar" then
  361. if args[2] then
  362. for index, player in pairs(args) do
  363. player = string.title(player)
  364. playersInGame[player] = false
  365. end
  366. end
  367. elseif args[1] == "reset" then
  368. teams[1] = {}
  369. points[1] = 0
  370. teams[2] = {}
  371. points[2] = 0
  372. teams[3] = {}
  373. points[3] = 0
  374. teams[4] = {}
  375. points[4] = 0
  376. displayTeams()
  377. elseif args[1] == "puntos" and modo2b == "normal" then
  378. if args[2] and args[3] then
  379. local team = tonumber(args[2]:match("team(%d+)") or 0)
  380. if team > 0 and team < 5 then
  381. local newScore = tonumber(args[3]) or points[team]
  382. points[team] = newScore
  383. displayScore()
  384. end
  385. end
  386. elseif args[1] == "pausa" then
  387. gameRunning = not gameRunning
  388. if not gameRunning then
  389. ui.addTextArea(90, "", nil, 235, 200, 302, 22, FF0000, FF0000, 1, true)
  390. ui.addTextArea(91, "<p align='center'><V> Juego pausado ", nil, 235, 200, 300, 20, 0x324650, 0x324650, 1, true)
  391. tfm.exec.disableAutoTimeLeft(true)
  392. else
  393. ui.removeTextArea(90)
  394. ui.removeTextArea(91)
  395. tfm.exec.disableAutoTimeLeft(false)
  396. end
  397. end
  398. end
  399. end
  400. function eventNewGame()
  401. if modo2b == "normal" then
  402. if gameRunning then
  403. isfirst = false
  404. for i, p in pairs(teams[1]) do
  405. tfm.exec.setNameColor(p, "0x"..colors[1])
  406. end
  407. for i, p in pairs(teams[2]) do
  408. tfm.exec.setNameColor(p, "0x"..colors[2])
  409. end
  410. for i, p in pairs(teams[3]) do
  411. tfm.exec.setNameColor(p, "0x"..colors[3])
  412. end
  413. for i, p in pairs(teams[4]) do
  414. tfm.exec.setNameColor(p, "0x"..colors[4])
  415. end
  416. displayScore()
  417. end
  418. end
  419. if modo2b == "Solo" then
  420. if gameRunning then
  421. isfirst = false
  422. for k,players in pairs(tfm.get.room.playerList) do
  423. tfm.exec.setNameColor(k, "FF0000")
  424. equipoc[k] = "FF0000"
  425. end
  426. displayScore()
  427. end
  428. end
  429. ui.setMapName(tfm.get.room.currentMap)
  430. end
  431. function displayScore()
  432. if modo2b == "normal" then
  433. 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='FF0000'>%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)
  434. end
  435. end
  436. function displayScoreSolo()
  437. resetmostrarjugadoresSolo()
  438. ui.addTextArea(300, string.format("<p align='center'><V>Solo a %s puntos",WINS), nil, 80, 45, 180, 18, FF0000, FF0000, 1, true)
  439. for k,players in pairs(tfm.get.room.playerList) do
  440. if puntos[k] then
  441. equipos[k] = k
  442. playersInGame[k] = true
  443. if textareaid >= 32 then
  444. else
  445. ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s - %s",k,puntos[k]), nil, distanciax, distanciay, 140, 18, equipoc[k], FF0000, 1, true)
  446. distanciay = distanciay + 37
  447. textareaid = textareaid + 1
  448. textarealugar = textarealugar + 1
  449. if textareaid == 8 then
  450. distanciax = distanciax + 190
  451. distanciay = 80
  452. textareaid = 0
  453. end
  454. end
  455. end
  456. end
  457. end
  458. function borrarScoreSolo()
  459. for i = 300, 340 do
  460. ui.removeTextArea(i)
  461. end
  462. end
  463. function displayTeams()
  464. ui.addTextArea(38, "", nil, 235, 30, 302, 22, FF0000, FF0000, 1, true)
  465. ui.addTextArea(37, "<p align='center'><V>Admin: "..Admin, nil, 235, 30, 300, 20, FF0000, FF0000, 1, true)
  466. --ui.addTextArea(1, "", nil, 400, 69, 400, 260, FF0000, FF0000, 1, true)
  467. ui.addTextArea(2, "", nil, 0, 71, 800, 290, FF0000, FF0000, 1, true)
  468. --ui.addTextArea(3, "", nil, 331, 70, 400, 260, FF0000, FF0000, 1, true)
  469. ui.addTextArea(4, "", nil, 57, 79, 142, 22, FF0000, FF0000, 1, true)
  470. ui.addTextArea(5, "<p align='center'><V>Team 1", nil, 58, 80, 140, 20, FF0000, FF0000, 1, true)
  471. ui.addTextArea(6, "", nil, 227, 79, 142, 22, FF0000, FF0000, 1, true)
  472. ui.addTextArea(7, "<p align='center'><V>Team 2", nil, 228, 80, 140, 20, FF0000, FF0000, 1, true)
  473. ui.addTextArea(8, "", nil, 417, 79, 142, 22, FF0000, FF0000, 1, true)
  474. ui.addTextArea(9, "<p align='center'><V>Team 3", nil, 418, 80, 140, 20, FF0000, FF0000, 1, true)
  475. ui.addTextArea(10, "", nil, 587, 79, 142, 22, FF0000, FF0000, 1, true)
  476. ui.addTextArea(11, "<p align='center'><V>Team 4", nil, 588, 80, 140, 20, FF0000, FF0000, 1, true)
  477. ui.addTextArea(12, "<p align='center'><font color='#FF0000'>|</font>", nil, 210, 102, 140, 200, 0, 0, 0, true)
  478. ui.addTextArea(39, "<p align='center'><font color='#FF0000'>|</font>", nil, 450, 102, 140, 200, 0, 0, 0, true)
  479. ui.addTextArea(40, "", nil, 59, 120, 140, 200, FF0000, FF0000, 1, true)
  480. ui.addTextArea(31, "<p align='center'><font color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 60, 121, 138, 198, FF0000, FF0000, 1, true)
  481. ui.addTextArea(32, "", nil, 419, 120, 140, 200, FF0000, FF0000, 1, true)
  482. ui.addTextArea(33, "<p align='center'><font color='#"..colors[3].."'>"..table.concat(teams[3], "\n"), nil, 420, 121, 138, 198, FF0000, FF0000, 1, true)
  483. ui.addTextArea(34, "", nil, 589, 120, 140, 200, FF0000, FF0000, 1, true)
  484. ui.addTextArea(35, "<p align='center'><font color='#"..colors[4].."'>"..table.concat(teams[4], "\n"), nil, 590, 121, 138, 198, FF0000, FF0000, 1, true)
  485. ui.addTextArea(36, "", nil, 229, 120, 140, 200, FF0000, FF0000, 1, true)
  486. ui.addTextArea(13, "<p align='center'><font color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 230, 121, 138, 198, FF0000, FF0000, 1, true)
  487. ui.addTextArea(14, "<p align='center'><font color='#FF0000'>____ ____</font>", nil, 325, 197, 140, 200, 0, 0, 0, true)
  488. ui.addTextArea(15, "", nil, 374, 202, 40, 20, FF0000, FF0000, 1, true)
  489. ui.addTextArea(16, "<p align='center'><V>VS", nil, 375, 203, 38, 18, FF0000, FF0000, 1, true)
  490. ui.addTextArea(42, "", Admin, 749, 81, 40, 20, FF0000, FF0000, 1, true)
  491. ui.addTextArea(41, "<p align='center'><V><a href='event:salir'>X", Admin, 750, 82, 38, 18, FF0000, FF0000, 1, true)
  492. ui.addTextArea(45, "", Admin, 744, 139, 52, 20, FF0000, FF0000, 1, true)
  493. ui.addTextArea(46, "<p align='center'><V><a href='event:reset'>Reset", Admin, 745, 140, 50, 18, FF0000, FF0000, 1, true)
  494. ui.addTextArea(47, "", Admin, 741, 173, 57, 20, FF0000, FF0000, 1, true)
  495. ui.addTextArea(54, "", Admin, 741, 209, 57, 20, FF0000, FF0000, 1, true)
  496. if modo2 == "Solo" then
  497. ui.addTextArea(51, "<p align='center'><V><a href='event:Solo'><font size='12'>"..modo2, Admin, 742, 210, 55, 18, FF0000, FF0000, 1, true)
  498. end
  499. verificarmodo()
  500. ui.addTextArea(53, "", Admin, 741, 245, 57, 20, FF0000, FF0000, 1, true)
  501. ui.addTextArea(52, "<p align='center'><V><a href='event:kapat'><font size='12'>kapat", Admin, 742, 246, 55, 18, FF0000, FF0000, 1, true)
  502. ui.addTextArea(55, "", Admin, 741, 279, 57, 20, FF0000, FF0000, 1, true)
  503. ui.addTextArea(56, "<p align='center'><V><a href='event:Seç'><font size='12'>Seç", Admin, 742, 280, 55, 18, FF0000, FF0000, 1, true)
  504. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", Admin, 375, 203, 38, 18, FF0000, FF0000, 1, true)
  505. end
  506. function verificarmodo()
  507. ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s ",modob,modo2b),nil, 235, 375, 300, 17, FF0000, FF0000, 1, true)
  508. if modo2 == "normal" then
  509. ui.addTextArea(51, "<p align='center'><V><a href='event:normal'><font size='8'>"..modo2, Admin, 742, 210, 55, 18, FF0000, FF0000, 1, true)
  510. end
  511. if modo == "bootcamp" then
  512. ui.addTextArea(48, "<p align='center'><V><a href='event:bootcamp'><font size='9'>"..modo, Admin, 742, 174, 55, 18, FF0000, FF0000, 1, true)
  513. end
  514. if modo == "racing" then
  515. ui.addTextArea(48, "<p align='center'><V><a href='event:racing'><font size='9'>"..modo, Admin, 742, 174, 55, 18, FF0000, FF0000, 1, true)
  516. end
  517. if modo == "mix" then
  518. ui.addTextArea(48, "<p align='center'><V><a href='event:mix'><font size='9'>"..modo, Admin, 742, 174, 55, 18, FF0000, FF0000, 1, true)
  519. end
  520. end
  521. function contarjugadores()
  522. local players=0
  523. function eventNewPlayer(name)--Cuando un jugador entre a la sala...
  524. players=players+1--Sumamos 1 a nuestra tabla
  525. end
  526. function eventPlayerLeft(name)--Cuando un jugador salga de la sala...
  527. players=players-1--Restamos 1 a nuestra tabla
  528. end
  529. for name in pairs(tfm.get.room.playerList) do--Por cada jugador que esté en la sala...
  530. eventNewPlayer(name)--Le ejecutamos la función eventNewPlayer
  531. end
  532. end
  533. function eventTextAreaCallback(id, player, callback)
  534. if callback == 'iniciarJogo' then
  535. gameRunning = true
  536. for i = 1, 20 do
  537. ui.removeTextArea(i)
  538. end
  539. for i = 31, 56 do
  540. ui.removeTextArea(i)
  541. end
  542. borrarScoreSolo()
  543. defaultEffect(9, {9}, 400, 212, 80)
  544. newMap()
  545. end
  546. if callback == 'salir' then
  547. tfm.system.exit()
  548. end
  549.  
  550. if callback == 'Seç' then
  551. nteam = 1
  552. kapat = {}
  553. playersInGame = {}
  554.  
  555. teams = {
  556. [1] = {},
  557. [2] = {},
  558. [3] = {},
  559. [4] = {},
  560. }
  561. contarjugadores()
  562. for k,players in pairs(tfm.get.room.playerList) do
  563. if nteam > 4 then
  564. nteam = 1
  565. end
  566. table.insert(teams[nteam], k)
  567. playersInGame[k] = true
  568. nteam = nteam + 1
  569. displayTeams()
  570. end
  571. end
  572.  
  573. if callback == 'kapat' then
  574. nteam = 1
  575. kapat = {}
  576. playersInGame = {}
  577.  
  578. teams = {
  579. [1] = {},
  580. [2] = {},
  581. [3] = {},
  582. [4] = {},
  583. }
  584. contarjugadores()
  585.  
  586. for k,players in pairs(tfm.get.room.playerList) do
  587. kapat[k] = k
  588. playersInGame[k] = true
  589. end
  590.  
  591. for k,players in pairs(tfm.get.room.playerList) do
  592. if nteam > 4 then
  593. nteam = 1
  594. end
  595. if kapat[k] == k then
  596. jugador = kapat[math.random(#kapat)]
  597. table.insert(teams[players], jugador)
  598. kapat[k] = ""
  599. nteam = nteam + 1
  600. displayTeams()
  601. end
  602. end
  603.  
  604. end
  605.  
  606. if callback == 'reset' then
  607. teams[1] = {}
  608. points[1] = 0
  609. teams[2] = {}
  610. points[2] = 0
  611. teams[3] = {}
  612. points[3] = 0
  613. teams[4] = {}
  614. points[4] = 0
  615. displayTeams()
  616. end
  617. if callback == 'bootcamp' then
  618. tiempo = 150
  619. modob = "bootcamp"
  620. modo = "mix"
  621. verificarmodo()
  622. maps = mapasbootcamp
  623. end
  624. if callback == 'racing' then
  625.  
  626. tiempo = 60
  627. modob = "racing"
  628. modo = "bootcamp"
  629. verificarmodo()
  630. maps = mapasracing
  631. end
  632. if callback == 'mix' then
  633. tiempo = 90
  634. modob = "mix"
  635. modo = "racing"
  636. verificarmodo()
  637. maps = mapasmix
  638. end
  639. if callback == 'Solo' then
  640. modo2b = "Solo"
  641. modo2 = "normal"
  642. displayTeams()
  643. for i = 4, 15 do
  644. ui.removeTextArea(i)
  645. end
  646. for i = 31, 36 do
  647. ui.removeTextArea(i)
  648. end
  649. for i = 39, 40 do
  650. ui.removeTextArea(i)
  651. end
  652. contarjugadores()
  653. for k,players in pairs(tfm.get.room.playerList) do
  654. equipos[k] = k
  655. puntos[k] = 0
  656. equipoc[k] = "0x324650"
  657. playersInGame[k] = true
  658. if textareaid >= 32 then
  659. else
  660. ui.addTextArea(textarealugar, "<p align='center'><V>"..k, nil, distanciax, distanciay, 140, 18, FF0000, FF0000, 1, true)
  661. distanciay = distanciay + 37
  662. textareaid = textareaid + 1
  663. textarealugar = textarealugar + 1
  664. if textareaid == 8 then
  665. distanciax = distanciax + 190
  666. distanciay = 80
  667. textareaid = 0
  668. end
  669. ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", Admin, 375, 203, 38, 18, FF0000, FF0000, 1, true)
  670. end
  671. end
  672. end
  673. if callback == 'normal' then
  674. modo2b = "normal"
  675. modo2 = "Solo"
  676. resetmostrarjugadoressolo()
  677. displayTeams()
  678. end
  679. if callback == 'cerrarpuntaje' then
  680. borrarScoreSolo()
  681. end
  682. end
  683. function string.split(s, pattern, n)
  684. local st = {}
  685. for sb in string.gmatch(s, "[^"..pattern.."]+") do
  686. if not n or n > -1 then
  687. table.insert(st,sb)
  688. else
  689. st[#st] = st[#st]..pattern..sb
  690. end
  691. n = n and n-1 or false
  692. end
  693. return st
  694. end
  695. function table.contains(tableT, element)
  696. for _, value in pairs(tableT) do
  697. if value == element then
  698. return true
  699. end
  700. end
  701. return false
  702. end
  703. defaultEffect=function(id,p,x,y,rand)
  704. local minDist = 1
  705. local outerBorder = 20
  706. local maxDist = 30
  707. local totalParticles = rand and 40 or (id == -1 and 35 or 75)
  708. for i = 1, totalParticles do
  709. if rand then
  710. id = p[math.random(#p)]
  711. end
  712. local dist = math.min(math.random(minDist, maxDist), outerBorder)
  713. local angle = math.random(0, 360)
  714. local r = math.rad(angle)
  715. local dx = math.cos(r)
  716. local dy = math.sin(r)
  717. local vx = dist * dx / 10
  718. local vy = dist * dy / 10
  719. local ax = -vx / dist / 15
  720. local ay = (-vy / dist / 15) + 0.05
  721. if id == -1 then
  722. tfm.exec.displayParticle(9, x + dx, y + dy, vx, vy, ax, ay, nil)
  723. tfm.exec.displayParticle(1, x + dx, y + dy, vx, vy, ax, ay, nil)
  724. else
  725. tfm.exec.displayParticle(id, x + dx, y + dy, vx, vy, ax, ay, nil)
  726. end
  727. end
  728. end
  729. displayTeams()
  730. function eventPlayerDied()
  731. local alive = 0
  732. for k,v in pairs(tfm.get.room.playerList) do
  733. if not v.isDead then
  734. alive = alive+1
  735. end
  736. end
  737. if alive == 0 then
  738. newMap()
  739. end
  740. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement