Advertisement
alditojeje

Untitled

Aug 25th, 2020
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.16 KB | None | 0 0
  1. --[[
  2. CMDS:
  3. 1. !team1 "playername" "playername" \\Assign players to team1 , ex: !team1 Ctmce Ziggy_z
  4. 2. !team2 "playername "playername" \\Assign players to team2 , ex: !team2 Ctmce Ziggy_z
  5. 3. !add team1 "playername" "playername" \\Adds the player team1.
  6. 4. !add team2 "playername" "playername" \\Adds the player team2.
  7. 5. !remove team1 "playername" "playername" \\Removes the player/'s from team1!
  8. 6. !remove team2 "playername" "playername" \\Removes the player/'s from team2!
  9. 7. !exit \\Closing the Admin Panel//
  10. 8. !start \\Shows the Admin Panel back//
  11. 9. !sp team1 23 \\Sets the points for team1 to 23 or whatever you choose!
  12. 10. !sp team2 15 \\Sets the points for team1 to 15 or whatever you choose!
  13. 11. !aj on / off \\Turns AutoJoin On and Off.
  14. 12. !pause //the game will be paused until you put !pause again => it has been not implemented yet
  15.  
  16.  
  17. AntiMacro Version added by Misterthepro#0000, Fafee#0000 and Blood#3565
  18. CMDS:
  19.  
  20. 1. !macrosall \\ Enable
  21. --]]
  22.  
  23. --Admin/Game Setup--
  24. local admin = {"Fafee#0000","Mattseba#0000", "Blood#3565", "His#0439"} -- only the first position of the array will be shown in the gui
  25. local ScoreToWin = 20 --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)--
  26. local autoJoin = true
  27. local team1Color = "Blue"
  28. local team2Color = "Red"
  29. local mod = "Bootcamp"
  30. local macrosAll = false -- Starts in false
  31. local antiLeve = false
  32.  
  33. --^^^^^^^^^^^^^^^^^^^CHANGE ONLY THE THINGS ABOVE^^^^^^^^^^^^^^^^^^^--
  34. --------------
  35.  
  36. --DO NOT CHANGE THE SCRIPT!--
  37. local teams = {Team1 = {}, Team2 = {}}
  38. --Team score--
  39. local teamScore = {Team1 = 0, Team2 = 0}
  40. --------------
  41. local teamColors = {Blue = '2F7FCC', Red = 'CB546B'}
  42. local first = false
  43. ---Game Time Settings----
  44. local gameTime = {Minutes = 1,Seconds = 2}
  45. local Ticker = 0
  46. ----Variable for mix game---------------------
  47. local mix_v = true
  48. ----array for maps already played------------------------
  49. local already_maps = {}
  50. local b_c = true
  51. -----------------------------
  52. local gameStarted = false
  53. currentMap = 0
  54. team1C = team1Color
  55. team2C = team2Color
  56.  
  57. local mapsAnti = {6641062,6641147,6641130,6641108,6641063,6640755,6641141,6641097,6641144,6641111,6641110,6641087,6641075,6641132,6641101,6641090,6641077,6641069,6641067,6641064 ,6641058,6640884,6640869,6640866,6640860,6640859,6640858,6640854,6640852,6640846,6640833,6640816,6640808,6640737,6641109,6641096}
  58.  
  59. ------- U W U
  60. --------------------- MACRO
  61. local i, counter
  62. counter = 0
  63. local players = {}
  64. local k_arr = {}
  65.  
  66. function addNewItem(keyTable, myTable, key, value)
  67. table.insert(keyTable, key)
  68. myTable[key] = value
  69. end
  70.  
  71. function removeItem(keyTable, key)
  72. for i=1, #keyTable do
  73. if keyTable[i] == key then
  74. table.remove(keyTable, i)
  75. return
  76. end
  77. end
  78. end
  79.  
  80. function eventKeyboard(name, key, down, x, y) -- When you press UP, W or Z
  81. if key == 38 then
  82. players[name].contUpArrow = players[name].contUpArrow + 1
  83. elseif key == 87 then
  84. players[name].contW = players[name].contW + 1
  85. elseif key == 90 then
  86. players[name].contZ = players[name].contZ + 1
  87. end
  88. end
  89.  
  90. ---------------------- MACRO
  91.  
  92. function main()
  93. system.disableChatCommandDisplay(nil)
  94. tfm.exec.disableAllShamanSkills(true)
  95. tfm.exec.disableAutoNewGame(true)
  96. tfm.exec.disableAutoShaman(true)
  97. tfm.exec.disableAutoScore(true)
  98. tfm.exec.disableAutoTimeLeft(true)
  99. tfm.exec.disableDebugCommand(true)
  100. tfm.exec.disablePhysicalConsumables(true)
  101. checkColor()
  102. ShowStartBoard()
  103. end
  104.  
  105. function establecerEquipos()
  106. teams.Team1 = {}
  107. teams.Team2 = {}
  108. local equipo = 1
  109. local jugadoresTotal = {}
  110.  
  111. for name, p in pairs(tfm.get.room.playerList) do
  112. table.insert(jugadoresTotal, name)
  113. end
  114.  
  115. for i = 1, #jugadoresTotal do
  116. numJugador = math.random(#jugadoresTotal)
  117. agregarJugador = jugadoresTotal[numJugador]
  118. table.remove(jugadoresTotal, numJugador)
  119. if equipo == 1 then
  120. table.insert(teams.Team1, agregarJugador)
  121. equipo = 2
  122. elseif equipo == 2 then
  123. table.insert(teams.Team2, agregarJugador)
  124. equipo = 1
  125. end
  126. end
  127.  
  128. ui.addTextArea(3, "<p align='center'><font color='#CB546B'>" .. (table.concat(teams.Team1,"\n") or ""), nil, 15, 72, 180, 266, 0x2B2B2B, 0x121212, 1, true)
  129. ui.addTextArea(4, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil, 605, 72, 180, 266, 0x2B2B2B, 0x121212, 1, true)
  130. end
  131.  
  132. eventPlayerLeft = function(player)
  133. removeItem(k_arr, player)
  134. end
  135.  
  136. function eventNewGame()
  137. if gameStarted then
  138. if antiLeve then
  139. currentMap = "@" .. math.random(700000, 3000000)
  140. antiLeve = false
  141. else
  142. currentMap = tostring(tfm.get.room.currentMap)
  143. end
  144. setTimeMode()
  145. for n,p in pairs(tfm.get.room.playerList) do
  146. players[n].notFrozen = true
  147. -- print(n)
  148. if not PlayerInTeam(n) then
  149. tfm.exec.killPlayer(n)
  150. end
  151. end
  152. SetPlayerNameColor()
  153. first = false
  154. if mod == "Bootcamp" then
  155. 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")
  156. elseif mod =="Racing" then
  157. 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")
  158. elseif mod =="Mix" then
  159. 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")
  160. end
  161. end
  162. end
  163.  
  164. function eventNewPlayer(plr)
  165. if gameStarted then
  166. if PlayerInTeam(plr) then tfm.exec.killPlayer(plr) return end
  167. if autoJoin then
  168. if #teams.Team1 == #teams.Team2 then
  169. table.insert(teams.Team1,plr)
  170. elseif #teams.Team1 > #teams.Team2 then
  171. table.insert(teams.Team2,plr)
  172. end
  173. end
  174. end
  175. if macrosAll then
  176. tfm.exec.bindKeyboard(plr, 38, true, true) -- arrows players
  177. tfm.exec.bindKeyboard(plr, 87, true, true) -- for world - {fr} players (qwerty keyboard)
  178. tfm.exec.bindKeyboard(plr, 90, true, true) -- for fr players (azerty keyboard)
  179. addNewItem(k_arr, players, plr, {contUpArrow = 0, contW = 0, contZ = 0, notFrozen = true})
  180. end
  181. end
  182.  
  183. function eventPlayerDied(plr)
  184. if gameStarted then
  185. local plrCount = 0
  186. for n,p in pairs(tfm.get.room.playerList) do
  187. if not p.isDead then
  188. plrCount = plrCount + 1
  189. end
  190. end
  191. if plrCount <= 0 then
  192. newMap()
  193. print("WTF3")
  194. end
  195. end
  196. end
  197.  
  198. function eventPlayerWon(plr, TT, wonTime)
  199. if gameStarted then
  200. if PlayerInTeam(plr) then
  201. if not first then
  202. if table.contain(teams.Team1,plr) then
  203. first = true
  204. teamScore.Team1 = teamScore.Team1 + 1
  205. tfm.exec.setPlayerScore(plr, 1,true)
  206. gameTime.Minutes = 0
  207. gameTime.Seconds = 3
  208. if tonumber(teamScore.Team1) >= tonumber(ScoreToWin) then
  209. print("Team 1 won the game! The last point made by: "..plr)
  210. gameStarted = false
  211. tfm.exec.newGame(7692692,true)
  212. ShowStartBoard()
  213. 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)
  214. 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)
  215. end
  216. else
  217. first = true
  218. --if the plr form team2 then
  219. teamScore.Team2 = teamScore.Team2 + 1
  220. tfm.exec.setPlayerScore(plr, 1,true)
  221. gameTime.Minutes = 0
  222. gameTime.Seconds = 3
  223. if tonumber(teamScore.Team2) >= tonumber(ScoreToWin) then
  224. print("Team 2 won the game! The last point made by: "..plr)
  225. gameStarted = false
  226. tfm.exec.newGame(7692692,true)
  227. ShowStartBoard()
  228. 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)
  229. 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)
  230. end
  231. end
  232. end
  233. end
  234. end
  235. end
  236.  
  237. if_admin = function (name)
  238. for p = 1, #admin do
  239. if name == admin[p] then
  240. return true
  241. end
  242. end
  243. return false
  244. end
  245.  
  246.  
  247. function eventTextAreaCallback(id, player, callback)
  248. if if_admin(player) then
  249. if id == 8 then
  250. if callback == "bc" then
  251. mod = "Bootcamp"
  252. ShowStartBoard()
  253. end
  254. elseif id == 9 then
  255. if callback == "rc" then
  256. mod = "Racing"
  257. ShowStartBoard()
  258. end
  259. elseif id == 18 then
  260. if callback == "mix" then
  261. mod = "Mix"
  262. ShowStartBoard()
  263. end
  264. elseif id == 10 then
  265. if callback == "start" then
  266. math.randomseed(os.time())
  267. for i=0, 18,1 do
  268. ui.removeTextArea(i)
  269. end
  270. gameStarted = true
  271. teamScore.Team1 = 0
  272. teamScore.Team2 = 0
  273. resetScore()
  274. newMap()
  275. end
  276. elseif id == 11 then
  277. if callback == "dec" then
  278. if tonumber(ScoreToWin) > 1 then
  279. ScoreToWin = ScoreToWin - 1
  280. ShowStartBoard()
  281. end
  282. elseif callback == "inc" then
  283. if tonumber(ScoreToWin) < 99 then
  284. ScoreToWin = ScoreToWin + 1
  285. ShowStartBoard()
  286. end
  287. end
  288. elseif id == 12 then
  289. if callback == "OnAndOff" then
  290. autoJoin = not autoJoin
  291. ShowStartBoard()
  292. end
  293. elseif id == 15 then
  294. if callback == "Fill" then
  295. establecerEquipos()
  296. ShowStartBoard()
  297. end
  298. end
  299. end
  300. end
  301.  
  302. function eventChatCommand(name, command)
  303. if if_admin(name) then
  304. local arg={}
  305. for argument in command:gmatch("[^%s]+") do
  306. table.insert(arg,argument)
  307. end
  308. if arg[1]:lower() == "team1" and arg[2] ~= nil then
  309. teams.Team1 = {}
  310. for i,v in pairs(arg) do
  311. if i > 1 then
  312. if PlayerCheck(v) then
  313. if TeamFix(v) == "team2"then
  314. table.clear(teams.Team2,v)
  315. table.insert(teams.Team1,v)
  316. if not gameStarted then
  317. ShowStartBoard()
  318. end
  319. else
  320. table.insert(teams.Team1,v)
  321. if not gameStarted then
  322. ShowStartBoard()
  323. end
  324. end
  325. else
  326. print("Sory couldn't found: " .. tostring(v))
  327. end
  328. end
  329. end
  330. elseif arg[1]:lower() == "team2" and arg[2] ~= nil then
  331. teams.Team2 = {}
  332. for i,v in pairs(arg) do
  333. if i > 1 then
  334. if PlayerCheck(v) then
  335. if TeamFix(v) == "team1"then
  336. table.clear(teams.Team1,v)
  337. table.insert(teams.Team2,v)
  338. if not gameStarted then
  339. ShowStartBoard()
  340. end
  341. else
  342. table.insert(teams.Team2,v)
  343. if not gameStarted then
  344. ShowStartBoard()
  345. end
  346. end
  347. else
  348. print("Sory couldn't found: " .. tostring(v))
  349. end
  350. end
  351. end
  352. elseif arg[1]:lower() == "add" and arg[2]:lower() == "team1" and arg[3] ~= nil then
  353. for i,v in pairs(arg) do
  354. if i > 1 then
  355. if PlayerCheck(v) then
  356. if TeamFix(v) == "team2"then
  357. table.clear(teams.Team2,v)
  358. table.insert(teams.Team1,v)
  359. if not gameStarted then
  360. ShowStartBoard()
  361. end
  362. else
  363. table.insert(teams.Team1,v)
  364. if not gameStarted then
  365. ShowStartBoard()
  366. end
  367. end
  368. end
  369. end
  370. end
  371. elseif arg[1]:lower() == "add" and arg[2]:lower() == "team2" and arg[3] ~= nil then
  372. for i,v in pairs(arg) do
  373. if i > 1 then
  374. if PlayerCheck(v) then
  375. if TeamFix(v) == "team1"then
  376. table.clear(teams.Team1,v)
  377. table.insert(teams.Team2,v)
  378. if not gameStarted then
  379. ShowStartBoard()
  380. end
  381. else
  382. table.insert(teams.Team2,v)
  383. if not gameStarted then
  384. ShowStartBoard()
  385. end
  386. end
  387. end
  388. end
  389. end
  390. elseif arg[1] == "remove" and arg[2] == "team1" and arg[3] ~= nil then
  391. if TeamFix(arg[3]) == "team1" then
  392. if not gameStarted then
  393. table.clear(teams.Team1,arg[3])
  394. ShowStartBoard()
  395. else
  396. table.clear(teams.Team1,arg[3])
  397. end
  398. end
  399. elseif arg[1] == "remove" and arg[2] == "team2" and arg[3] ~= nil then
  400. if TeamFix(arg[3]) == "team2" then
  401. if not gameStarted then
  402. table.clear(teams.Team2,arg[3])
  403. ShowStartBoard()
  404. else
  405. table.clear(teams.Team2,arg[3])
  406. end
  407. end
  408. elseif arg[1]:lower() == "aj" and arg[2]:lower() == "on" and arg[3] == nil then
  409. autoJoin = true
  410. elseif arg[1]:lower() == "aj" and arg[2]:lower() == "off" and arg[3] == nil then
  411. autoJoin = false
  412. elseif arg[1]:lower() == "start" then
  413. if not gameStarted then
  414. ShowStartBoard()
  415. end
  416. elseif arg[1]:lower() == "exit" and arg[2] == nil then
  417. if not gameStarted then
  418. for i=0,17,1 do
  419. ui.removeTextArea(i)
  420. end
  421. end
  422. elseif arg[1]:lower() == "finish" and arg[2] == "script" and arg[3] == nil then
  423. system.exit()
  424. elseif arg[1]:lower() == "reset" and arg[2] == nil then
  425. if gameStarted then
  426. gameStarted = false
  427. tfm.exec.newGame(7692692)
  428. ShowStartBoard()
  429. end
  430. elseif arg[1]:lower() == "d" and tonumber(arg[2]) ~= nil and arg[3] == nil then
  431. if tonumber(arg[2]) > 0 and tonumber(arg[2]) <= 100 then
  432. ScoreToWin = arg[2]
  433. else
  434. print("The limit of the WinScore is between 0-500!")
  435. end
  436. elseif arg[1]:lower() == "skip" and arg[2] == nil then
  437. newMap()
  438. elseif arg[1]:lower() == "anti" then
  439. antiLeve = true
  440. elseif arg[1]:lower() == "macroall" then
  441. k_arr, players = {}, {}
  442. for n,p in pairs(tfm.get.room.playerList) do
  443. tfm.exec.bindKeyboard(n, 38, true, true) -- arrows players
  444. tfm.exec.bindKeyboard(n, 87, true, true) -- for world - {fr} players (qwerty keyboard)
  445. tfm.exec.bindKeyboard(n, 90, true, true) -- for fr players (azerty keyboard)
  446. addNewItem(k_arr, players, n, {contUpArrow = 0, contW = 0, contZ = 0, notFrozen = true})
  447. end
  448. macrosAll = true
  449. elseif arg[1]:lower() == "macro" and arg[2] ~= nil then
  450. tfm.exec.bindKeyboard(arg[2], 38, true, true) -- arrows players
  451. tfm.exec.bindKeyboard(arg[2], 87, true, true) -- for world - {fr} players (qwerty keyboard)
  452. tfm.exec.bindKeyboard(arg[2], 90, true, true) -- for fr players (azerty keyboard)
  453. addNewItem(k_arr, players, arg[2], {contUpArrow = 0, contW = 0, contZ = 0, notFrozen = true})
  454. elseif arg[1]:lower() == "remove" and arg[2] ~= nil then
  455. removeItem(k_arr, arg[2])
  456. elseif arg[1]:lower() == "removeall" then
  457. for n,p in pairs(tfm.get.room.playerList) do
  458. tfm.exec.bindKeyboard(n, 38, true, false) -- arrows players
  459. tfm.exec.bindKeyboard(n, 87, true, false) -- for world - {fr} players (qwerty keyboard)
  460. tfm.exec.bindKeyboard(n, 90, true, false) -- for fr players (azerty keyboard)
  461. end
  462. macrosAll = false
  463. k_arr, players = {}, {}
  464. elseif arg[1]:lower() == "sp" then
  465. if arg[2]:lower() == "team1" then
  466. if tonumber(arg[3]) ~= nil then
  467. if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then
  468. teamScore.Team1 = tonumber(arg[3])
  469. end
  470. end
  471. elseif arg[2]:lower() == "team2" then
  472. if tonumber(arg[3]) ~= nil then
  473. if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then
  474. teamScore.Team2 = tonumber(arg[3])
  475. end
  476. end
  477.  
  478. end
  479. end
  480. end
  481. end
  482.  
  483. function eventLoop(current, left)
  484. -- MACRO
  485. counter = counter + 1
  486. if counter == 4 then
  487. for _, k in ipairs(k_arr) do
  488. if players[k].contUpArrow > 30 or players[k].contW > 30 or players[k].contZ > 30 then
  489. if players[k].notFrozen then
  490. tfm.exec.chatMessage("<R>[AntiMacros]</R><BV> " .. k .. "</BV> was frozen for using cheats. Up: " .. players[k].contUpArrow .. " W: " .. players[k].contW .. " Z: " .. players[k].contZ, nil)
  491. tfm.exec.freezePlayer(k)
  492. print(k .. ": " .. "Up: " .. players[k].contUpArrow .. " W: " .. players[k].contW .. " Z: " .. players[k].contZ)
  493. players[k].notFrozen = false
  494. end
  495. end
  496. players[k].contUpArrow = 0
  497. players[k].contW = 0
  498. players[k].contZ = 0
  499. end
  500. counter = 0
  501. end
  502. -- MACRO
  503.  
  504. if gameStarted then
  505. Ticker = Ticker + 1
  506. if Ticker%2 == 0 then
  507. if gameTime.Minutes <= 0 and gameTime.Seconds <= 0 then
  508. newMap()
  509. elseif gameTime.Seconds < 1 then
  510. gameTime.Minutes = gameTime.Minutes - 1
  511. gameTime.Seconds = 59
  512. end
  513. if gameTime.Seconds > 9 then
  514. 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")
  515. elseif gameTime.Seconds < 10 then
  516. -- tfm.exec.setUIMapName(currentMap .."| Time left: 0" .. gameTime.Minutes ..":0".. gameTime.Seconds .." | " ..team1C ..": ".. teamScore.Team1 .."/ "..team2C ..": "..teamScore.Team2 .."\n")
  517. 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")
  518. end
  519. gameTime.Seconds = gameTime.Seconds - 1
  520. Ticker = 0
  521. end
  522. end
  523. end
  524.  
  525. esta = function(p, L) -- L lista de jugadores --
  526. for _, v in pairs(L) do
  527. if p == v then
  528. return true
  529. end
  530. end
  531. return false
  532. end
  533.  
  534. new_map = function(L)
  535. local k = true
  536. local r = L[math.random(#L)]
  537. while k == true do
  538. if esta(r, already_maps) == true then
  539. print(r)
  540. r = L[math.random(#L)]
  541. else
  542. table.insert(already_maps, r)
  543. k = false
  544. end
  545. end
  546. return r
  547. end
  548.  
  549.  
  550. function newMap()
  551. if antiLeve then
  552. local mapcode = mapsAnti[math.random(#mapsAnti)]
  553. tfm.exec.newGame(mapcode)
  554. elseif mod == "Bootcamp" then
  555. if b_c == true then
  556. tfm.exec.newGame'#13'
  557. b_c = false
  558. else
  559. tfm.exec.newGame'#3'
  560. b_c = true
  561. end
  562. elseif mod == "Racing" then
  563. tfm.exec.newGame'#17'
  564. elseif mod == "Mix" then
  565. if mix_v == true then
  566. if b_c == true then
  567. tfm.exec.newGame'#13'
  568. b_c = false
  569. else
  570. tfm.exec.newGame'#3'
  571. b_c = true
  572. end
  573. mix_v = false
  574. else
  575. tfm.exec.newGame'#17'
  576. mix_v = true
  577. end
  578. end
  579. end
  580.  
  581. function SetPlayerNameColor()
  582. checkColor()
  583. for i,v in pairs(teams.Team1) do
  584. tfm.exec.setNameColor(v, "0x"..team1Color)
  585. end
  586.  
  587. for i,v in pairs(teams.Team2) do
  588. tfm.exec.setNameColor(v, "0x"..team2Color)
  589. end
  590. end
  591.  
  592. function setTimeMode()
  593. if mod == "Bootcamp" then
  594. gameTime.Minutes = 1
  595. gameTime.Seconds = 50
  596. elseif mod == "Racing" then
  597. --Game Time for Racing.--
  598. gameTime.Minutes = 1
  599. gameTime.Seconds = 3
  600. elseif mod == "Mix" then
  601. gameTime.Minutes = 1
  602. gameTime.Seconds = 50
  603. elseif mod == nil then
  604. mod = "Racing"
  605. gameTime.Minutes = 1
  606. gameTime.Seconds = 2
  607. end
  608. end
  609.  
  610. function FillTeams()
  611. local t = 1
  612. teams.Team1 = {}
  613. teams.Team2 = {}
  614. for n,p in pairs(tfm.get.room.playerList) do
  615. if t == 1 then
  616. table.insert(teams.Team1,n)
  617. t = 2
  618. elseif t == 2 then
  619. table.insert(teams.Team2,n)
  620. t = 1
  621. end
  622. end
  623. end
  624.  
  625. function checkColor()
  626. local c = false
  627. for key,v in pairs(teamColors) do
  628. if key == team1Color then
  629. team1Color = v
  630. c = true
  631. elseif key == team2Color then
  632. team2Color = v
  633. c = true
  634. elseif team1Color == v then
  635. c = true
  636. elseif team2Color == v then
  637. c = true
  638. end
  639. end
  640. if c then
  641. print("Team colors succesfully setted!")
  642. else
  643. team1Color = teamColors.Green
  644. team2Color = teamColors.Blue
  645. print("Sory couldn't found the color you choosed, Defult color will be apllied.")
  646. end
  647. end
  648.  
  649. function table.clear(t,obj)
  650. for i,v in ipairs(t) do
  651. if v==obj then
  652. table.remove(t,i)
  653. end
  654. end
  655. end
  656.  
  657. function table.contain(t,obj)
  658. for i,v in pairs(t) do
  659. if v==obj then
  660. return true
  661. end
  662. end
  663. return false
  664. end
  665.  
  666. function resetScore()
  667. for n,p in pairs(tfm.get.room.playerList) do
  668. tfm.exec.setPlayerScore(n, 0,false)
  669. end
  670. end
  671.  
  672. function TeamFix(plr)
  673. local char = plr
  674. for i,v in pairs(teams.Team1) do
  675. if v == char then
  676. return "team1"
  677. end
  678. end
  679. for i,n in pairs(teams.Team2) do
  680. if n == char then
  681. return "team2"
  682. end
  683. end
  684. return false
  685. end
  686.  
  687. function PlayerCheck(plr)
  688. local playerToSerch = plr
  689. for n,p in pairs(tfm.get.room.playerList) do
  690. if n == plr then
  691. return true
  692. end
  693. end
  694. return false
  695. end
  696.  
  697. function PlayerInTeam(plr)
  698. local player = plr
  699. for i,v in pairs(teams.Team1) do
  700. if v == player then
  701. return true
  702. end
  703. end
  704. for i,n in pairs(teams.Team2) do
  705. if n == player then
  706. return true
  707. end
  708. end
  709. return false
  710. end
  711.  
  712. function ShowStartBoard()
  713. ui.addTextArea(0, "<p align='center'>Administrador: <font color='#00ff40'><b>" .. admin[1] .. " ".. admin[2], nil, 263, 365, 265, 20, 0x324650, 0x000000, 0.8, true)
  714. ui.addTextArea(1, "", nil, 209, 33, 381, 326, 0x324650, 0x000000, 1, true)
  715. 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)
  716. 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)
  717. ui.addTextArea(4, "<p align='center'>Mod:" ..(mod or "Racing"), nil, 354, 60, 89, 19, 0x324650, 0x000000, 1, true)
  718. ui.addTextArea(5, "<font size='12'><p align='center'><b>\\ LUA /", nil, 209, 33, 381, 21, 0x324650, 0x000000, 1, true)
  719. ui.addTextArea(8, "<p align='center'><b><a href='event:bc'>Bootcamp</a>", nil, 365, 180, 69, 20, 0x001f3f, 0x000000, 1, true)
  720. ui.addTextArea(9, "<p align='center'><b><a href='event:rc'>Racing</a>", nil, 365, 124, 69, 20, 0x001f3f, 0x000000, 1, true)
  721. ui.addTextArea(18, "<p align='center'><b><a href='event:mix'>Mix</a>", nil, 365, 152, 69, 20, 0x540c0c, 0x000000, 1, true)
  722. ui.addTextArea(10, "<p align='center'><font size='13'><b><a href='event:start'>Start</a>", nil, 359, 236, 82, 23, 0x120D0D, 0x000000, 1, true)
  723. ui.addTextArea(11, "<p align='center'>Score: <a href='event:dec'>-</a> "..ScoreToWin .." <a href='event:inc'>+</a>", nil, 435, 335, 87, 20, 0x324650, 0x000000, 1, true)
  724. ui.addTextArea(12, "<p align='center'>Auto Join: <a href='event:OnAndOff'>"..(autoJoin and "on" or not autoJoin and "off") .."</a>", nil, 277, 335, 87, 20, 0x324650, 0x000000, 1, true)
  725. ui.addTextArea(15, "<p align='center'><a href='event:Fill'>Fill</a>", nil, 376, 335, 47, 20, 0x324650, 0x000000, 1, true)
  726. end
  727. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement