Advertisement
Fernando-TFM

LUA ANTI-MACRO by Fer TFM

Oct 20th, 2020
3,595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.04 KB | None | 0 0
  1. --[[
  2. CMDS: !help - !cmd - !cmds - !commands to see the commands list in game
  3. --]]
  4. local _, msg = pcall(nil)
  5. roomloader = string.match(msg, "^(.-)%.")
  6. admin = {roomloader}
  7. win = 10 autoJoin = true teamColors = {Team1 = '00ff55', Team2 = 'ff8540', Team3 = 'ff50ee', Team4 = '00f5e5'}
  8. vnMaps = {"2" , "11" , "12" , "19" , "22" , "24" , "40" , "44" , "45" , "53" , "55" , "57" , "62" , "67" , "69" , "71" , "73" , "74" , "75" , "79" , "80" , "85" , "86" , "119" , "123" , "127" , "138" , "142" , "145" , "150" , "172" , "173" , "174" , "7470754" , "7470763" , "7470774" , "7470782" , "7470797" , "7697587" , "7767224" , "7767228" , "7767300" , "7767308" , "7767311"}
  9. bcMaps = {"@182681" , "@261814" , "@1893451" , "@424604", "@1018394" , "@1788490" , "@2252731" , "@1595965" , "@232678" , "@729863" , "@801683" , "@2692883" , "@4445580" , "@2176211" , "@392240" , "@6986340" , "@2208924" , "@155606" , "@2208924" , "@155628" , "@571683" , "@168204" , "@184868" , "@159145" , "@1646448" , "@159298" , "@176619" , "@523270" , "@191205" , "@458528" , "@399364" , "@177652" , "@171480" , "@124000" , "@319443" , "@3043779" , "@173816" , "@174223" , "@152260" , "@505619" , "@497965" , "@239698" , "@408577" , "@168754" , "@543010" , "@1678634" , "@173623" , "@156720" , "@564198" , "@176729" , "@170007" , "@178297", "@549759", "@149451" , "@161023"}
  10. burlaMaps = {"@7652017" , "@7652019" , "@7652033" , "@7652664" , "@5932565" , "@7652667" , "@7652670" , "@7652674" , "@7652679" , "@7652686" , "@7652691" , "@7652790" , "@7652791" , "@7652792" , "@7652793" , "@7652796" , "@7652797" , "@7652798" , "@7652944" , "@7652954" , "@7652958" , "@7652960" , "@7007413" , "@7653108" , "@7653124" , "@7653127" , "@7653135" , "@7653136" , "@7653139" , "@7653142" , "@7653144" , "@7653149" , "@7653151" , "@7420052" , "@7426198" , "@7426611" , "@7387658" , "@7654229" , "@7203871" , "@7014223" , "@7175013" , "@7165042" , "@7154662" , "@6889690" , "@6933442" , "@7002430" , "@6884221" , "@6886514" , "@6882315" , "@6927305" , "@7659190" , "@7659197" , "@7659203" , "@7659205" , "@7659208" , "@7660110" , "@7660117" , "@7660104" , "@7660502" , "@7660703" , "@7660704" , "@7660705" , "@7660706" , "@7660709" , "@7660710" , "@7660714" , "@7660716" , "@7660718" , "@7660721" , "@7660723" , "@7660727" , "@7661057" , "@7661060" , "@7661062" , "@7661063" , "@7661067" , "@7661072" , "@7662547" , "@7662555" , "@7662559" , "@7662562" , "@7662565" , "@7662566" , "@7662569" , "@7662759" , "@7662768" , "@7662777" , "@7662780" , "@7662796" , "@7663423" , "@7663428" , "@7663429" , "@7663430" , "@7663432" , "@7663435" , "@7663437" , "@7663438" , "@7663439" , "@7663440" , "@7663444" , "@7663445"}
  11. t1C = "Team1" t2C = "Team2" t3C = "Team3" t4C = "Team4" mod = "Racing" antiLevevn = false antiLeverc = false minimalist = false np = false map = 0 fourteams = false teams = {Team1 = {}, Team2 = {}, Team3 = {}, Team4 = {}} p = {T1 = 0, T2 = 0, T3 = 0, T4 = 0} first = false gameStarted = false t1N = "Team 1" t2N = "Team 2" t3N = "Team 3" t4N = "Team 4" mix_v = true mix_bc = false mix_rc = false vote = {} ban = {} ban1 = {} ban2 = {} ban3 = {}
  12. mapsAntivn = {"6135200","7008845","7121189","7121027","7121192","7762520"}
  13. mapsAntirc = {"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"}
  14. --[[MACRO--]]macroON = true macro_time = 2000 macro_warn = 18 macro_freeze = 24 macro_keys = {[38] = "Up", [87] = "W", [90] = "Z"} macro_info = {} mice_info = {} concatenation = {} os_time = os.time
  15.  
  16. function main()
  17. system.disableChatCommandDisplay(nil)
  18. for _,k in pairs({"AfkDeath", "DebugCommand", "AutoNewGame", "AutoShaman","AutoScore","AutoTimeLeft","PhysicalConsumables"}) do tfm.exec["disable"..k]() end
  19. tfm.exec.newGame(7774050) tfm.exec.setGameTime(99999) SetMapName() checkColor() ShowStartBoard()
  20. for _,admins in pairs(admin) do ui.addTextArea(99999, "<a href='event:ce'>Commands", admins, 5, -25, 0, 10, 0x1e3d42, 0x1e3d42) end
  21. for name in pairs(tfm.get.room.playerList) do eventNewPlayer(name) end
  22. end
  23.  
  24. function toTeams()
  25. teams.Team1 = {}
  26. teams.Team2 = {}
  27. teams.Team3 = {}
  28. teams.Team4 = {}
  29. local equipo = 1
  30. local playersTotal = {}
  31. for name, p in pairs(tfm.get.room.playerList) do table.insert(playersTotal, name) end
  32. for i = 1, #playersTotal do
  33. numJugador = math.random(#playersTotal)
  34. addPlayer = playersTotal[numJugador]
  35. table.remove(playersTotal, numJugador)
  36. if fourteams then
  37. if equipo == 1 then table.insert(teams.Team1, addPlayer) equipo = 2
  38. elseif equipo == 2 then table.insert(teams.Team2, addPlayer) equipo = 3
  39. elseif equipo == 3 then table.insert(teams.Team3, addPlayer) equipo = 4
  40. elseif equipo == 4 then table.insert(teams.Team4, addPlayer) equipo = 1
  41. end
  42. else
  43. if equipo == 1 then table.insert(teams.Team1, addPlayer) equipo = 2
  44. elseif equipo == 2 then table.insert(teams.Team2, addPlayer) equipo = 1
  45. end
  46. end
  47. end
  48. end
  49.  
  50. function eventNewGame()
  51. for k in pairs(mice_info) do mice_info[k].adv = 0 end
  52. if gameStarted then
  53. if antiLevevn then antiLevevn = false
  54. elseif antiLeverc then antiLeverc = false
  55. elseif np then np = false
  56. end
  57. setTimeMode()
  58. SetMapName()
  59. for n,p in pairs(tfm.get.room.playerList) do if not PlayerInTeam(n) then tfm.exec.killPlayer(n) end end
  60. for _,k in pairs(ban) do table.clear(teams.Team1,k) table.clear(teams.Team2,k) table.clear(teams.Team3,k) table.clear(teams.Team4,k) end
  61. SetPlayerNameColor()
  62. first = false
  63. if mod == "Vanilla" then
  64. tfm.exec.disableMinimalistMode(minamalist)
  65. tfm.exec.disableAfkDeath(false)
  66. elseif mod =="Racing" then
  67. tfm.exec.disableMinimalistMode(minimalist)
  68. tfm.exec.disableAfkDeath(false)
  69. elseif mod =="Bootcamp" then
  70. tfm.exec.disableMinimalistMode(minimalist)
  71. tfm.exec.disableAfkDeath(false)
  72. elseif mod =="Burlas" then
  73. tfm.exec.disableMinimalistMode(minimalist)
  74. tfm.exec.disableAfkDeath(false)
  75. elseif mod =="Mix" then
  76. tfm.exec.disableMinimalistMode(minimalist)
  77. tfm.exec.disableAfkDeath(false)
  78. elseif mod =="end" then
  79. tfm.exec.disableMinimalistMode(false)
  80. tfm.exec.disableAfkDeath(true)
  81. end
  82. end
  83. end
  84.  
  85. function eventNewPlayer(plr, y)
  86. local info = {}
  87. for key in next, macro_keys do
  88. info[key] = {0, os_time() + macro_time, false, false}
  89. system.bindKeyboard(plr, key, true, true)
  90. end
  91. macro_info[plr] = info
  92. mice_info[plr] = {adv = 0}
  93. if gameStarted then
  94. if PlayerInTeam(plr) then tfm.exec.killPlayer(plr) return end
  95. if autoJoin then
  96. if fourteams then
  97. if #teams.Team1 < #teams.Team2 and #teams.Team1 < #teams.Team3 and #teams.Team1 < #teams.Team4 or #teams.Team1 == #teams.Team2 and #teams.Team1 == #teams.Team3 and #teams.Team1 == #teams.Team4 or #teams.Team2 > #teams.Team1 and #teams.Team2 > #teams.Team3 and #teams.Team2 > #teams.Team4 and #teams.Team1 == #teams.Team3 and #teams.Team1 == #teams.Team4 and #teams.Team3 == #teams.Team4 or #teams.Team2 > #teams.Team1 and #teams.Team2 > #teams.Team3 and #teams.Team3 > #teams.Team1 and #teams.Team2 > #teams.Team4 and #teams.Team1 == #teams.Team4 then table.insert(teams.Team1,plr)
  98. elseif #teams.Team2 < #teams.Team1 and #teams.Team2 < #teams.Team3 and #teams.Team2 < #teams.Team4 or #teams.Team3 > #teams.Team1 and #teams.Team3 > #teams.Team2 and #teams.Team4 > #teams.Team1 and #teams.Team4 > #teams.Team2 and #teams.Team1 == #teams.Team2 or #teams.Team1 > #teams.Team2 and #teams.Team1 > #teams.Team4 and #teams.Team3 > #teams.Team2 and #teams.Team3 > #teams.Team4 and #teams.Team2 == #teams.Team4 or #teams.Team1 > #teams.Team2 and #teams.Team1 > #teams.Team3 and #teams.Team1 > #teams.Team4 and #teams.Team2 == #teams.Team3 and #teams.Team2 == #teams.Team4 and #teams.Team3 == #teams.Team4 then table.insert(teams.Team2,plr)
  99. elseif #teams.Team3 < #teams.Team1 and #teams.Team3 < #teams.Team2 and #teams.Team3 < #teams.Team4 or #teams.Team4 > #teams.Team1 and #teams.Team4 > #teams.Team2 and #teams.Team4 > #teams.Team3 and #teams.Team1 == #teams.Team2 and #teams.Team1 == #teams.Team3 and #teams.Team2 == #teams.Team3 or #teams.Team1 > #teams.Team2 and #teams.Team1 > #teams.Team3 and #teams.Team4 > #teams.Team2 and #teams.Team4 > #teams.Team3 and #teams.Team2 == #teams.Team3 or #teams.Team2 > #teams.Team1 and #teams.Team2 > #teams.Team3 and #teams.Team4 > #teams.Team1 and #teams.Team4 > #teams.Team3 and #teams.Team1 == #teams.Team3 then table.insert(teams.Team3,plr)
  100. elseif #teams.Team4 < #teams.Team1 and #teams.Team4 < #teams.Team2 and #teams.Team4 < #teams.Team3 or #teams.Team1 == #teams.Team2 and #teams.Team1 == #teams.Team3 and #teams.Team1 == #teams.Team4 and #teams.Team2 == #teams.Team3 and #teams.Team2 == #teams.Team4 and #teams.Team3 == #teams.Team4 or #teams.Team3 > #teams.Team1 and #teams.Team3 > #teams.Team2 and #teams.Team3 > #teams.Team4 and #teams.Team1 == #teams.Team2 and #teams.Team1 == #teams.Team4 and #teams.Team2 == #teams.Team4 or #teams.Team1 > #teams.Team3 and #teams.Team1 > #teams.Team4 and #teams.Team2 > #teams.Team3 and #teams.Team2 > #teams.Team4 and #teams.Team3 == #teams.Team4 then table.insert(teams.Team4,plr)
  101. else table.insert(teams.Team4,plr)
  102. end
  103. else
  104. if #teams.Team1 == #teams.Team2 then
  105. table.insert(teams.Team1,plr)
  106. elseif #teams.Team1 > #teams.Team2 then
  107. table.insert(teams.Team2,plr)
  108. end
  109. end
  110. end
  111. else tfm.exec.respawnPlayer(plr)
  112. end
  113. for _,k in pairs(ban) do ui.addTextArea(666, "<p align='center'><font size='100'><r>\nBAN</r></font>", k, 0, 0, 800, 400, 0x000001, 0x000001, 1, true) end
  114. end
  115.  
  116. function eventPlayerDied(plr)
  117. if gameStarted then
  118. local plrCount = 0
  119. for n,p in pairs(tfm.get.room.playerList) do
  120. if not p.isDead then
  121. plrCount = plrCount + 1
  122. end
  123. end
  124. if plrCount <= 0 then
  125. newMap()
  126. end
  127. end
  128. end
  129.  
  130. function eventPlayerWon(plr, TT, wonTime)
  131. local tiemend = 18
  132. if gameStarted then
  133. if PlayerInTeam(plr) then
  134. if not first then
  135. if table.contain(teams.Team1,plr) then
  136. first = true
  137. p.T1 = p.T1 + 1
  138. tfm.exec.setPlayerScore(plr, 1,true)
  139. tfm.exec.setGameTime(5)
  140. SetMapName()
  141. if tonumber(p.T1) >= tonumber(win) then
  142. tfm.exec.newGame(7773973)
  143. for i,n in pairs(teams.Team2) do tfm.exec.killPlayer(n) end
  144. for i,b in pairs(teams.Team3) do tfm.exec.killPlayer(b) end
  145. for i,m in pairs(teams.Team4) do tfm.exec.killPlayer(m) end
  146. ui.addTextArea(16, "<font size='35'><p align='center'><i><font color='#"..t1C.."'> "..t1N.."</font><font color='#ffffff'> won the game!", nil, 0, 140, 800, 60, 0x000000, 0x5eff6e, 0, true)
  147. ui.addTextArea(17, "<font size='15'><p align='center'><i><font color='#"..t1C.."'> "..plr.."</font><font color='#ffffff'> made the last point!", nil, 0, 190, 800, 60, 0xffffff, 0x5eff6e, 0, true)
  148. mod = "end"
  149. end
  150. end
  151. if table.contain(teams.Team2,plr) then
  152. first = true
  153. p.T2 = p.T2 + 1
  154. tfm.exec.setPlayerScore(plr, 1,true)
  155. tfm.exec.setGameTime(5)
  156. SetMapName()
  157. if tonumber(p.T2) >= tonumber(win) then
  158. tfm.exec.newGame(7774030)
  159. for i,v in pairs(teams.Team1) do tfm.exec.killPlayer(v) end
  160. for i,b in pairs(teams.Team3) do tfm.exec.killPlayer(b) end
  161. for i,m in pairs(teams.Team4) do tfm.exec.killPlayer(m) end
  162. ui.addTextArea(16, "<font size='35'><p align='center'><i><font color='#"..t2C.."'> "..t2N.."</font><font color='#ffffff'> won the game!", nil, 0, 140, 800, 60, 0x000000, 0x5eff6e, 0, true)
  163. ui.addTextArea(17, "<font size='15'><p align='center'><i><font color='#"..t2C.."'> "..plr.."</font><font color='#ffffff'> made the last point!", nil, 0, 190, 800, 60, 0xffffff, 0x5eff6e, 0, true)
  164. mod = "end"
  165. end
  166. end
  167. if table.contain(teams.Team3,plr) then
  168. first = true
  169. p.T3 = p.T3 + 1
  170. tfm.exec.setPlayerScore(plr, 1,true)
  171. tfm.exec.setGameTime(5)
  172. SetMapName()
  173. if tonumber(p.T3) >= tonumber(win) then
  174. tfm.exec.newGame(7774987)
  175. for i,v in pairs(teams.Team1) do tfm.exec.killPlayer(v) end
  176. for i,n in pairs(teams.Team2) do tfm.exec.killPlayer(n) end
  177. for i,m in pairs(teams.Team4) do tfm.exec.killPlayer(m) end
  178. ui.addTextArea(16, "<font size='35'><p align='center'><i><font color='#"..t3C.."'> "..t3N.."</font><font color='#ffffff'> won the game!", nil, 0, 140, 800, 60, 0x000000, 0x5eff6e, 0, true)
  179. ui.addTextArea(17, "<font size='15'><p align='center'><i><font color='#"..t3C.."'> "..plr.."</font><font color='#ffffff'> made the last point!", nil, 0, 190, 800, 60, 0xffffff, 0x5eff6e, 0, true)
  180. mod = "end"
  181. end
  182. end
  183. if table.contain(teams.Team4,plr) then
  184. first = true
  185. p.T4 = p.T4 + 1
  186. tfm.exec.setPlayerScore(plr, 1,true)
  187. tfm.exec.setGameTime(5)
  188. SetMapName()
  189. if tonumber(p.T4) >= tonumber(win) then
  190. tfm.exec.newGame(7774988)
  191. for i,v in pairs(teams.Team1) do tfm.exec.killPlayer(v) end
  192. for i,n in pairs(teams.Team2) do tfm.exec.killPlayer(n) end
  193. for i,b in pairs(teams.Team3) do tfm.exec.killPlayer(b) end
  194. ui.addTextArea(16, "<font size='35'><p align='center'><i><font color='#"..t4C.."'> "..t4N.."</font><font color='#ffffff'> won the game!", nil, 0, 140, 800, 60, 0x000000, 0x5eff6e, 0, true)
  195. ui.addTextArea(17, "<font size='15'><p align='center'><i><font color='#"..t4C.."'> "..plr.."</font><font color='#ffffff'> made the last point!", nil, 0, 190, 800, 60, 0xffffff, 0x5eff6e, 0, true)
  196. mod = "end"
  197. end
  198. end
  199. end
  200. end
  201. end
  202. end
  203.  
  204. if_admin = function (name) for p = 1, #admin do if name == admin[p] then return true end end return false end
  205.  
  206. function eventTextAreaCallback(id, player, callback)
  207. if if_admin(player) then
  208. if id == 8 then
  209. if callback == "vn" then mod = "Vanilla" ShowStartBoard() end
  210. elseif id == 9 then
  211. if callback == "rc" then mod = "Racing" ShowStartBoard() end
  212. elseif id == 18 then
  213. if callback == "bc" then mod = "Bootcamp" ShowStartBoard() end
  214. elseif id == 20 then
  215. if callback == "brc" then mod = "Burlas" ShowStartBoard() end
  216. elseif id == 21 then
  217. if callback == "mix" then mod = "MIX" ShowStartBoard() end
  218. elseif id == 10 then
  219. if callback == "start" then if #teams.Team1 > 0 or #teams.Team2 > 0 or #teams.Team3 > 0 or #teams.Team3 > 0 then
  220. math.randomseed(os.time())
  221. for i=0, 33,1 do ui.removeTextArea(i) end
  222. gameStarted = true
  223. p.T1 = 0
  224. p.T2 = 0
  225. p.T3 = 0
  226. p.T4 = 0
  227. resetScore()
  228. newMap() else print("<R>[ERROR]: You can't start the game, all the teams are empty!</R>") end
  229. end
  230. elseif id == 11 then
  231. if callback == "dec" then
  232. if tonumber(win) > 1 then
  233. win = win - 1
  234. ShowStartBoard()
  235. end
  236. elseif callback == "inc" then
  237. if tonumber(win) < 999 then
  238. win = win + 1
  239. ShowStartBoard()
  240. end
  241. end
  242. elseif id == 12 then
  243. if callback == "OnAndOff" then
  244. autoJoin = not autoJoin
  245. ShowStartBoard()
  246. end
  247. elseif id == 15 then
  248. if callback == "Fill" then
  249. toTeams()
  250. ShowStartBoard()
  251. end
  252. elseif id == 19 then
  253. if callback == "nteams" then
  254. fourteams = not fourteams
  255. ShowStartBoard()
  256. end
  257. elseif id == 1002 then
  258. ui.removeTextArea(1001, player)
  259. ui.removeTextArea(1002, player)
  260. elseif id == 675 then for i=667,675 do ui.removeTextArea(i, player) end
  261. elseif id == 99999 then ui.addTextArea(1001, "<p align='center'>Commands:</p>\n\n!team1/2/3/4 [name] [name] <R>or</R> !t1/2/3/4 [name] [name] - assign players to team.\n!add team1/2/3/4 [name] [name] <R>or</R> !a t1/2/3/4 [name] [name] - add players to team.\n!remove [name] [name] <R>or</R> !r [name] [name] - remove players from a team.\n!sp team1/2/3/4 [p] <R>or</R> !sp t1/2/3/4 [p] - change points from a team.\n!name t1/2/3/4 <R>or</R> !n t1/2/3/4 - set a name to team selected.\n!aj on <R>or</R> !aj off - status of autojoin.\n!minimalist on <R>or</R> !minamlist off - status of minimalist mode\n!skip <R>or</R> !s - change map.\n!antirc <R>or</R> !antivn - the next map will be antileve rc = racing or vn = vanilla.\n!repeat <R>or</R> !rt - repeat the current map.\n!np [map] - only put the number of map, no @. Example: !np 0\n!macro on/off - active/deactivate AntiMacro\n!ban [name] [reason] - ban player selected (show black box to player).\n!unban [name] - unban player selected.\n!banlist - show a list of players banned.\n!admin [name] - add player to admins list.\n!noadmin [name] - remove admin.\n!vote on/result/end - start vote, show result and end.\n!finish script\n\n", player, 125, 50, 550, 300, 0x324650, 0x212F36, 1, true)
  262. ui.addTextArea(1002, "<p align='center'><a href='event:cerrar'>CLOSE</p>", player, 350, 345, 95, 18, 0x324650, 0x212F36, 1, true)
  263. end
  264. end
  265. if id == 35 then
  266. if callback == "mrc" then
  267. vote.racing = vote.racing + 1
  268. ui.removeTextArea(35, player)
  269. elseif callback == "mbr" then
  270. vote.burlas = vote.burlas + 1
  271. ui.removeTextArea(35, player)
  272. elseif callback == "mbc" then
  273. vote.bootcamp = vote.bootcamp + 1
  274. ui.removeTextArea(35, player)
  275. elseif callback == "mvn" then
  276. vote.vanilla = vote.vanilla + 1
  277. ui.removeTextArea(35, player)
  278. elseif callback == "mmix" then
  279. vote.mix = vote.mix + 1
  280. ui.removeTextArea(35, player)
  281. end
  282. end
  283. end
  284.  
  285. function eventChatCommand(name, command)
  286. if if_admin(name) then
  287. local arg={}
  288. for argument in command:gmatch("[^%s]+") do
  289. table.insert(arg,argument)
  290. end
  291. if arg[1] == "team1" and arg[2] ~= nil or arg[1] == "t1" and arg[2] ~= nil then
  292. teams.Team1 = {}
  293. for i,v in pairs(arg) do
  294. if i > 1 then
  295. if PlayerCheck(v) then
  296. if TeamFix(v) == "team2" or TeamFix(v) == "team3" or TeamFix(v) == "team4" then
  297. table.clear(teams.Team2,v) table.clear(teams.Team3,v) table.clear(teams.Team4,v) table.insert(teams.Team1,v)
  298. if not gameStarted then ShowStartBoard() end
  299. else
  300. table.insert(teams.Team1,v)
  301. if not gameStarted then ShowStartBoard() end
  302. end
  303. end
  304. end
  305. end
  306. elseif arg[1] == "team2" and arg[2] ~= nil or arg[1] == "t2" and arg[2] ~= nil then
  307. teams.Team2 = {}
  308. for i,v in pairs(arg) do
  309. if i > 1 then
  310. if PlayerCheck(v) then
  311. if TeamFix(v) == "team1" or TeamFix(v) == "team3" or TeamFix(v) == "team4" then
  312. table.clear(teams.Team1,v) table.clear(teams.Team3,v) table.clear(teams.Team4,v) table.insert(teams.Team2,v)
  313. if not gameStarted then ShowStartBoard() end
  314. else
  315. table.insert(teams.Team2,v)
  316. if not gameStarted then ShowStartBoard() end
  317. end
  318. end
  319. end
  320. end
  321. elseif arg[1] == "team3" and arg[2] ~= nil and fourteams or arg[1] == "t3" and arg[2] ~= nil and fourteams then
  322. teams.Team3 = {}
  323. for i,v in pairs(arg) do
  324. if i > 1 then
  325. if PlayerCheck(v) then
  326. if TeamFix(v) == "team1" or TeamFix(v) == "team2" or TeamFix(v) == "team3" then
  327. table.clear(teams.Team1,v) table.clear(teams.Team2,v) table.clear(teams.Team4,v) table.insert(teams.Team3,v)
  328. if not gameStarted then ShowStartBoard() end
  329. else
  330. table.insert(teams.Team3,v)
  331. if not gameStarted then ShowStartBoard() end
  332. end
  333. end
  334. end
  335. end
  336. elseif arg[1] == "team4" and arg[2] ~= nil and fourteams or arg[1] == "t4" and arg[2] ~= nil and fourteams then
  337. teams.Team4 = {}
  338. for i,v in pairs(arg) do
  339. if i > 1 then
  340. if PlayerCheck(v) then
  341. if TeamFix(v) == "team1" or TeamFix(v) == "team2" or TeamFix(v) == "team3" then
  342. table.clear(teams.Team1,v) table.clear(teams.Team2,v) table.clear(teams.Team3,v) table.insert(teams.Team4,v)
  343. if not gameStarted then ShowStartBoard() end
  344. else
  345. table.insert(teams.Team4,v)
  346. if not gameStarted then ShowStartBoard() end
  347. end
  348. end
  349. end
  350. end
  351. elseif arg[1] == "add" and arg[2] == "team1" and arg[3] ~= nil or arg[1] == "a" and arg[2] == "t1" and arg[3] ~= nil then
  352. for i,v in pairs(arg) do
  353. if i > 1 then
  354. if PlayerCheck(v) then
  355. if TeamFix(v) == "team2" or TeamFix(v) == "team3" or TeamFix(v) == "team4" then
  356. table.clear(teams.Team2,v) table.clear(teams.Team3,v) table.clear(teams.Team4,v) table.insert(teams.Team1,v)
  357. if not gameStarted then ShowStartBoard() end
  358. else
  359. table.insert(teams.Team1,v)
  360. if not gameStarted then ShowStartBoard() end
  361. end
  362. end
  363. end
  364. end
  365. elseif arg[1] == "add" and arg[2] == "team2" and arg[3] ~= nil or arg[1] == "a" and arg[2] == "t2" and arg[3] ~= nil then
  366. for i,v in pairs(arg) do
  367. if i > 1 then
  368. if PlayerCheck(v) then
  369. if TeamFix(v) == "team1" or TeamFix(v) == "team3" or TeamFix(v) == "team4" then
  370. table.clear(teams.Team1,v) table.clear(teams.Team3,v) table.clear(teams.Team4,v) table.insert(teams.Team2,v)
  371. if not gameStarted then ShowStartBoard() end
  372. else
  373. table.insert(teams.Team2,v)
  374. if not gameStarted then ShowStartBoard() end
  375. end
  376. end
  377. end
  378. end
  379. elseif arg[1] == "add" and arg[2] == "team3" and arg[3] ~= nil and fourteams or arg[1] == "a" and arg[2] == "t3" and arg[3] ~= nil and fourteams then
  380. for i,v in pairs(arg) do
  381. if i > 1 then
  382. if PlayerCheck(v) then
  383. if TeamFix(v) == "team1" or TeamFix(v) == "team2" or TeamFix(v) == "team4" then
  384. table.clear(teams.Team1,v) table.clear(teams.Team2,v) table.clear(teams.Team4,v) table.insert(teams.Team3,v)
  385. if not gameStarted then ShowStartBoard() end
  386. else
  387. table.insert(teams.Team3,v)
  388. if not gameStarted then ShowStartBoard() end
  389. end
  390. end
  391. end
  392. end
  393. elseif arg[1] == "add" and arg[2] == "team4" and arg[3] ~= nil and fourteams or arg[1] == "a" and arg[2] == "t4" and arg[3] ~= nil and fourteams then
  394. for i,v in pairs(arg) do
  395. if i > 1 then
  396. if PlayerCheck(v) then
  397. if TeamFix(v) == "team1" or TeamFix(v) == "team2" or TeamFix(v) == "team3" then
  398. table.clear(teams.Team1,v) table.clear(teams.Team2,v) table.clear(teams.Team3,v) table.insert(teams.Team4,v)
  399. if not gameStarted then ShowStartBoard() end
  400. else
  401. table.insert(teams.Team4,v)
  402. if not gameStarted then ShowStartBoard() end
  403. end
  404. end
  405. end
  406. end
  407. elseif arg[1] == "remove" and arg[2] ~= nil or arg[1] == "r" and arg[2] ~= nil then
  408. if TeamFix(arg[2]) == "team1" or TeamFix(arg[2]) == "team2" or TeamFix(arg[2]) == "team3" or TeamFix(arg[2]) == "team4"then
  409. if not gameStarted then table.clear(teams.Team1,arg[2]) table.clear(teams.Team2,arg[2]) table.clear(teams.Team3,arg[2]) table.clear(teams.Team4,arg[2])
  410. ShowStartBoard()
  411. else
  412. table.clear(teams.Team1,arg[2]) table.clear(teams.Team2,arg[2]) table.clear(teams.Team3,arg[2]) table.clear(teams.Team4,arg[2])
  413. end
  414. end
  415. elseif arg[1] == "aj" and arg[2] == "on" and arg[3] == nil then
  416. autoJoin = true if not gameStarted then ShowStartBoard() end
  417. elseif arg[1] == "aj" and arg[2] == "off" and arg[3] == nil then
  418. autoJoin = false if not gameStarted then ShowStartBoard() end
  419. elseif arg[1] == "finish" and arg[2] == "script" then
  420. system.exit()
  421. elseif arg[1] == "reset" and arg[2] == nil then
  422. if gameStarted then
  423. gameStarted = false
  424. tfm.exec.newGame(7774050)
  425. ShowStartBoard()
  426. SetMapName()
  427. end
  428. elseif arg[1] == "d" and tonumber(arg[2]) ~= nil then
  429. if tonumber(arg[2]) > 0 and tonumber(arg[2]) <= 999 then
  430. win = arg[2]
  431. if gameStarted == false then ShowStartBoard() else SetMapName() end
  432. end
  433. elseif arg[1] == "name" or arg[1] == "n" then
  434. local t = command:find('%s')
  435. local nteam = command:sub(t+3)
  436. if arg[2] == "t1" and arg[3] ~= nil then t1N = ""..nteam..""
  437. elseif arg[2] == "t2" and arg[3] ~= nil then t2N = ""..nteam..""
  438. elseif arg[2] == "t3" and arg[3] ~= nil then t3N = ""..nteam..""
  439. elseif arg[2] == "t4" and arg[3] ~= nil then t4N = ""..nteam..""
  440. end
  441. if gameStarted == false then ShowStartBoard() else SetMapName() end
  442. elseif arg[1] == "skip" or arg[1] == "s" then
  443. newMap()
  444. elseif arg[1] == "repeat" or arg[1] == "rt" then
  445. tfm.exec.newGame(tfm.get.room.xmlMapInfo.mapCode)
  446. elseif arg[1] == "antivn" then
  447. print("<R>• Next map: antileve vanilla.</R>")
  448. antiLevevn = true
  449. elseif arg[1] == "antirc" then
  450. print("<R>• Next map: antileve racing.</R>")
  451. antiLeverc = true
  452. elseif arg[1] == "np" and arg[2] ~= nil then
  453. if tonumber(arg[2]) then
  454. np = true
  455. map = arg[2]
  456. end
  457. elseif arg[1] == "minimalist" then if arg[2] == "on" then print("<R>Minimalist mode activated.</R>") minimalist = false elseif arg[2] == "off" then print("<R>Minimalist mode disabled.</R>") minimalist = true end
  458. elseif arg[1] == "sp" then
  459. if arg[2] == "team1" or arg[2] == "t1" then
  460. if tonumber(arg[3]) ~= nil then
  461. if tonumber(arg[3]) < tonumber(win) and tonumber(arg[3]) > 0 then
  462. p.T1 = tonumber(arg[3])
  463. SetMapName()
  464. end
  465. end
  466. elseif arg[2] == "team2" or arg[2] == "t2" then
  467. if tonumber(arg[3]) ~= nil then
  468. if tonumber(arg[3]) < tonumber(win) and tonumber(arg[3]) > 0 then
  469. p.T2 = tonumber(arg[3])
  470. SetMapName()
  471. end
  472. end
  473. end
  474. elseif arg[1] == "vote" then
  475. if arg[2] == "on" then
  476. ShowVot()
  477. ui.removeTextArea(36)
  478. elseif arg[2] == "result" then
  479. ui.removeTextArea(35)
  480. ui.addTextArea(36, "<p align='center'><font size='20'>Vote</font></p>\nNext mode\n\n<font size='15'>Racing: "..vote.racing.."\nBurlas: "..vote.burlas.."\nBootcamp: "..vote.bootcamp.."\nVanilla: "..vote.vanilla.."\nMix: "..vote.mix.."</font>", nil, 300, 100, 200, 200, 0x000001, 0xffffff, 1, true)
  481. elseif arg[2] == "end" then
  482. ui.removeTextArea(36)
  483. end
  484. elseif arg[1] == "admin" and arg[2] ~= nil then table.insert(admin,arg[2]) print(" • "..name.." is now admin thanks to "..arg[2]) ui.addTextArea(99999, "<a href='event:ce'>Commands", arg[2], 5, -25, 0, 10, 0x1e3d42, 0x1e3d42)
  485. elseif arg[1] == "noadmin" and arg[2] ~= nil then if arg[2]==roomloader then print("<R>"..name.." tried remove you from admins.") else table.clear(admin,arg[2]) print(" • "..name.." remove admin to "..arg[2]) ui.removeTextArea(99999, arg[2]) end
  486. elseif arg[1] == "ban" and arg[2] ~= nil then
  487. if table.contain(ban,arg[2]) then print("<R>• The player "..arg[2].." is already banned.</R>")
  488. elseif table.contain(admin,arg[2]) then print("<R>• You can't ban an admin.</R>", name) else
  489. if #ban1 < 24 then table.insert(ban1,arg[2]) elseif #ban1 > 23 and #ban2 < 48 then table.insert(ban2,arg[2]) elseif #ban2 > 47 then table.insert(ban3,arg[2]) end
  490. local t = command:find('%s')
  491. local reason = command:sub(t+1)
  492. tfm.exec.killPlayer(arg[2])
  493. table.insert(ban,arg[2])
  494. table.clear(teams.Team1,arg[2]) table.clear(teams.Team2,arg[2]) table.clear(teams.Team3,arg[2]) table.clear(teams.Team4,arg[2])
  495. ui.addTextArea(666, "<p align='center'><font size='100'><r>\nBAN</r></font>\n<font color='#ffffff'><font size='30'>"..reason, arg[2], 0, 0, 800, 400, 0x000001, 0x000001, 1, true)
  496. print(" • "..name.." has banned -"..reason)
  497. end
  498. elseif arg[1] == "unban" and arg[2] ~= nil then ui.removeTextArea(666,arg[2])
  499. table.clear(ban1,arg[2]) table.clear(ban2,arg[2]) table.clear(ban3,arg[2]) table.clear(ban,arg[2])
  500. print(" • "..name.." has unban "..arg[2])
  501. if gameStarted and autoJoin then
  502. if fourteams then
  503. if #teams.Team1 < #teams.Team2 and #teams.Team1 < #teams.Team3 and #teams.Team1 < #teams.Team4 or #teams.Team1 == #teams.Team2 and #teams.Team1 == #teams.Team3 and #teams.Team1 == #teams.Team4 or #teams.Team2 > #teams.Team1 and #teams.Team2 > #teams.Team3 and #teams.Team2 > #teams.Team4 and #teams.Team1 == #teams.Team3 and #teams.Team1 == #teams.Team4 and #teams.Team3 == #teams.Team4 or #teams.Team2 > #teams.Team1 and #teams.Team2 > #teams.Team3 and #teams.Team3 > #teams.Team1 and #teams.Team2 > #teams.Team4 and #teams.Team1 == #teams.Team4 then table.insert(teams.Team1,arg[2])
  504. elseif #teams.Team2 < #teams.Team1 and #teams.Team2 < #teams.Team3 and #teams.Team2 < #teams.Team4 or #teams.Team3 > #teams.Team1 and #teams.Team3 > #teams.Team2 and #teams.Team4 > #teams.Team1 and #teams.Team4 > #teams.Team2 and #teams.Team1 == #teams.Team2 or #teams.Team1 > #teams.Team2 and #teams.Team1 > #teams.Team4 and #teams.Team3 > #teams.Team2 and #teams.Team3 > #teams.Team4 and #teams.Team2 == #teams.Team4 or #teams.Team1 > #teams.Team2 and #teams.Team1 > #teams.Team3 and #teams.Team1 > #teams.Team4 and #teams.Team2 == #teams.Team3 and #teams.Team2 == #teams.Team4 and #teams.Team3 == #teams.Team4 then table.insert(teams.Team2,arg[2])
  505. elseif #teams.Team3 < #teams.Team1 and #teams.Team3 < #teams.Team2 and #teams.Team3 < #teams.Team4 or #teams.Team4 > #teams.Team1 and #teams.Team4 > #teams.Team2 and #teams.Team4 > #teams.Team3 and #teams.Team1 == #teams.Team2 and #teams.Team1 == #teams.Team3 and #teams.Team2 == #teams.Team3 or #teams.Team1 > #teams.Team2 and #teams.Team1 > #teams.Team3 and #teams.Team4 > #teams.Team2 and #teams.Team4 > #teams.Team3 and #teams.Team2 == #teams.Team3 or #teams.Team2 > #teams.Team1 and #teams.Team2 > #teams.Team3 and #teams.Team4 > #teams.Team1 and #teams.Team4 > #teams.Team3 and #teams.Team1 == #teams.Team3 then table.insert(teams.Team3,arg[2])
  506. elseif #teams.Team4 < #teams.Team1 and #teams.Team4 < #teams.Team2 and #teams.Team4 < #teams.Team3 or #teams.Team1 == #teams.Team2 and #teams.Team1 == #teams.Team3 and #teams.Team1 == #teams.Team4 and #teams.Team2 == #teams.Team3 and #teams.Team2 == #teams.Team4 and #teams.Team3 == #teams.Team4 or #teams.Team3 > #teams.Team1 and #teams.Team3 > #teams.Team2 and #teams.Team3 > #teams.Team4 and #teams.Team1 == #teams.Team2 and #teams.Team1 == #teams.Team4 and #teams.Team2 == #teams.Team4 or #teams.Team1 > #teams.Team3 and #teams.Team1 > #teams.Team4 and #teams.Team2 > #teams.Team3 and #teams.Team2 > #teams.Team4 and #teams.Team3 == #teams.Team4 then table.insert(teams.Team4,arg[2])
  507. else table.insert(teams.Team4,arg[2])
  508. end
  509. else
  510. if #teams.Team1 == #teams.Team2 then table.insert(teams.Team1,arg[2])
  511. elseif #teams.Team1 > #teams.Team2 then table.insert(teams.Team2,arg[2])
  512. end
  513. end
  514. end
  515. elseif arg[1] == "banlist" then
  516. ui.addTextArea(667, "<p align='center'><font size='16'>Banned players", name, 100, 35, 600, 350, 0x1e3d42, 0x8d5b3e, 1, true) ui.addTextArea(668, (table.concat(ban1,"\n") or ""), name, 100, 65, 190, 320, 0x000000, 0x000000, 0, true) ui.addTextArea(669, (table.concat(ban2,"\n") or ""), name, 300, 65, 190, 320, 0x000000, 0x000000, 0, true) ui.addTextArea(670, (table.concat(ban3,"\n") or ""), name, 500, 65, 190, 320, 0x000000, 0x000000, 0, true)
  517. ui.addTextArea(675, "<R><font size='24'><a href='event:cerrar'>X</a></font></R>", name, 708, 35, 20, 30, 0x1e3d42, 0x8d5b3e, 1, true)
  518. elseif arg[1] == "help" or arg[1] == "commands" or arg[1] == "cmds" or arg[1] == "cmd" then
  519. ui.addTextArea(1001, "<p align='center'>Commands:</p>\n\n!team1/2/3/4 [name] [name] <R>or</R> !t1/2/3/4 [name] [name] - assign players to team.\n!add team1/2/3/4 [name] [name] <R>or</R> !a t1/2/3/4 [name] [name] - add players to team.\n!remove [name] [name] <R>or</R> !r [name] [name] - remove players from a team.\n!sp team1/2/3/4 [p] <R>or</R> !sp t1/2/3/4 [p] - change points from a team.\n!name t1/2/3/4 <R>or</R> !n t1/2/3/4 - set a name to team selected.\n!aj on <R>or</R> !aj off - status of autojoin.\n!minimalist on <R>or</R> !minamlist off - status of minimalist mode\n!skip <R>or</R> !s - change map.\n!antirc <R>or</R> !antivn - the next map will be antileve rc = racing or vn = vanilla.\n!repeat <R>or</R> !rt - repeat the current map.\n!np [map] - only put the number of map, no @. Example: !np 0\n!macro on/off - active/deactivate AntiMacro\n!ban [name] [reason] - ban player selected (show black box to player).\n!unban [name] - unban player selected.\n!banlist - show a list of players banned.\n!admin [name] - add player to admins list.\n!noadmin [name] - remove admin.\n!vote on/result/end - start vote, show result and end.\n!finish script\n\n", name, 125, 50, 550, 300, 0x324650, 0x212F36, 1, true)
  520. ui.addTextArea(1002, "<p align='center'><a href='event:cerrar'>CLOSE</p>", name, 350, 345, 95, 18, 0x324650, 0x212F36, 1, true)
  521. elseif arg[1] == "macro" then if arg[2] == "on" then macroON = true print("<R>[AntiMacro] activated.</R>") elseif arg[2] == "off" then macroON = false print("<R>[AntiMacro] desactivated.</R>") end
  522. end
  523. end
  524. end
  525.  
  526. eventKeyboard = function(player, key)
  527. if macroON then
  528. if not macro_keys[key] then return end -- By tocutoeltocu
  529. local info = macro_info[player][key]
  530. local now = os_time()
  531. info[1] = info[1] + 1
  532. if now >= info[2] then
  533. if info[4] and mice_info[player].adv==0 then
  534. local count = 3
  535. concatenation[1] = "<r>[AntiMacro] <bv>"
  536. concatenation[2] = player
  537. concatenation[3] = "<bl> frozen."
  538. local data
  539. for _key, name in next, macro_keys do
  540. data = macro_info[player][_key]
  541. count = count + 4
  542. concatenation[count - 3] = " "
  543. concatenation[count - 2] = name
  544. concatenation[count - 1] = ": "
  545. if now >= data[2] and info ~= data then
  546. concatenation[count] = "0"
  547. else
  548. concatenation[count] = data[1]
  549. end
  550. end
  551. local msg = table.concat(concatenation, "", 1, count)
  552. print(msg)
  553. tfm.exec.freezePlayer(player)
  554. end
  555. info[1] = 1
  556. info[2] = now + macro_time
  557. info[3] = false
  558. info[4] = false
  559. return
  560. elseif not info[3] and info[1] >= macro_warn and mice_info[player].adv==0 then
  561. info[3] = true
  562. local count = 3
  563. concatenation[1] = "<j>[AntiMacro] <bv>"
  564. concatenation[2] = player
  565. concatenation[3] = "<bl> may be using macros."
  566. local data
  567. for _key, name in next, macro_keys do
  568. data = macro_info[player][_key]
  569. count = count + 4
  570. concatenation[count - 3] = " "
  571. concatenation[count - 2] = name
  572. concatenation[count - 1] = ": "
  573. if now >= data[2] then
  574. concatenation[count] = "0"
  575. else
  576. concatenation[count] = data[1]
  577. end
  578. end
  579. local msg = table.concat(concatenation, "", 1, count)
  580. print(msg)
  581. elseif not info[4] and info[1] >= macro_freeze then
  582. info[4] = true
  583. end
  584. end
  585. end
  586.  
  587. function eventLoop(elapsedTime, remainingTime)
  588. if remainingTime <= 500 and gameStarted then
  589. newMap()
  590. end
  591. end
  592.  
  593. function newMap()
  594. local vanilla = vnMaps[math.random(#vnMaps)]
  595. local bootcamp = bcMaps[math.random(#bcMaps)]
  596. local antivn = mapsAntivn[math.random(#mapsAntivn)]
  597. local antirc = mapsAntirc[math.random(#mapsAntirc)]
  598. local burlas = burlaMaps[math.random(#burlaMaps)]
  599. if antiLevevn then
  600. tfm.exec.newGame(antivn)
  601. elseif antiLeverc then
  602. tfm.exec.newGame(antirc)
  603. elseif np then
  604. tfm.exec.newGame(map)
  605. elseif mod == "Vanilla" then
  606. tfm.exec.disableMinimalistMode(minimalist)
  607. tfm.exec.newGame(vanilla)
  608. elseif mod == "Racing" then
  609. tfm.exec.disableMinimalistMode(minimalist)
  610. tfm.exec.newGame'#17'
  611. elseif mod == "Bootcamp" then
  612. tfm.exec.disableMinimalistMode(minimalist)
  613. tfm.exec.newGame(bootcamp)
  614. elseif mod == "Burlas" then
  615. tfm.exec.disableMinimalistMode(minimalist)
  616. tfm.exec.newGame(burlas)
  617. elseif mod == "MIX" then
  618. tfm.exec.disableMinimalistMode(minimalist)
  619. if mix_v then
  620. tfm.exec.newGame(vanilla)
  621. mix_v = false
  622. mix_bc = true
  623. elseif mix_bc then
  624. tfm.exec.newGame(bootcamp)
  625. mix_bc = false
  626. mix_rc = true
  627. elseif mix_rc then
  628. tfm.exec.newGame'#17'
  629. mix_rc = false
  630. mix_v = true
  631. end
  632. elseif mod == "end" then
  633. tfm.exec.newGame(7774050)
  634. tfm.exec.setGameTime(99999)
  635. ui.removeTextArea(16)
  636. ui.removeTextArea(17)
  637. tfm.exec.setUIMapName("vs")
  638. gameStarted = false
  639. mod = "Racing"
  640. ShowStartBoard()
  641. end
  642. end
  643.  
  644. function SetPlayerNameColor()
  645. checkColor()
  646. for i,v in pairs(teams.Team1) do tfm.exec.setNameColor(v, "0x"..t1C) end
  647. for i,n in pairs(teams.Team2) do tfm.exec.setNameColor(n, "0x"..t2C) end
  648. for i,b in pairs(teams.Team3) do tfm.exec.setNameColor(b, "0x"..t3C) end
  649. for i,m in pairs(teams.Team4) do tfm.exec.setNameColor(m, "0x"..t4C) end
  650. end
  651.  
  652. function setTimeMode()
  653. if mod == "Vanilla" then tfm.exec.setGameTime(110)
  654. elseif mod == "Racing" then tfm.exec.setGameTime(63)
  655. elseif mod == "Bootcamp" then tfm.exec.setGameTime(110)
  656. elseif mod == "Burlas" then tfm.exec.setGameTime(63)
  657. elseif mod == "MIX" then tfm.exec.setGameTime(110)
  658. elseif mod == "end" then tfm.exec.setGameTime(13)
  659. elseif mod == nil then mod = "Racing" tfm.exec.setGameTime(63)
  660. end
  661. end
  662.  
  663. function SetMapName()
  664. local npN4 = " <font color='#"..t1C .."'>"..t1N..": "..p.T1.."</font> | <font color='#"..t2C.."'>"..t2N..": "..p.T2.."</font> | <font color='#"..t3C.."'>"..t3N..": "..p.T3.."</font> | <font color='#"..t4C.."'>"..t4N..": "..p.T4.."</font> | <n>D: "..win.."</n>"
  665. local npN2 = " <font color='#"..t1C .."'>" ..t1N ..": ".. p.T1 .."</font> | <font color='#" ..t2C .."'>" ..t2N ..": "..p.T2.."</font> | <n>D: " ..win.."</n>"
  666. if gameStarted then
  667. if fourteams then tfm.exec.setUIMapName(npN4)
  668. else tfm.exec.setUIMapName(npN2)
  669. end
  670. else
  671. tfm.exec.setUIMapName("vs")
  672. end
  673. end
  674.  
  675. function FillTeams()
  676. local t = 1
  677. teams.Team1 = {}
  678. teams.Team2 = {}
  679. teams.Team3 = {}
  680. teams.Team4 = {}
  681. for n,p in pairs(tfm.get.room.playerList) do
  682. if fourteams then
  683. if t == 1 then table.insert(teams.Team1,n) t = 2
  684. elseif t == 2 then table.insert(teams.Team2,n) t = 3
  685. elseif t == 3 then table.insert(teams.Team3,n) t = 4
  686. elseif t == 4 then table.insert(teams.Team4,n) t = 1
  687. end
  688. else
  689. if t == 1 then table.insert(teams.Team1,n) t = 2
  690. elseif t == 2 then table.insert(teams.Team2,n) t = 1
  691. end
  692. end
  693. end
  694. end
  695.  
  696. function checkColor()
  697. local c = false
  698. for key,v in pairs(teamColors) do
  699. if key == t1C then
  700. t1C = v
  701. c = true
  702. elseif key == t2C then
  703. t2C = v
  704. c = true
  705. elseif key == t3C then
  706. t3C = v
  707. c = true
  708. elseif key == t4C then
  709. t4C = v
  710. c = true
  711. elseif t1C == v then
  712. c = true
  713. elseif t2C == v then
  714. c = true
  715. elseif t3C == v then
  716. c = true
  717. elseif t4C == v then
  718. c = true
  719. end
  720. end
  721. end
  722.  
  723. function table.clear(t,obj) for i,v in ipairs(t) do if v==obj then table.remove(t,i) end end end
  724.  
  725. function table.contain(t,obj) for i,v in pairs(t) do if v==obj then return true end end return false end
  726.  
  727. function resetScore() for n,p in pairs(tfm.get.room.playerList) do tfm.exec.setPlayerScore(n, 0, false) end end
  728.  
  729. function TeamFix(plr)
  730. local char = plr
  731. for i,v in pairs(teams.Team1) do if v == char then return "team1" end end
  732. for i,n in pairs(teams.Team2) do if n == char then return "team2" end end
  733. for i,b in pairs(teams.Team3) do if b == char then return "team3" end end
  734. for i,m in pairs(teams.Team4) do if m == char then return "team4" end end
  735. return false
  736. end
  737.  
  738. function PlayerCheck(plr)
  739. local playerToSerch = plr
  740. for n,p in pairs(tfm.get.room.playerList) do if n == plr then return true end end
  741. return false
  742. end
  743.  
  744. function PlayerInTeam(plr)
  745. local player = plr
  746. for i,v in pairs(teams.Team1) do if v == player then return true end end
  747. for i,n in pairs(teams.Team2) do if n == player then return true end end
  748. if fourteams then
  749. for i,b in pairs(teams.Team3) do if b == player then return true end end
  750. for i,m in pairs(teams.Team4) do if m == player then return true end end
  751. end
  752. return false
  753. end
  754.  
  755. function ShowVot()
  756. vote = {racing = 0, burlas = 0, bootcamp = 0, vanilla = 0, mix = 0}
  757. ui.addTextArea(35, "<p align='center'><font size='20'>Vote</font></p>\nSelect a mode\n\n<font size='15'><a href='event:mrc'>Racing</a>\n<a href='event:mbr'>Burlas</a>\n<a href='event:mbc'>Bootcamp</a>\n<a href='event:mvn'>Vanilla</a>\n<a href='event:mmix'>Mix</a></font>", nil, 300, 100, 200, 200, 0x000001, 0xffffff, 1, true)
  758. end
  759.  
  760. function ShowStartBoard()
  761. ui.addTextArea(0, "<p align='center'>Admin: <font color='#fff000'><b>"..admin[1], nil, 263, 365, 265, 20, 0x000001, 0x000000, 0.8, true)
  762. ui.addTextArea(1, "", nil, 209, 33, 381, 326, 0x000001, 0x000000, 1, true)
  763. ui.addTextArea(2, "<p align='center'><font size='12' color='#" ..t1C .."'>"..(table.concat(teams.Team1,"\n") or ""), nil, 210, 66, 151, 254, 0x000001, 0x00ff55, 1, true)
  764. ui.addTextArea(3, "<p align='center'><font size='12' color='#" ..t2C .."'> "..(table.concat(teams.Team2,"\n") or ""), nil, 439, 66, 151, 254, 0x000001, 0xff8540, 1, true)
  765. if fourteams then
  766. ui.removeTextArea(2)
  767. ui.removeTextArea(3)
  768. ui.addTextArea(22, "<p align='center'><font size='12' color='#" ..t1C .."'>"..(table.concat(teams.Team1,"\n") or ""), nil, 210, 66, 151, 120, 0x000001, 0x00ff55, 1, true)
  769. ui.addTextArea(33, "<p align='center'><font size='12' color='#" ..t2C .."'>"..(table.concat(teams.Team2,"\n") or ""), nil, 439, 66, 151, 120, 0x000001, 0xff8540, 1, true)
  770. ui.addTextArea(24, "<p align='center'><font size='12' color='#" ..t3C .."'>"..(table.concat(teams.Team3,"\n") or ""), nil, 210, 215, 151, 120, 0x000001, 0xff50ee, 1, true)
  771. ui.addTextArea(25, "<p align='center'><font size='12' color='#" ..t4C .."'>"..(table.concat(teams.Team4,"\n") or ""), nil, 439, 215, 151, 120, 0x000001, 0x00f5e5, 1, true)
  772. ui.addTextArea(26, "<font color='#"..t3C.."'><font size='9'><p align='center'><b>"..t3N.."</b></p>/font>", nil, 220, 190, 125, 15, 0x000001, 0x000000, 0, true)
  773. ui.addTextArea(27, "<font color='#"..t4C.."'><font size='9'><p align='center'><b>"..t4N.."</b></p>/font>", nil, 450, 190, 125, 15, 0x000001, 0x000000, 0, true)
  774. end
  775. ui.addTextArea(4, "<p align='center'>" ..(mod or "Racing"), nil, 354, 60, 90, 19, 0x000001, 0x000000, 1, true)
  776. ui.addTextArea(5, "<font size='12'><p align='center'><b>\\ VS /", nil, 209, 33, 381, 21, 0x000001, 0x000000, 1, true)
  777. ui.addTextArea(6, "<font color='#"..t1C.."'><font size='9'><p align='center'><b>"..t1N.."</b></p>/font>", nil, 220, 40, 125, 15, 0x000001, 0x000000, 0, true)
  778. ui.addTextArea(7, "<font color='#"..t2C.."'><font size='9'><p align='center'><b>"..t2N.."</b></p>/font>", nil, 450, 40, 125, 15, 0x000001, 0x000000, 0, true)
  779. ui.addTextArea(8, "<p align='center'><b><a href='event:vn'>Vanilla</a>", nil, 365, 186, 69, 20, 0x000001, 0xffffff, 1, true)
  780. ui.addTextArea(9, "<p align='center'><b><a href='event:rc'>Racing</a>", nil, 365, 105, 69, 20, 0x000001, 0xffffff, 1, true)
  781. ui.addTextArea(18, "<p align='center'><b><a href='event:bc'>Bootcamp</a>", nil, 365, 159, 69, 20, 0x000001, 0xffffff, 1, true)
  782. ui.addTextArea(20, "<p align='center'><b><a href='event:brc'>Burlas</a>", nil, 365, 132, 69, 20, 0x000001, 0xffffff, 1, true)
  783. ui.addTextArea(21, "<p align='center'><b><a href='event:mix'>MIX</a>", nil, 365, 213, 69, 20, 0x000001, 0xffffff, 1, true)
  784. ui.addTextArea(10, "<p align='center'><font size='16'><b><a href='event:start'>Start</a>", nil, 359, 255, 82, 23, 0x000001, 0xFCFF5A, 1, true)
  785. ui.addTextArea(11, "<p align='center'>Score: <a href='event:dec'>-</a> "..win.." <a href='event:inc'>+</a>", nil, 460, 345, 95, 20, 0x000001, 0x000000, 0, true)
  786. ui.addTextArea(12, "<p align='center'>Auto Join: <a href='event:OnAndOff'>"..(autoJoin and "<font color='#5ECE52'>on</font>" or not autoJoin and "<font color='#CE5252'>off</font>") .."</a>", nil, 245, 345, 87, 20, 0x000001, 0x000000, 0, true)
  787. ui.addTextArea(15, "<p align='center'><a href='event:Fill'>Fill</a>", nil, 375, 320, 47, 20, 0x000001, 0x000000, 0, true)
  788. ui.addTextArea(19, "<p align='center'>Teams: <a href='event:nteams'>"..(not fourteams and "2 (or 4)" or fourteams and "4 (or 2)") .."</a>", nil, 345, 345, 100, 20, 0x000001, 0x000000, 0, true)
  789. end
  790. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement