Advertisement
alditojeje

Untitled

Apr 12th, 2020
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.89 KB | None | 0 0
  1.  
  2. --[[
  3. CMDS:
  4. 1. !team1 "playername" "playername" \\Assign players to team1 , ex: !team1 Ctmce Ziggy_z
  5. 2. !team2 "playername "playername" \\Assign players to team2 , ex: !team2 Ctmce Ziggy_z
  6. 3. !add team1 "playername" "playername" \\Adds the player team1.
  7. 4. !add team2 "playername" "playername" \\Adds the player team2.
  8. 5. !remove team1 "playername" "playername" \\Removes the player/'s from team1!
  9. 6. !remove team2 "playername" "playername" \\Removes the player/'s from team2!
  10. 7. !exit \\Closing the Admin Panel//
  11. 8. !start \\Shows the Admin Panel back//
  12. 9. !sp team1 23 \\Sets the points for team1 to 23 or whatever you choose!
  13. 10. !sp team2 15 \\Sets the points for team1 to 15 or whatever you choose!
  14. 11. !aj on / off \\Turns AutoJoin On and Off.
  15. 12. !pause //pauses the game , and shows the gui back ^^
  16. ---------------------------------
  17. Total Commands Count: [8].
  18. Total BootcampMaps Count: [222].
  19. Total RacingMaps Count: [1424].
  20. ---------------------------------
  21.  
  22. TODO:
  23. 1. Make 4 teams!
  24. --]]
  25.  
  26. --Admin/Game Setup--
  27. --local Admin = "Misterthepro#0000" --Write your name here to be able to use the Admin Panel--
  28. local admin = {
  29. ["Blood#3565"] = true,
  30. ["Misterthepro#0000"] = true,
  31. ["Fabi#5061"] = true,
  32. ["Alditohacker#0000"] = true
  33. }
  34. local ScoreToWin = 15 --Type here the amount of points need to win the game(Leave it at the same number it is right now if you want to change it in the Setup Panel)--
  35. local autoJoin = true
  36. local team1Color = "Red"
  37. local team2Color = "Blue"
  38. local mod = "Bootcamp"
  39.  
  40.  
  41. --DO NOT CHANGE THE SCRIPT!--
  42. local teams = {Team1 = {}, Team2 = {}}
  43. --Team score--
  44. local teamScore = {Team1 = 0, Team2 = 0}
  45. --------------
  46. ---Maps---
  47. local bootcampMaps = {
  48. 113156, 124000, 149422, 149451, 150651, 150664, 151655, 152260, 152733,
  49. 153996, 155480, 155606, 155611, 155628, 155765, 156720, 157203, 157805,
  50. 157960, 158345, 158417, 158909, 159187, 159298, 159932, 160841, 161023,
  51. 161434, 162482, 163159, 163172, 163506, 163531, 163596, 164544, 164916,
  52. 165186, 166032, 177652, 166056, 166271, 166333, 166361, 166430, 166805,
  53. 167075, 167903, 168204, 167903, 168754, 169059, 169076, 169110, 169139,
  54. 171148, 171480, 171482, 171776, 172501, 172512, 172520, 172547, 172605,
  55. 172621, 172951, 172976, 173623, 173816, 174223, 175204, 175280, 176253,
  56. 176507, 176710, 176729, 179005, 179488, 179492, 179807, 180801, 182370,
  57. 182769, 183139, 183141, 184648, 184817, 184868, 185289, 185428, 185529,
  58. 185529, 185873, 185887, 186066, 189819, 190646, 190996, 191177, 191203,
  59. 191205, 191443, 191642, 192158, 192255, 192959, 193662, 195116, 195672,
  60. 197229, 198988, 199210, 199710, 199826, 201000, 202574, 203664, 204488,
  61. 204647, 205240, 205506, 206396, 208056, 208373, 232675, 208653, 208940,
  62. 209848, 213752, 213755, 213874, 214631, 214755, 216173, 217261, 220352,
  63. 222377, 222910, 223947, 2795201, 225744, 226266, 227093, 230588, 231137,
  64. 231921, 232469, 232678, 235037, 236768, 237091, 242291, 250153, 254785,
  65. 257218, 257324, 257715, 258192258908, 259319, 261298, 261814, 263819,
  66. 263926, 264091, 268915, 270143, 270924, 271193, 271411, 159145, 272402,
  67. 272518, 272689, 277427, 277513, 514311, 277824, 279337, 281948, 282584,
  68. 284134, 286254, 289865, 2574744, 295465, 295630, 295932, 297442, 299942,
  69. 299983, 301610, 302080, 303151, 303939, 304861, 305567, 305614, 305820,
  70. 306365, 306384, 313216, 314743, 315666, 315800, 316012, 318129, 319443,
  71. 320483, 320626, 322582, 327354, 329318, 329571, 330933, 330967, 331344,
  72. 331988, 332130, 332906, 333002, 336305, 337644, 342035, 343456, 354984,
  73. 361500, 365061, 368839, 372419, 392240, 393426, 394132, 395216, 395310,
  74. 395961, 397467, 397469, 399364, 401630, 403755, 403940, 408577, 408643,
  75. 410040, 410045, 412467, 412913, 419335, 419369, 419635, 420877, 422981,
  76. 423311, 424604, 424685, 424900, 425884, 431433, 431749, 432501, 435812,
  77. 438333, 438364, 439092, 444589, 447805, 449496, 454049, 455271, 457726,
  78. 458528, 460961, 467137, 476706, 478236, 492222, 492399, 496610, 496886,
  79. 497965, 499986, 500690, 500748, 500894, 504485, 505619, 506032, 506613,
  80. 506940, 510996, 511136, 512887, 523270, 528032, 531084, 541223, 541693,
  81. 541729, 543010, 551317, 556841, 380516, 557066, 560583, 562897, 563436,
  82. 564198, 568122, 571683, 586901, 592189, 593164, 593431, 593530, 596239,
  83. 605255, 608368, 618999, 684566, 692650, 692740, 783547, 801683, 815336,
  84. 834297, 842019, 842167, 868262, 898934, 912356, 919484, 976944, 1000006,
  85. 1004622, 1014313, 1018394, 1157281, 1162831, 1164086, 1242584, 1255359,
  86. 536905, 1265789, 1266330, 1383297, 1384078, 1413528, 1427980, 1435902,
  87. 1494499, 1503203, 1526894, 1531604, 1540221, 1580356, 1580835, 1593066,
  88. 1595965, 1615753, 1615949, 1647131, 1678634, 1722755, 1733211, 1788490,
  89. 1807217, 1809410, 2040569, 2130169, 2311703, 2423300, 256899, 2520540,
  90. 2636519, 2738370, 2794566, 2989803, 3136410, 3199998, 3242049, 3908151,
  91. 4067327, 4445580, 330841, 2176211, 373105, 375455, 376704, 378704, 2252731,
  92. 1646448, 4488666, 698992, 3888888, 4627777, 528782, 192519, 159691, 158053,
  93. 3907267, 3848147, 2692883, 5517891, 7016000, 215933, 343875, 507884, 597348,
  94. 720672, 1951944, 2850177, 2918822, 3043779, 3076903, 3200001, 3483300,
  95. 3527399, 3937567, 4854539, 1893451, 5534007 ,394125,3734989,3734996,3734998,3866660,320607,3089270,170483,1852910,2998268,658960,293306,157098,178297,328351,182681,176614,229802,233971,237188,239698,242351,245908,247311,252142,255561,255776,256886,258801,259029,261784,262533,263730,265652,267589,267973,268668,268882,270650,273903,275897,277641,279502,292809,7023000,294249,295620,296518,297465, 6892200, 6000050, 157004, 158345, 158417, 163094, 7288650, 3473925, 192560,
  96. 216171, 2795201, 263819, 4617716, 590775, 306655, 307324, 327743, 2914456,
  97. 372255, 391924, 392240, 397478, 3133917, 2932238, 438364, 482791, 500000,
  98. 522719, 552986, 557074, 560583, 587501, 2242899, 612415, 721319, 722837,
  99. 562897, 563436, 564198, 568122, 571683, 574183, 575497, 584783, 560526,
  100. 729863, 374995, 758595, 881158, 886744, 970919, 1046877, 1066607, 1130256,
  101. 1156092, 1226207, 1301649, 1303323, 1323048, 1333846, 1384078, 1410539,
  102. 1620703, 1955745, 1989803, 1990413, 2024960, 2178800, 2329940, 2416969,
  103. 2469365, 2788517, 2846829, 3038589, 3668888, 3690269, 3988424, 549666,
  104. 4114521, 1523082, 5960814, 1256085, 6137767, 4890068, 557132, 357892,
  105. 273373, 225484, 5000126, 6533602, 6574593, 293559, 6696038, 6600067,
  106. 4763378, 1601992, 4770120, 6774534, 4877895, 425533, 556973, 4769901,
  107. 406154, 6642996, 6675248, 223174, 6999009, 4895345, 655207, 823329, 2082776,
  108. 2309030, 2963166, 2999994, 3828508, 3976977, 4107909, 4632975, 5092739,
  109. 6593495, 6727980, 2803483, 4237910, 4538472, 3521460, 2128560, 3493490,
  110. 4362335, 2294519, 6000033, 6284671, 7196861, 7261219, 6640663, 7306627,
  111. 7324922, 6000044, 7110102, 7370291, 6931020, 7290999, 7000002, 7512725,
  112. 7598733, 6462982,3707630,1737800,3734988,3734990,3747520,3750360,3759157,3767893,3779861,3850000,3799357,6722315,3815568,3826546,3849999,3860578,3866663,3920916,355336,5263927,3958217,5342889,3964892,3969628,6304911,3976766,3999991,3999992,3999997,4000007,4000008,4000009,4027263,4241333,4039451,4058168,4093488,7024409,4121359,4333895,5132197,4317592,5134116,7091488,1972688,4337732,1568331,4295473,4234558,7005221,4249695,4413656,3820501,3999979,3939000,4484685,6609034,6022675,4644584,4311255,4697673,4000000,3295954,4365527,4313858,3530999,2758747,4594304,322649,3999110,3838020,1923584,3846632,4720851,3734984,1551020,621850,4506542,4948659,315283,3311534,4822672,6621953,6827739,5008365,5505990,5931069,187478,4000662,2395201,2941840,4948551,3142783,4220381,5473125,2605186,5616777,5761507,4398794,5914063,5706542,5340984,6546598,6045500,293658,4117513,5356911,5284625,6079100,5998000,5758150,5720741,3985463,4660408,3500000,5444444,3984871,219956,6289411,330827,366260,4000010,6041917,7134487,7319472,5933637,6450492,238951,248650,249003,250664,277665,282332}
  113. local rMaps = {}
  114. local mRound = 5
  115. ----------
  116. local teamColors = {Red = 'CB546B', Blue = '2F7FCC'}
  117. local first = false
  118. ---Game Time Settings----
  119. local gameTime = {Minutes = 1,Seconds = 2}
  120. local Ticker = 0
  121. -------------------------
  122. local gameStarted = false
  123. currentMap = 0
  124. team1C = team1Color
  125. team2C = team2Color
  126.  
  127. function main()
  128. tfm.exec.disableAllShamanSkills(true)
  129. tfm.exec.disableAutoNewGame(true)
  130. tfm.exec.disableAutoShaman(true)
  131. tfm.exec.disableAutoScore(true)
  132. tfm.exec.disableAutoTimeLeft(true)
  133. tfm.exec.disableDebugCommand(true)
  134. tfm.exec.disablePhysicalConsumables(true)
  135. checkColor()
  136. ShowStartBoard()
  137. end
  138.  
  139. function eventNewGame()
  140. if gameStarted then
  141. currentMap = tostring(tfm.get.room.currentMap)
  142. setTimeMode()
  143. for n,p in pairs(tfm.get.room.playerList) do
  144. if not PlayerInTeam(n) then
  145. tfm.exec.killPlayer(n)
  146. end
  147. end
  148. SetPlayerNameColor()
  149. first = false
  150. if mod == "Bootcamp" then
  151. tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#"..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":" ..gameTime.Seconds .."\n")
  152. end
  153. end
  154. end
  155.  
  156.  
  157. function eventNewPlayer(plr)
  158. if gameStarted then
  159. if PlayerInTeam(plr) then tfm.exec.killPlayer(plr) return end
  160. --[[ if autoJoin then
  161. if #teams.Team1 == #teams.Team2 then
  162. table.insert(teams.Team1,plr)
  163. elseif #teams.Team1 > #teams.Team2 then
  164. table.insert(teams.Team2,plr)
  165. end
  166. end ]]
  167. end
  168. end
  169.  
  170. function eventPlayerDied(plr)
  171. if gameStarted then
  172. local plrCount = 0
  173. for n,p in pairs(tfm.get.room.playerList) do
  174. if not p.isDead then
  175. plrCount = plrCount + 1
  176. end
  177. end
  178. if plrCount <= 0 then
  179. newMap()
  180. print("Se murieron todos jajaencerio")
  181. end
  182. end
  183. end
  184.  
  185. function eventPlayerWon(plr, TT, wonTime)
  186. if gameStarted then
  187. if PlayerInTeam(plr) then
  188. if not first then
  189. if table.contain(teams.Team1,plr) then
  190. first = true
  191. teamScore.Team1 = teamScore.Team1 + 1
  192. tfm.exec.setPlayerScore(plr, 1,true)
  193. gameTime.Minutes = 0
  194. gameTime.Seconds = 3
  195. if tonumber(teamScore.Team1) >= tonumber(ScoreToWin) then
  196. print("Team 1 won the game! The last point made by: "..plr)
  197. gameStarted = false
  198. tfm.exec.newGame(7692692,true)
  199. ShowStartBoard()
  200. ui.addTextArea(16, "<font size='13' color='#ffffff'><i>Team</font><font color='#" ..team1Color .."'> " ..team1C .."</font> won the game!</font></font>", nil, 8, 166, 202, 60, 0x000000, 0x5eff6e, 0, true)
  201. ui.addTextArea(17, "<font size='13' color='#ffffff'><i>The Player:<font color='#"..team1Color .."'> "..plr .."</font> made the last point!", nil, 602, 166, 188, 61, 0xffffff, 0x5eff6e, 0, true)
  202. end
  203. else
  204. first = true
  205. --if the plr form team2 then
  206. teamScore.Team2 = teamScore.Team2 + 1
  207. tfm.exec.setPlayerScore(plr, 1,true)
  208. gameTime.Minutes = 0
  209. gameTime.Seconds = 3
  210. if tonumber(teamScore.Team2) >= tonumber(ScoreToWin) then
  211. print("Team 2 won the game! The last point made by: "..plr)
  212. gameStarted = false
  213. tfm.exec.newGame(7692692,true)
  214. ShowStartBoard()
  215. ui.addTextArea(16, "<font size='13' color='#ffffff'><i>Team</font><font color='#" ..team2Color .."'> " ..team2C .."</font> won the game!</font></font>", nil, 8, 166, 202, 60, 0x000000, 0x5eff6e, 0, true)
  216. ui.addTextArea(17, "<font size='13' color='#ffffff'><i>The Player:<font color='#"..team2Color .."'> "..plr .."</font> made the last point!", nil, 602, 166, 188, 61, 0xffffff, 0x5eff6e, 0, true)
  217. end
  218. end
  219. end
  220. end
  221. end
  222. end
  223. function eventTextAreaCallback(id, player, callback)
  224. if admin[player] then
  225. --if id == 8 then
  226. --if callback == "bc" then
  227. -- mod = "Bootcamp"
  228. --ShowStartBoard()
  229. -- end
  230. if id == 10 then
  231. if callback == "start" then
  232. for i=0, 17,1 do
  233. ui.removeTextArea(i)
  234. end
  235. gameStarted = true
  236. teamScore.Team1 = 0
  237. teamScore.Team2 = 0
  238. resetScore()
  239. -- print("Game started! Made by - Ctmce -")
  240. newMap()
  241. end
  242. elseif id == 11 then
  243. if callback == "dec" then
  244. if tonumber(ScoreToWin) > 1 then
  245. ScoreToWin = ScoreToWin - 1
  246. ShowStartBoard()
  247. end
  248. elseif callback == "inc" then
  249. if tonumber(ScoreToWin) < 99 then
  250. ScoreToWin = ScoreToWin + 1
  251. ShowStartBoard()
  252. end
  253. end
  254. elseif callback == "versus1" then
  255. teams.Team1 = {}
  256. teams.Team2 = {}
  257. table.insert(teams.Team1,"Blood#3565")
  258. table.insert(teams.Team1,"Misterthepro#0000")
  259.  
  260. table.insert(teams.Team2,"Noob#5388")
  261. table.insert(teams.Team2,"Edudekarly#3398")
  262. ShowStartBoard()
  263. elseif callback == "versus2" then
  264. teams.Team1 = {}
  265. teams.Team2 = {}
  266. table.insert(teams.Team1,"Darkfestt#0000")
  267. table.insert(teams.Team1,"Kiwi#8872")
  268.  
  269. table.insert(teams.Team2,"Illenium#4890")
  270. table.insert(teams.Team2,"Kimqueen#5976")
  271. ShowStartBoard()
  272. elseif callback == "versus3" then
  273. teams.Team1 = {}
  274. teams.Team2 = {}
  275. table.insert(teams.Team1,"Bones#9712")
  276. table.insert(teams.Team1,"Frig#3331")
  277.  
  278. table.insert(teams.Team2,"Fabi#5061")
  279. table.insert(teams.Team2,"Sanders#1255")
  280. ShowStartBoard()
  281. elseif callback == "versus4" then
  282. teams.Team1 = {}
  283. teams.Team2 = {}
  284. table.insert(teams.Team1,"Raatonsexy#0000")
  285. table.insert(teams.Team1,"Fresco#8600")
  286.  
  287. table.insert(teams.Team2,"Z4mas#0000")
  288. table.insert(teams.Team2,"Joseph2006#0000")
  289. ShowStartBoard()
  290. end
  291. end
  292. end
  293.  
  294. function eventChatCommand(name, command)
  295. if admin[name] then
  296. local arg={}
  297. for argument in command:gmatch("[^%s]+") do
  298. table.insert(arg,argument)
  299. end
  300. if arg[1]:lower() == "team1" and arg[2] ~= nil then
  301. teams.Team1 = {}
  302. for i,v in pairs(arg) do
  303. if i > 1 then
  304. if PlayerCheck(v) then
  305. if TeamFix(v) == "team2"then
  306. table.clear(teams.Team2,v)
  307. table.insert(teams.Team1,v)
  308. if not gameStarted then
  309. ShowStartBoard()
  310. end
  311. else
  312. table.insert(teams.Team1,v)
  313. if not gameStarted then
  314. ShowStartBoard()
  315. end
  316. end
  317. else
  318. print("Sory couldn't found: " .. tostring(v))
  319. end
  320. end
  321. end
  322. elseif arg[1]:lower() == "team2" and arg[2] ~= nil then
  323. teams.Team2 = {}
  324. for i,v in pairs(arg) do
  325. if i > 1 then
  326. if PlayerCheck(v) then
  327. if TeamFix(v) == "team1"then
  328. table.clear(teams.Team1,v)
  329. table.insert(teams.Team2,v)
  330. if not gameStarted then
  331. ShowStartBoard()
  332. end
  333. else
  334. table.insert(teams.Team2,v)
  335. if not gameStarted then
  336. ShowStartBoard()
  337. end
  338. end
  339. else
  340. print("Sory couldn't found: " .. tostring(v))
  341. end
  342. end
  343. end
  344. elseif arg[1]:lower() == "add" and arg[2]:lower() == "team1" and arg[3] ~= nil then
  345. for i,v in pairs(arg) do
  346. if i > 1 then
  347. if PlayerCheck(v) then
  348. if TeamFix(v) == "team2"then
  349. table.clear(teams.Team2,v)
  350. table.insert(teams.Team1,v)
  351. if not gameStarted then
  352. ShowStartBoard()
  353. end
  354. else
  355. table.insert(teams.Team1,v)
  356. if not gameStarted then
  357. ShowStartBoard()
  358. end
  359. end
  360. end
  361. end
  362. end
  363. elseif arg[1]:lower() == "add" and arg[2]:lower() == "team2" and arg[3] ~= nil then
  364. for i,v in pairs(arg) do
  365. if i > 1 then
  366. if PlayerCheck(v) then
  367. if TeamFix(v) == "team1"then
  368. table.clear(teams.Team1,v)
  369. table.insert(teams.Team2,v)
  370. if not gameStarted then
  371. ShowStartBoard()
  372. end
  373. else
  374. table.insert(teams.Team2,v)
  375. if not gameStarted then
  376. ShowStartBoard()
  377. end
  378. end
  379. end
  380. end
  381. end
  382. elseif arg[1] == "remove" and arg[2] == "team1" and arg[3] ~= nil then
  383. if TeamFix(arg[3]) == "team1" then
  384. if not gameStarted then
  385. table.clear(teams.Team1,arg[3])
  386. ShowStartBoard()
  387. else
  388. table.clear(teams.Team1,arg[3])
  389. end
  390. end
  391. elseif arg[1] == "remove" and arg[2] == "team2" and arg[3] ~= nil then
  392. if TeamFix(arg[3]) == "team2" then
  393. if not gameStarted then
  394. table.clear(teams.Team2,arg[3])
  395. ShowStartBoard()
  396. else
  397. table.clear(teams.Team2,arg[3])
  398. end
  399. end
  400. elseif arg[1]:lower() == "aj" and arg[2]:lower() == "on" and arg[3] == nil then
  401. autoJoin = true
  402. elseif arg[1]:lower() == "aj" and arg[2]:lower() == "off" and arg[3] == nil then
  403. autoJoin = false
  404. elseif arg[1]:lower() == "start" then
  405. if not gameStarted then
  406. ShowStartBoard()
  407. end
  408. elseif arg[1]:lower() == "exit" and arg[2] == nil then
  409. if not gameStarted then
  410. for i=0,17,1 do
  411. ui.removeTextArea(i)
  412. end
  413. end
  414. elseif arg[1]:lower() == "reset" and arg[2] == nil then
  415. if gameStarted then
  416. gameStarted = false
  417. rMaps = {}
  418. tfm.exec.newGame(0)
  419. ShowStartBoard()
  420. end
  421. elseif arg[1]:lower() == "d" and tonumber(arg[2]) ~= nil and arg[3] == nil then
  422. if tonumber(arg[2]) > 0 and tonumber(arg[2]) <= 99 then
  423. ScoreToWin = arg[2]
  424. else
  425. print("The limit of the WinScore is between 0-500!")
  426. end
  427. elseif arg[1]:lower() == "skip" and arg[2] == nil then
  428. newMap()
  429. elseif arg[1]:lower() == "sp" then
  430. if arg[2]:lower() == "team1" then
  431. if tonumber(arg[3]) ~= nil then
  432. if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then
  433. teamScore.Team1 = tonumber(arg[3])
  434. end
  435. end
  436. elseif arg[2]:lower() == "team2" then
  437. if tonumber(arg[3]) ~= nil then
  438. if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then
  439. teamScore.Team2 = tonumber(arg[3])
  440. end
  441. end
  442. end
  443. end
  444. end
  445. end
  446.  
  447. function eventLoop(current, left)
  448. if gameStarted then
  449. Ticker = Ticker + 1
  450. if Ticker%2 == 0 then
  451. if gameTime.Minutes <= 0 and gameTime.Seconds <= 0 then
  452. newMap()
  453. elseif gameTime.Seconds < 1 then
  454. gameTime.Minutes = gameTime.Minutes - 1
  455. gameTime.Seconds = 59
  456. end
  457. if gameTime.Seconds > 9 then
  458. tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#"..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":" ..gameTime.Seconds .."\n")
  459. elseif gameTime.Seconds < 10 then
  460. -- tfm.exec.setUIMapName(currentMap .."| Time left: 0" .. gameTime.Minutes ..":0".. gameTime.Seconds .." | " ..team1C ..": ".. teamScore.Team1 .."/ "..team2C ..": "..teamScore.Team2 .."\n")
  461. tfm.exec.setUIMapName(currentMap .." <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2 .."</font> / <n>D:"..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes ..":0" ..gameTime.Seconds .."\n")
  462. end
  463. gameTime.Seconds = gameTime.Seconds - 1
  464. Ticker = 0
  465. end
  466. end
  467. end
  468.  
  469.  
  470. function newMap()
  471. --Write the maps codes first and then make it choose a random map .
  472. if mod == "Bootcamp" then
  473. math.randomseed(os.time())
  474. local r = bootcampMaps[math.random(#bootcampMaps)]
  475. if tableSizeKey(rMaps,r) > 0 then
  476. for i,v in pairs(rMaps) do
  477. if rMaps[i] > 0 then
  478. rMaps[i] = rMaps[i] - 1
  479. print(rMaps[i])
  480. elseif rMaps[i] <= 0 then
  481. rMaps = table_removeKey(rMaps,i)
  482. end
  483. end
  484. end
  485. if rMaps[tostring(r)] then
  486. newMap()
  487. else
  488. rMaps[tostring(r)] = mRound
  489. tfm.exec.newGame(r)
  490. print(r)
  491. end
  492. end
  493. end
  494.  
  495. function SetPlayerNameColor()
  496. checkColor()
  497. for i,v in pairs(teams.Team1) do
  498. tfm.exec.setNameColor(v, "0x"..team1Color)
  499. end
  500.  
  501. for i,v in pairs(teams.Team2) do
  502. tfm.exec.setNameColor(v, "0x"..team2Color)
  503. end
  504. end
  505.  
  506. function setTimeMode()
  507. gameTime.Minutes = 1
  508. gameTime.Seconds = 50
  509.  
  510. end
  511.  
  512. function FillTeams()
  513. local t = 1
  514. teams.Team1 = {}
  515. teams.Team2 = {}
  516. for n,p in pairs(tfm.get.room.playerList) do
  517. if t == 1 then
  518. table.insert(teams.Team1,n)
  519. t = 2
  520. elseif t == 2 then
  521. table.insert(teams.Team2,n)
  522. t = 1
  523. end
  524. end
  525. end
  526.  
  527. function checkColor()
  528. local c = false
  529. for key,v in pairs(teamColors) do
  530. if key == team1Color then
  531. team1Color = v
  532. c = true
  533. elseif key == team2Color then
  534. team2Color = v
  535. c = true
  536. elseif team1Color == v then
  537. c = true
  538. elseif team2Color == v then
  539. c = true
  540. end
  541. end
  542. if c then
  543. print("Team colors succesfully setted!")
  544. else
  545. team1Color = teamColors.Green
  546. team2Color = teamColors.Blue
  547. print("Sory couldn't found the color you choosed, Defult color will be apllied.")
  548. end
  549. end
  550.  
  551. function table.clear(t,obj)
  552. for i,v in ipairs(t) do
  553. if v==obj then
  554. table.remove(t,i)
  555. end
  556. end
  557. end
  558.  
  559. function table.contain(t,obj)
  560. for i,v in pairs(t) do
  561. if v==obj then
  562. return true
  563. end
  564. end
  565. return false
  566. end
  567.  
  568. function table_removeKey(t,i)
  569. local tClone = {}
  570. for k,v in pairs(t) do
  571. if k ~= i then
  572. tClone[k] = v
  573. end
  574. end
  575. return tClone
  576. end
  577.  
  578. function tableSizeKey(t,i)
  579. local counter = 0
  580. for k,v in pairs(t) do
  581. if k ~= i then
  582. counter = counter + 1
  583. end
  584. end
  585. return counter
  586. end
  587.  
  588. function resetScore()
  589. for n,p in pairs(tfm.get.room.playerList) do
  590. tfm.exec.setPlayerScore(n, 0,false)
  591. end
  592. end
  593.  
  594. function TeamFix(plr)
  595. local char = plr
  596. for i,v in pairs(teams.Team1) do
  597. if v == char then
  598. return "team1"
  599. end
  600. end
  601. for i,n in pairs(teams.Team2) do
  602. if n == char then
  603. return "team2"
  604. end
  605. end
  606. return false
  607. end
  608.  
  609. function PlayerCheck(plr)
  610. local playerToSerch = plr
  611. for n,p in pairs(tfm.get.room.playerList) do
  612. if n == plr then
  613. return true
  614. end
  615. end
  616. return false
  617. end
  618.  
  619. function PlayerInTeam(plr)
  620. local player = plr
  621. for i,v in pairs(teams.Team1) do
  622. if v == player then
  623. return true
  624. end
  625. end
  626. for i,n in pairs(teams.Team2) do
  627. if n == player then
  628. return true
  629. end
  630. end
  631. return false
  632. end
  633.  
  634. function ShowStartBoard()
  635. ui.addTextArea(0, "<p align='center'><font size='13'> Administradores: <font color='#00ff40'><b>Fabi#5061 y Ijuini#0000", nil, 247, 367, 305, 25, 0x324650, 0x000000, 0.8, true)
  636. ui.addTextArea(1, "", nil, 209, 33, 381, 326, 0x324650, 0x000000, 1, true)
  637. ui.addTextArea(2, "<p align='center'><font size='12' color='#" ..team1Color .."'>" .. (table.concat(teams.Team1,"\n") or ""), nil, 208, 66, 151, 254, 0x324650, 0x000000, 1, true)
  638. ui.addTextArea(3, "<p align='center'><font size='12' color='#" ..team2Color .."'> " .. (table.concat(teams.Team2,"\n") or ""), nil, 438, 66, 151, 254, 0x324650, 0x000000, 1, true)
  639. ui.addTextArea(4, "<p align='center'>" ..(mod), nil, 354, 60, 89, 19, 0x324650, 0x000000, 1, true)
  640. ui.addTextArea(5, "<font size='12'><p align='center'><b><font color='#00C17C'> \\ The Legends Bc Tournament /</font></b>", nil, 209, 33, 381, 21, 0x324650, 0x000000, 1, true)
  641. --ui.addTextArea(6, "<p align='center'>Made by - <font color='#ff0000'>Ctmce</font> -", nil, 207, 33, 109, 20, 0x324650, 0x000000, 0, true)
  642. -- ui.addTextArea(7, "Racing 2/4 Teams!", nil, 510, 33, 109, 20, 0x324650, 0x000000, 0, true)
  643. -- ui.addTextArea(8, "<p align='center'><b><a href='event:bc'>Bootcamp</a>", nil, 365, 208, 69, 19, 0x540c0c, 0x000000, 1, true)
  644. -- ui.addTextArea(9, "<p align='center'><b><a href='event:rc'>Racing</a>", nil, 365, 157, 69, 20, 0x1a0d6e, 0x000000, 1, true)
  645. ui.addTextArea(10, "<p align='center'><font size='13'><b><a href='event:start'><A:ACTIVE>Start</a></font>", nil, 359, 180, 82, 23, 0x324650, 0x000000, 1, true)
  646. ui.addTextArea(11, "<p align='center'>Score: <a href='event:dec'>-</a><font color='#00C17C'> "..ScoreToWin .." </font><a href='event:inc'>+</a>", nil, 356, 210, 87, 20, 0x324650, 0x000000, 1, true)
  647. ui.addTextArea(12, "<p align='center'><b><T><a href='event:versus1'>Versus 1</T>", nil, 217, 335, 65, 20, 0x324650, 0x000000, 1, true)
  648. ui.addTextArea(13, "<p align='center'><b><V><a href='event:versus2'>Versus 2</V>", nil, 315, 335, 65, 20, 0x324650, 0x000000, 1, true)
  649. ui.addTextArea(14, "<p align='center'><b><VP><a href='event:versus3'>Versus 3</VP></a>", nil, 418, 335, 65, 20, 0x324650, 0x000000, 1, true)
  650. ui.addTextArea(15, "<p align='center'><b><CH><a href='event:versus4'>Versus 4</CH>", nil, 518, 335, 65, 20, 0x324650, 0x000000, 1, true)
  651.  
  652. end
  653. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement