Advertisement
Guest User

Untitled

a guest
Jun 11th, 2021
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.93 KB | None | 0 0
  1. --[[
  2. Transformice script by Misterthepro and Odeyasitos (remastered, first version was created by Ctmce), thanks to Eduardomol,
  3. Mbappe, Noob, Flixpersito and Blood for help me.
  4.  
  5. Anti-macros by Tocutoeltocu.
  6.  
  7. Obs: Auto-admin
  8.  
  9. README:
  10. Commands:
  11. 1. !team1 "playername" "playername" \\Assign players to team1 , ex: !team1 Ctmce Ziggy_z
  12. 2. !team2 "playername "playername" \\Assign players to team2 , ex: !team2 Ctmce Ziggy_z
  13. 3. !add team1 "playername" "playername" \\Adds the player team1.
  14. 4. !add team2 "playername" "playername" \\Adds the player team2.
  15. 5. !remove team1 "playername" "playername" \\Removes the player/'s from team1!
  16. 6. !remove team2 "playername" "playername" \\Removes the player/'s from team2!
  17. 7. !exit \\Closing the Admin Panel //
  18. 8. !start \\Shows the Admin Panel back //
  19. 9. !sp team1 23 \\Sets the points for team1 to 23 or whatever you choose!
  20. 10. !sp team2 15 \\Sets the points for team1 to 15 or whatever you choose!
  21. 11. !aj on / off \\Turns AutoJoin On and Off.
  22. 12. !macro on // activate anti-macros
  23. 13. !macro off // desactivate anti-macros, default option
  24. 14. !admin Name#code // add player to admin list, ex: !admin Noob#5388
  25. 15. !unadmin Name#code // delete admin from admin list (you can't delete the host player), ex: !unadmin Edudekarly#3398
  26. ]]--
  27.  
  28. --Admin/Game Setup--
  29. local _, msg = pcall(nil)
  30. local adminGet = string.match(msg,"^(.-)%.")
  31.  
  32. local admin = {adminGet} -- only the first position of the array will be shown in the gui
  33. 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)--
  34. local autoJoin = true
  35. local team1Color = "Blue"
  36. local team2Color = "Red"
  37. ---Game Time Settings----
  38. local gameTime = 63
  39.  
  40. --^^^^^^^^^^^^^^^^^^^CHANGE ONLY THE THINGS ABOVE^^^^^^^^^^^^^^^^^^^--
  41.  
  42. --DO NOT CHANGE THE SCRIPT!--
  43. local teams = {Team1 = {}, Team2 = {}}
  44. --Team score--
  45. local teamScore = {Team1 = 0, Team2 = 0}
  46. --------------
  47. local teamColors = {Blue = '2F7FCC', Red = 'CB546B'}
  48. local first = false
  49.  
  50.  
  51. ----array for maps already played------------------------
  52. local already_maps = {}
  53. -----------------------------
  54. local gameStarted = false
  55. currentMap = 0
  56. team1C = team1Color
  57. team2C = team2Color
  58.  
  59. --[[MACRO--]]
  60.  
  61. macroON = false
  62. macro_time = 2000
  63. macro_warn = 18
  64. macro_freeze = 24
  65. macro_keys = {
  66. [38] = "Up",
  67. [87] = "W",
  68. [90] = "Z"
  69. }
  70.  
  71. macro_info = {}
  72. mice_info = {}
  73. concatenation = {}
  74. os_time = os.time
  75.  
  76. --[[END MACRO VARIABLES]]
  77.  
  78. local chosenGameMode = "BC & RC"
  79.  
  80. local vanillaMaps = {2, 11, 12, 19, 22, 40, 44, 45, 55, 57, 67, 69, 71, 73, 74, 79, 80, 86, 123, 127, 138, 142, 145, 150, 172, 173, 174, 189, 7833293, 7833292, 7833291, 7833290, 7833289, 7833288, 7833271, 7833272, 7833260, 7833265, 7830960, 7833268, 7833269, 7833270, 7831136, 7831065, 7833169, 7833263, 7833266, 7833279, 7833281, 7833282, 7833259, 7815665, 7815151, 7815374, 7833287, 7838835, 7838838, 7838930, 7838967, 7838914, 7838910, 7839014, 7839038, 7839046, 7839806, 7839461, 7839471, 7839368, 7839507, 7839493, 7839374, 7839942, 7840463, 7840122, 7840110, 7839819, 7840207, 7840167, 7840646, 7840728, 7840186, 7840366, 7840379, 7840176, 7840159, 7840392, 7840404, 7840564, 7840635, 7839352, 7840902, 7841488, 7844856, 7844642, 7844643, 7844648, 7844650, 7844660, 7844661, 7844664, 7844984, 2111371, 7848597, 7848605, 7848626, 7848738, 7848782}
  81.  
  82. local bootcampOldMaps = {"1733211","512887","1046877","541693","692740","272689","277427","327354","500690","3295967","378704","1646448","319443","455271","1615949","2423300","692650","4595576","375455","185289","159932","394132","166271","281948","511136","179488","299942","149451","150664","155628","166361","163172","168754","172976","182370","419369","257324","478236","220352","166805","331988","184817","2040569","191177","177652","560583","834297","206396","315800","403940","222910","157203","169110","586901","185873","171776","189819","528032","1000006","172547","410045","172520","171480","422981","232675","186066","172501","435812","168204","159187","320483","295465","199710","2574744","510996","571683","500748","191205","593530","608368","432501","159145","162482","159298","523270","492222","190646","330933","163159","176710","192255","460961","163596","332130","227093","258908","330841","268915","169059","208653","556841","169076","444589","305567","155765","155480","158053","163531","164916","166032","166056","166430","170514","172621","172951","175280","182769","447805","216173","171482","366809","303151","313216","3402881","1853689","305614","4537590","4523127","4883346","3737744","3558682","1580835","6254869","157805","158909","158417","159691","163094","163506","165186","166333","169139","171148","172512","172605","173623","175204","176507","176253","176619","179005","179492","180801","185428","185529","185887","190996","191203","191443","192959","193662","195116","195672","198988","199210","199826","202574","203664","204488","205240","208056","209848","213752","213755","213874","214631","214755","217261","222377","223174","224108","225484","225744","230588","231137","231921","232469","236768","237091","242291","242351","247311","248650","254785","257715","257218","258192","259319","264091","268668","270143","270924","271193","271411","272402","272518","275897","277824","279337","282584","289865","290824","295630","295932","296518","297442","301610","302080","303939","304861","305820","306309","306655","308855","307465","307324","315666","315573","318129","322026","322282","322582","325259","327743","329318","330967","332906","332811","333002","337644","344010","354984","359923","357892","360383","365061","364955","368839","371174","373105","373620","374779","379254","380516","383358","391924","392434","393426","395310","395216","396502","397469","401630","403755","406154","408643","410040","419335","419635","420877","424685","424900","431433","431624","431749","439092","438364","438333","440592","454049","457726","458528","462004","467137","476706","482791","485994","492399","496610","499986","500000","500894","501887","504485","507884","541223","531084","541729","549666","560526","563436","568122","574183","586901","593204","593431","593530","597348","605255","698992","842167","868262","886744","1032212","1066607","1156092","1266330","1162831","1593066","1990413","2132250","2416969","2803483","2850177","2918822","2932238","3725142","4249695","4334509","3979220","4593355","4604660","5056463","4794517","4585855","5086564","5110700","5131117","5198136","5394505","5955681","6000049","6075471"}
  83.  
  84. esta = function(p, L) -- L lista de jugadores --
  85. for _, v in pairs(L) do
  86. if p == v then
  87. return true
  88. end
  89. end
  90. return false
  91. end
  92.  
  93. function tablefind(tab,el)
  94. for index, value in pairs(tab) do
  95. if value == el then
  96. return index
  97. end
  98. end
  99.  
  100. return nil
  101. end
  102.  
  103.  
  104. new_map = function(L)
  105. local r = L[math.random(#L)]
  106.  
  107. table.remove(L,tablefind(L, r))
  108. table.insert(already_maps, r)
  109.  
  110. if #already_maps > #L/2 then
  111. for _,v in ipairs(already_maps) do
  112. table.insert(L,v)
  113. end
  114. already_maps = {}
  115. end
  116.  
  117. return tostring(r)
  118. end
  119.  
  120. local getBootcampOld = function() return new_map(bootcampOldMaps) end
  121. local getVanilla = function() return new_map(vanillaMaps) end
  122.  
  123. local gameMode = {
  124.  
  125. ["BC & RC"] = {"#3", "#17", "#13", "#17"},
  126. ["Bootcamp"] = {"#3", "#13"},
  127. ["Vanilla"] = {getVanilla},
  128. ["Racing"] = {"#17"},
  129. ["Bootcamp old"] = {getBootcampOld},
  130. ["P7"] = {"#7"},
  131. ["BC & RC & V"] = {"#3", "#17", getVanilla ,"#13", "#17", getVanilla, getBootcampOld, "#17", getVanilla},
  132. ["P17 & P7"] = {"#17", "#7"}
  133. }
  134.  
  135. local indexMapToPlay = 1
  136.  
  137. function mapToPlay()
  138.  
  139. len = #gameMode[chosenGameMode]
  140.  
  141. if type(gameMode[chosenGameMode][indexMapToPlay]) == 'function' then
  142. map = gameMode[chosenGameMode][indexMapToPlay]()
  143. else
  144. map = gameMode[chosenGameMode][indexMapToPlay]
  145. end
  146.  
  147. if indexMapToPlay == len then
  148. indexMapToPlay = 1
  149. else
  150. indexMapToPlay = indexMapToPlay + 1
  151. end
  152.  
  153. tfm.exec.newGame(map)
  154. end
  155.  
  156. function main()
  157. tfm.exec.disableAutoNewGame(true)
  158. tfm.exec.disableAllShamanSkills(true)
  159. tfm.exec.disableAutoShaman(true)
  160. tfm.exec.disableAutoScore(true)
  161. tfm.exec.disableAutoTimeLeft(true)
  162. tfm.exec.disableDebugCommand(true)
  163. tfm.exec.disablePhysicalConsumables(true)
  164. checkColor()
  165. ShowStartBoard()
  166. system.disableChatCommandDisplay("macro")
  167. system.disableChatCommandDisplay("skip")
  168. system.disableChatCommandDisplay("admin")
  169. system.disableChatCommandDisplay("unadmin")
  170. tfm.exec.newGame(7692692,true)
  171. for name in pairs(tfm.get.room.playerList) do eventNewPlayer(name) end
  172. end
  173.  
  174. function establecerEquipos()
  175. teams.Team1 = {}
  176. teams.Team2 = {}
  177. local equipo = 1
  178. local jugadoresTotal = {}
  179.  
  180. for name, p in pairs(tfm.get.room.playerList) do
  181. table.insert(jugadoresTotal, name)
  182. end
  183.  
  184. for i = 1, #jugadoresTotal do
  185. numJugador = math.random(#jugadoresTotal)
  186. agregarJugador = jugadoresTotal[numJugador]
  187. table.remove(jugadoresTotal, numJugador)
  188. if equipo == 1 then
  189. table.insert(teams.Team1, agregarJugador)
  190. equipo = 2
  191. elseif equipo == 2 then
  192. table.insert(teams.Team2, agregarJugador)
  193. equipo = 1
  194. end
  195. end
  196.  
  197. ui.addTextArea(3, "<p align='center'><font color='#CB546B'>" .. (table.concat(teams.Team1,"\n") or ""), nil, 15, 72, 180, 266, 0x2B2B2B, 0x121212, 1, true)
  198. ui.addTextArea(4, "<p align='center'><font color='#2F7FCC'>" .. (table.concat(teams.Team2,"\n") or ""), nil, 605, 72, 180, 266, 0x2B2B2B, 0x121212, 1, true)
  199. end
  200.  
  201. function eventNewGame()
  202. if gameStarted then
  203. tfm.exec.setGameTime(gameTime)
  204. currentMap = tostring(tfm.get.room.currentMap)
  205. for n,p in pairs(tfm.get.room.playerList) do
  206. if not PlayerInTeam(n) then
  207. tfm.exec.killPlayer(n)
  208. end
  209. end
  210. SetPlayerNameColor()
  211. first = false
  212. tfm.exec.setUIMapName(currentMap .. " <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin)
  213. end
  214. end
  215.  
  216. function eventNewPlayer(plr)
  217. local info = {}
  218. for key in next, macro_keys do
  219. info[key] = {0, os_time() + macro_time, false, false}
  220. system.bindKeyboard(plr, key, true, true)
  221. end
  222. macro_info[plr] = info
  223. mice_info[plr] = {adv = 0}
  224.  
  225. if gameStarted then
  226. if PlayerInTeam(plr) then tfm.exec.killPlayer(plr) return end
  227. if autoJoin then
  228. if #teams.Team1 == #teams.Team2 then
  229. table.insert(teams.Team1,plr)
  230. elseif #teams.Team1 > #teams.Team2 then
  231. table.insert(teams.Team2,plr)
  232. end
  233. end
  234. else
  235. tfm.exec.respawnPlayer(plr)
  236. end
  237. end
  238.  
  239. function eventPlayerDied(plr)
  240. if gameStarted then
  241. local plrCount = 0
  242. for n,p in pairs(tfm.get.room.playerList) do
  243. if not p.isDead then
  244. plrCount = plrCount + 1
  245. end
  246. end
  247. if plrCount <= 0 then
  248. mapToPlay()
  249. end
  250. end
  251. end
  252.  
  253. function teamWon(team, color, player, teamColor)
  254. print(team.." won the game! The last point made by: "..player)
  255. gameStarted = false
  256. tfm.exec.newGame(7692692,true)
  257. ShowStartBoard()
  258. ui.addTextArea(16, "<font size='13' color='#ffffff'><i>Team</font><font color='#" ..teamColor.."'> " ..color .."</font> won the game!</font></font>", nil, 8, 166, 202, 60, 0x000000, 0x5eff6e, 0, true)
  259. ui.addTextArea(17, "<font size='13' color='#ffffff'><i>The Player:<font color='#"..teamColor.."'> "..player .."</font> made the last point!", nil, 602, 166, 188, 61, 0xffffff, 0x5eff6e, 0, true)
  260. end
  261.  
  262. function eventPlayerWon(plr, TT, wonTime)
  263. if gameStarted then
  264. if PlayerInTeam(plr) then
  265. if not first then
  266.  
  267. first = true
  268.  
  269. if table.contain(teams.Team1,plr) then
  270. teamScore.Team1 = teamScore.Team1 + 1
  271. tfm.exec.setPlayerScore(plr, 1,true)
  272. if tonumber(teamScore.Team1) >= tonumber(ScoreToWin) then
  273. teamWon("Team 1", team1C, plr, teamColors.Blue)
  274. end
  275. else
  276. teamScore.Team2 = teamScore.Team2 + 1
  277. tfm.exec.setPlayerScore(plr, 1,true)
  278.  
  279. if tonumber(teamScore.Team2) >= tonumber(ScoreToWin) then
  280. teamWon("Team 2", team2C, plr, teamColors.Red)
  281. end
  282. end
  283.  
  284. tfm.exec.setGameTime(4)
  285. tfm.exec.setUIMapName(currentMap .. " <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin)
  286.  
  287. end
  288. end
  289. end
  290. end
  291.  
  292. if_admin = function (name)
  293. for p = 1, #admin do
  294. if name == admin[p] then
  295. return true
  296. end
  297. end
  298. return false
  299. end
  300.  
  301. function PlayerCheck(plr)
  302. local playerToSerch = plr
  303. for n,p in pairs(tfm.get.room.playerList) do
  304. if n == plr then
  305. return true
  306. end
  307. end
  308. return false
  309. end
  310.  
  311. function eventChatCommand(name, command)
  312. if if_admin(name) then
  313. local arg={}
  314. for argument in command:gmatch("[^%s]+") do
  315. table.insert(arg,argument)
  316. end
  317. if arg[1]:lower() == "team1" and arg[2] ~= nil then
  318. teams.Team1 = {}
  319. for i,v in pairs(arg) do
  320. if i > 1 then
  321. if PlayerCheck(v) then
  322. if TeamFix(v) == "team2"then
  323. table.clear(teams.Team2,v)
  324. table.insert(teams.Team1,v)
  325. if not gameStarted then
  326. ShowStartBoard()
  327. end
  328. else
  329. table.insert(teams.Team1,v)
  330. if not gameStarted then
  331. ShowStartBoard()
  332. end
  333. end
  334. else
  335. print("Sory couldn't found: " .. tostring(v))
  336. end
  337. end
  338. end
  339. elseif arg[1]:lower() == "team2" and arg[2] ~= nil then
  340. teams.Team2 = {}
  341. for i,v in pairs(arg) do
  342. if i > 1 then
  343. if PlayerCheck(v) then
  344. if TeamFix(v) == "team1"then
  345. table.clear(teams.Team1,v)
  346. table.insert(teams.Team2,v)
  347. if not gameStarted then
  348. ShowStartBoard()
  349. end
  350. else
  351. table.insert(teams.Team2,v)
  352. if not gameStarted then
  353. ShowStartBoard()
  354. end
  355. end
  356. else
  357. print("Sory couldn't found: " .. tostring(v))
  358. end
  359. end
  360. end
  361. elseif arg[1]:lower() == "add" and arg[2]:lower() == "team1" and arg[3] ~= nil then
  362. for i,v in pairs(arg) do
  363. if i > 1 then
  364. if PlayerCheck(v) then
  365. if TeamFix(v) == "team2"then
  366. table.clear(teams.Team2,v)
  367. table.insert(teams.Team1,v)
  368. if not gameStarted then
  369. ShowStartBoard()
  370. end
  371. else
  372. table.insert(teams.Team1,v)
  373. if not gameStarted then
  374. ShowStartBoard()
  375. end
  376. end
  377. end
  378. end
  379. end
  380. elseif arg[1]:lower() == "add" and arg[2]:lower() == "team2" and arg[3] ~= nil then
  381. for i,v in pairs(arg) do
  382. if i > 1 then
  383. if PlayerCheck(v) then
  384. if TeamFix(v) == "team1"then
  385. table.clear(teams.Team1,v)
  386. table.insert(teams.Team2,v)
  387. if not gameStarted then
  388. ShowStartBoard()
  389. end
  390. else
  391. table.insert(teams.Team2,v)
  392. if not gameStarted then
  393. ShowStartBoard()
  394. end
  395. end
  396. end
  397. end
  398. end
  399. elseif arg[1] == "remove" and arg[2] == "team1" and arg[3] ~= nil then
  400. if TeamFix(arg[3]) == "team1" then
  401. if not gameStarted then
  402. table.clear(teams.Team1,arg[3])
  403. ShowStartBoard()
  404. else
  405. table.clear(teams.Team1,arg[3])
  406. end
  407. end
  408. elseif arg[1] == "remove" and arg[2] == "team2" and arg[3] ~= nil then
  409. if TeamFix(arg[3]) == "team2" then
  410. if not gameStarted then
  411. table.clear(teams.Team2,arg[3])
  412. ShowStartBoard()
  413. else
  414. table.clear(teams.Team2,arg[3])
  415. end
  416. end
  417. elseif arg[1]:lower() == "aj" and arg[2]:lower() == "on" and arg[3] == nil then
  418. autoJoin = true
  419. elseif arg[1]:lower() == "aj" and arg[2]:lower() == "off" and arg[3] == nil then
  420. autoJoin = false
  421. elseif arg[1]:lower() == "start" then
  422. math.randomseed(os.time())
  423. math.random(); math.random(); math.random()
  424. if not gameStarted then
  425. ShowStartBoard()
  426. tfm.exec.disableAutoNewGame(true)
  427. end
  428. elseif arg[1]:lower() == "exit" and arg[2] == nil then
  429. if not gameStarted then
  430. for i=0,17,1 do
  431. ui.removeTextArea(i)
  432. end
  433. end
  434. elseif arg[1]:lower() == "finish" and arg[2] == "script" and arg[3] == nil then
  435. system.exit()
  436. elseif arg[1]:lower() == "reset" and arg[2] == nil then
  437. if gameStarted then
  438. gameStarted = false
  439. tfm.exec.newGame(7692692)
  440. ShowStartBoard()
  441. end
  442. elseif arg[1]:lower() == "d" and tonumber(arg[2]) ~= nil and arg[3] == nil then
  443. if tonumber(arg[2]) > 0 and tonumber(arg[2]) <= 100 then
  444. ScoreToWin = arg[2]
  445. else
  446. print("The limit of the WinScore is between 0-500!")
  447. end
  448.  
  449. if gameStarted then
  450. tfm.exec.setUIMapName(currentMap .. " <font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> / <n>D:" ..ScoreToWin)
  451. end
  452.  
  453. elseif arg[1]:lower() == "skip" and arg[2] == nil then
  454. mapToPlay()
  455. elseif arg[1]:lower() == "admin" and PlayerCheck(arg[2]) and arg[3] == nil then
  456. if tablefind(admin, arg[2]) == nil then
  457. table.insert(admin, arg[2])
  458. end
  459. elseif arg[1]:lower() == "unadmin" and PlayerCheck(arg[2]) and arg[3] == nil then
  460. local position = tablefind(admin, arg[2])
  461. if position ~= nil and position > 1 then
  462. table.remove(admin, position)
  463. end
  464. elseif arg[1]:lower() == "macro" and arg[2] == "on" and arg[3] == nil then
  465. macroON = true
  466. elseif arg[1]:lower() == "macro" and arg[2] == "off" and arg[3] == nil then
  467. macroON = false
  468. elseif arg[1]:lower() == "sp" then
  469. if arg[2]:lower() == "team1" then
  470. if tonumber(arg[3]) ~= nil then
  471. if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then
  472. teamScore.Team1 = tonumber(arg[3])
  473. end
  474. end
  475. elseif arg[2]:lower() == "team2" then
  476. if tonumber(arg[3]) ~= nil then
  477. if tonumber(arg[3]) < tonumber(ScoreToWin) and tonumber(arg[3]) > 0 then
  478. teamScore.Team2 = tonumber(arg[3])
  479. end
  480. end
  481. end
  482. end
  483. end
  484. end
  485.  
  486. function eventLoop(current, left)
  487. if gameStarted and left < 0 then
  488. mapToPlay()
  489. end
  490. end
  491.  
  492. function SetPlayerNameColor()
  493. checkColor()
  494. for i,v in pairs(teams.Team1) do
  495. tfm.exec.setNameColor(v, "0x"..team1Color)
  496. end
  497.  
  498. for i,v in pairs(teams.Team2) do
  499. tfm.exec.setNameColor(v, "0x"..team2Color)
  500. end
  501. end
  502.  
  503. function FillTeams()
  504. local t = 1
  505. teams.Team1 = {}
  506. teams.Team2 = {}
  507. for n,p in pairs(tfm.get.room.playerList) do
  508. if t == 1 then
  509. table.insert(teams.Team1,n)
  510. t = 2
  511. elseif t == 2 then
  512. table.insert(teams.Team2,n)
  513. t = 1
  514. end
  515. end
  516. end
  517.  
  518. function checkColor()
  519. local c = false
  520. for key,v in pairs(teamColors) do
  521. if key == team1Color then
  522. team1Color = v
  523. c = true
  524. elseif key == team2Color then
  525. team2Color = v
  526. c = true
  527. elseif team1Color == v then
  528. c = true
  529. elseif team2Color == v then
  530. c = true
  531. end
  532. end
  533. if c then
  534. --print("Team colors succesfully setted!")
  535. else
  536. team1Color = teamColors.Green
  537. team2Color = teamColors.Blue
  538. print("Sory couldn't found the color you choosed, Defult color will be apllied.")
  539. end
  540. end
  541.  
  542. function table.clear(t,obj)
  543. for i,v in ipairs(t) do
  544. if v==obj then
  545. table.remove(t,i)
  546. end
  547. end
  548. end
  549.  
  550. function table.contain(t,obj)
  551. for i,v in pairs(t) do
  552. if v==obj then
  553. return true
  554. end
  555. end
  556. return false
  557. end
  558.  
  559. function resetScore()
  560. for n,p in pairs(tfm.get.room.playerList) do
  561. tfm.exec.setPlayerScore(n, 0,false)
  562. end
  563. end
  564.  
  565. function TeamFix(plr)
  566. local char = plr
  567. for i,v in pairs(teams.Team1) do
  568. if v == char then
  569. return "team1"
  570. end
  571. end
  572. for i,n in pairs(teams.Team2) do
  573. if n == char then
  574. return "team2"
  575. end
  576. end
  577. return false
  578. end
  579.  
  580. function PlayerInTeam(plr)
  581. local player = plr
  582. for i,v in pairs(teams.Team1) do
  583. if v == player then
  584. return true
  585. end
  586. end
  587. for i,n in pairs(teams.Team2) do
  588. if n == player then
  589. return true
  590. end
  591. end
  592. return false
  593. end
  594.  
  595. function eventTextAreaCallback(id, player, callback)
  596. if if_admin(player) then
  597. if id == 8 then
  598. if callback == "Bootcamp" then
  599. chosenGameMode = "Bootcamp"
  600. ShowStartBoard()
  601. end
  602. elseif id == 9 then
  603. if callback == "Racing" then
  604. chosenGameMode = "Racing"
  605. ShowStartBoard()
  606. end
  607. elseif id == 18 then
  608. if callback == "BC & RC" then
  609. chosenGameMode = "BC & RC"
  610. ShowStartBoard()
  611. end
  612. elseif id == 10 then
  613. if callback == "start" then
  614. math.randomseed(os.time())
  615. math.random(); math.random(); math.random()
  616. for i=0, 19,1 do
  617. ui.removeTextArea(i)
  618. end
  619. gameStarted = true
  620. teamScore.Team1 = 0
  621. teamScore.Team2 = 0
  622. resetScore()
  623. mapToPlay()
  624. end
  625. elseif id == 11 then
  626. if callback == "dec" then
  627. if tonumber(ScoreToWin) > 1 then
  628. ScoreToWin = ScoreToWin - 1
  629. ShowStartBoard()
  630. end
  631. elseif callback == "inc" then
  632. if tonumber(ScoreToWin) < 99 then
  633. ScoreToWin = ScoreToWin + 1
  634. ShowStartBoard()
  635. end
  636. end
  637. elseif id == 12 then
  638. if callback == "OnAndOff" then
  639. autoJoin = not autoJoin
  640. ShowStartBoard()
  641. end
  642. elseif id == 15 then
  643. if callback == "Fill" then
  644. establecerEquipos()
  645. ShowStartBoard()
  646. end
  647. elseif id == 19 then
  648. if callback == "otherMode" then
  649. for i=0, 19,1 do
  650. ui.removeTextArea(i)
  651. end
  652. ShowAditionalGameModes()
  653. end
  654. elseif id >= 200 and id <= 206 then
  655. for i=200, 228,1 do
  656. ui.removeTextArea(i)
  657. end
  658. chosenGameMode = callback
  659. ShowStartBoard()
  660. end
  661. end
  662. end
  663.  
  664. function ShowStartBoard()
  665. ui.addTextArea(0, "<p align='center'>Administrador: <font color='#00ff40'><b>" .. admin[1], nil, 263, 367, 265, 20, 0x324650, 0x000000, 0.8, true)
  666. ui.addTextArea(1, "", nil, 209, 33, 381, 328, 0x324650, 0x000000, 1, true)
  667. ui.addTextArea(2, "<p align='center'><font size='12' color='#" ..team1Color .."'>" .. (table.concat(teams.Team1,"\n") or ""), nil, 209, 66, 151, 254, 0x324650, 0x000000, 1, true)
  668. 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)
  669. ui.addTextArea(4, "<p align='center'>Mod: " ..(chosenGameMode or "BC & RC"), nil, 339, 301, 120, 19, 0x324650, 0x000000, 1, true)
  670. ui.addTextArea(5, "<font size='12'><p align='center'><b>\\ LUA by Misterthepro and odeyasitos/", nil, 209, 33, 381, 21, 0x324650, 0x000000, 1, true)
  671. 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)
  672. 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)
  673. ui.addTextArea(15, "<p align='center'><a href='event:Fill'>Fill</a>", nil, 376, 335, 47, 20, 0x324650, 0x000000, 1, true)
  674.  
  675. ui.addTextArea(10, "<p align='center'><font size='13'><b><a href='event:start'>Start</a>", nil, 359, 212, 82, 23, 0x120D0D, 0x000000, 1, true)
  676. ui.addTextArea(18, "<p align='center'><b><a href='event:BC & RC'>BC & RC</a>", nil, 365, 80, 69, 20, 0x001f3f, 0x000000, 1, true)
  677. ui.addTextArea(8, "<p align='center'><b><a href='event:Bootcamp'>Bootcamp</a>", nil, 365, 113, 69, 20, 0x001f3f, 0x000000, 1, true)
  678. ui.addTextArea(9, "<p align='center'><b><a href='event:Racing'>Racing</a>", nil, 365, 146, 69, 20, 0x001f3f, 0x000000, 1, true)
  679.  
  680. ui.addTextArea(19, "<p align='center'><b><a href='event:otherMode'>Otro</a>", nil,365 , 179, 69, 20, 0x001f3f, 0x000000, 1, true)
  681. end
  682.  
  683. function ShowAditionalGameModes()
  684. ui.addTextArea(200, "", nil, 209, 33, 381, 328, 0x324650, 0x000000, 1, true)
  685. ui.addTextArea(201, "<font size='12'><p align='center'><b>\\ OTROS MODOS DE JUEGO /", nil, 215, 38, 369, 21, 0x324650, 0x000000, 1, true)
  686.  
  687. ui.addTextArea(202, "<p align='center'><b><a href='event:Vanilla'>Vanilla</a>", nil, 215, 72, 112, 20, 0x001f3f, 0x000000, 1, true)
  688. ui.addTextArea(203, "<p align='center'><b><a href='event:Bootcamp old'>Bootcamp old</a>", nil, 215, 105, 112, 20, 0x001f3f, 0x000000, 1, true)
  689. ui.addTextArea(204, "<p align='center'><b><a href='event:P7'>P7</a>", nil, 215, 138, 112, 20, 0x001f3f, 0x000000, 1, true)
  690. ui.addTextArea(205, "<p align='center'><b><a href='event:BC & RC & V'>BC & RC & V</a>", nil, 215, 171, 112, 20, 0x001f3f, 0x000000, 1, true)
  691. ui.addTextArea(206, "<p align='center'><b><a href='event:P17 & P7'>P17 & P7</a>", nil,215 , 204, 112, 20, 0x001f3f, 0x000000, 1, true)
  692. ui.addTextArea(207, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,215 , 237, 112, 20, 0x001f3f, 0x000000, 1, true)
  693. ui.addTextArea(208, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,215 , 270, 112, 20, 0x001f3f, 0x000000, 1, true)
  694. ui.addTextArea(209, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,215 , 303, 112, 20, 0x001f3f, 0x000000, 1, true)
  695. ui.addTextArea(210, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,215 , 336, 112, 20, 0x001f3f, 0x000000, 1, true)
  696.  
  697. ui.addTextArea(211, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 72, 113, 20, 0x001f3f, 0x000000, 1, true)
  698. ui.addTextArea(212, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 105, 113, 20, 0x001f3f, 0x000000, 1, true)
  699. ui.addTextArea(213, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 138, 113, 20, 0x001f3f, 0x000000, 1, true)
  700. ui.addTextArea(214, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 171, 113, 20, 0x001f3f, 0x000000, 1, true)
  701. ui.addTextArea(215, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 204, 113, 20, 0x001f3f, 0x000000, 1, true)
  702. ui.addTextArea(216, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 237, 113, 20, 0x001f3f, 0x000000, 1, true)
  703. ui.addTextArea(217, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 270, 113, 20, 0x001f3f, 0x000000, 1, true)
  704. ui.addTextArea(218, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 303, 113, 20, 0x001f3f, 0x000000, 1, true)
  705. ui.addTextArea(219, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,342 , 336, 113, 20, 0x001f3f, 0x000000, 1, true)
  706.  
  707. ui.addTextArea(220, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 72, 113, 20, 0x001f3f, 0x000000, 1, true)
  708. ui.addTextArea(221, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 105, 113, 20, 0x001f3f, 0x000000, 1, true)
  709. ui.addTextArea(222, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 138, 113, 20, 0x001f3f, 0x000000, 1, true)
  710. ui.addTextArea(223, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 171, 113, 20, 0x001f3f, 0x000000, 1, true)
  711. ui.addTextArea(224, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 204, 113, 20, 0x001f3f, 0x000000, 1, true)
  712. ui.addTextArea(225, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 237, 113, 20, 0x001f3f, 0x000000, 1, true)
  713. ui.addTextArea(226, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 270, 113, 20, 0x001f3f, 0x000000, 1, true)
  714. ui.addTextArea(227, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 303, 113, 20, 0x001f3f, 0x000000, 1, true)
  715. ui.addTextArea(228, "<p align='center'><b><a href='event:'>Coming soon</a>", nil,470 , 336, 113, 20, 0x001f3f, 0x000000, 1, true)
  716.  
  717. end
  718.  
  719. eventKeyboard = function(player, key)
  720. if macroON then
  721. if not macro_keys[key] then return end -- By tocutoeltocu
  722. local info = macro_info[player][key]
  723. local now = os_time()
  724. info[1] = info[1] + 1
  725. if now >= info[2] then
  726. --print(player .. " saltos:" .. info[1])
  727. if info[4] and mice_info[player].adv==0 then
  728. local count = 3
  729. concatenation[1] = "<r>[AntiMacro] <bv>"
  730. concatenation[2] = player
  731. concatenation[3] = "<bl> frozen."
  732. local data
  733. for _key, name in next, macro_keys do
  734. data = macro_info[player][_key]
  735. count = count + 4
  736. concatenation[count - 3] = " "
  737. concatenation[count - 2] = name
  738. concatenation[count - 1] = ": "
  739. if now >= data[2] and info ~= data then
  740. concatenation[count] = "0"
  741. else
  742. concatenation[count] = data[1]
  743. end
  744. end
  745. local msg = table.concat(concatenation, "", 1, count)
  746. print(msg)
  747. tfm.exec.freezePlayer(player)
  748. mice_info[player].adv = 1
  749. end
  750. info[1] = 1
  751. info[2] = now + macro_time
  752. info[3] = false
  753. info[4] = false
  754. return
  755. elseif not info[3] and info[1] >= macro_warn and mice_info[player].adv==0 then
  756. info[3] = true
  757. local count = 3
  758. concatenation[1] = "<j>[AntiMacro] <bv>"
  759. concatenation[2] = player
  760. concatenation[3] = "<bl> may be using macros."
  761. local data
  762. for _key, name in next, macro_keys do
  763. data = macro_info[player][_key]
  764. count = count + 4
  765. concatenation[count - 3] = " "
  766. concatenation[count - 2] = name
  767. concatenation[count - 1] = ": "
  768. if now >= data[2] then
  769. concatenation[count] = "0"
  770. else
  771. concatenation[count] = data[1]
  772. end
  773. end
  774. local msg = table.concat(concatenation, "", 1, count)
  775. print(msg)
  776. elseif not info[4] and info[1] >= macro_freeze then
  777. info[4] = true
  778. end
  779. end
  780. end
  781.  
  782. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement