Lua Odeyasitos
Lua Odeyasitos
Anti-macros by Tocutoeltocu.
Obs: Auto-admin
README:
Commands:
1. !team1 "playername" "playername" \\Assign players to team1 , ex: !team1
Ctmce Ziggy_z
2. !team2 "playername "playername" \\Assign players to team2 , ex: !team2
Ctmce Ziggy_z
3. !add team1 "playername" "playername" \\Adds the player team1.
4. !add team2 "playername" "playername" \\Adds the player team2.
5. !remove team1 "playername" "playername" \\Removes the player/'s from team1!
6. !remove team2 "playername" "playername" \\Removes the player/'s from team2!
7. !exit \\Closing the Admin Panel //
8. !start \\Shows the Admin Panel back //
9. !sp team1 23 \\Sets the points for team1 to 23 or whatever you choose!
10. !sp team2 15 \\Sets the points for team1 to 15 or whatever you choose!
11. !aj on / off \\Turns AutoJoin On and Off.
12. !macro on // activate anti-macros
13. !macro off // desactivate anti-macros, default option
14. !admin Name#code // add player to admin list, ex: !admin Noob#5388
15. !unadmin Name#code // delete admin from admin list (you can't delete the
host player), ex: !unadmin Edudekarly#3398
]]--
--Admin/Game Setup--
local _, msg = pcall(nil)
local adminGet = string.match(msg,"^(.-)%.")
local admin = {adminGet} -- only the first position of the array will be shown in
the gui
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)--
local autoJoin = true
local team1Color = "Blue"
local team2Color = "Red"
---Game Time Settings----
local gameTime = 63
--[[MACRO--]]
macroON = false
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
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}
local bootcampOldMaps =
{"1733211","512887","1046877","541693","692740","272689","277427","327354","500690"
,"3295967","378704","1646448","319443","455271","1615949","2423300","692650","45955
76","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","18
5873","171776","189819","528032","1000006","172547","410045","172520","171480","422
981","232675","186066","172501","435812","168204","159187","320483","295465","19971
0","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","5
56841","169076","444589","305567","155765","155480","158053","163531","164916","166
032","166056","166430","170514","172621","172951","175280","182769","447805","21617
3","171482","366809","303151","313216","3402881","1853689","305614","4537590","4523
127","4883346","3737744","3558682","1580835","6254869","157805","158909","158417","
159691","163094","163506","165186","166333","169139","171148","172512","172605","17
3623","175204","176507","176253","176619","179005","179492","180801","185428","1855
29","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","2
25744","230588","231137","231921","232469","236768","237091","242291","242351","247
311","248650","254785","257715","257218","258192","259319","264091","268668","27014
3","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","31
8129","322026","322282","322582","325259","327743","329318","330967","332906","3328
11","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","4
08643","410040","419335","419635","420877","424685","424900","431433","431624","431
749","439092","438364","438333","440592","454049","457726","458528","462004","46713
7","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","86
8262","886744","1032212","1066607","1156092","1266330","1162831","1593066","1990413
","2132250","2416969","2803483","2850177","2918822","2932238","3725142","4249695","
4334509","3979220","4593355","4604660","5056463","4794517","4585855","5086564","511
0700","5131117","5198136","5394505","5955681","6000049","6075471"}
local burlasMaps =
{"7727611","7727394","7727443","7727445","7727446","7727447","7727449","7727452","7
727454","7727455","7727457","7727459","7727462","7727463","7727468","7727470","7727
472","7727477","7727479","7727481","7727484","7727485","7727487","7727525","7727492
","7727449","7727489","7727502","7727506","7727511","7727513","7727522","7727623","
7727520","7727517","7727531","7727536","7727537","7727541","7727543","7727550","772
7551","7727555","7727556","7727558","7727561","7727564","7727568","7727571","772757
4","7727584","7727595","7727601","7727606","7727646","7727647","7727648","7727650",
"7727652","7727654","7727657","7727659","7727661","7727666","7727682","7727683","77
27690","7727693","7727701","7727702","7727714","7727718","7727719","7727723","77277
26","7727727","7727735","7727741","7727744","7727745","7727746","7727747","7727750"
,"7727761","7727769","7727778","7727782","7727790","7727792","7727799","7727801","7
727803","7727807","7727810","7727816","7727817","7727819","7727822","7727823","7727
825","7727986","7727988","7727990","7727991","7727998","7727999","7728016","7728018
","7728020","7728037","7728041","7728044","7728049","7728059","7728062","7728065","
7728066","7728074","7728078","7728083","7728087","7728090","7728102","7728104","772
8105","7728109","7728111","7728116","7728120","7728124","7728130","7728135","772814
5","7728150","7728155","7728157","7728168","7728171","7728176","7728181","7728186",
"7728191","7728193","7728201","7728202","7728205","7728209","7728214","7728217","77
28223","7728226","7728231","7728234","7728238","7728245","7728246","7728753","77287
56","7728763","7728765","7728769","7728773","7728775","7728776","7728779","7728780"
,"7728782","7728784","7728788","7728793","7728797","7728826","7728829","7728833","7
728836","7728840","7728842","7728845","7729170","7731595","7731596","7731597","7731
599","7731602","7731604","7731608","7731614","7731617","7731618","7731622","7731624
","7731627","7731631"}
function tablefind(tab,el)
for index, value in pairs(tab) do
if value == el then
return index
end
end
return nil
end
new_map = function(L)
local r = L[math.random(#L)]
table.remove(L,tablefind(L, r))
table.insert(already_maps, r)
return tostring(r)
end
local gameMode = {
local indexMapToPlay = 1
function mapToPlay()
len = #gameMode[chosenGameMode]
function main()
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAllShamanSkills(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoScore(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableDebugCommand(true)
tfm.exec.disablePhysicalConsumables(true)
checkColor()
ShowStartBoard()
system.disableChatCommandDisplay("macro")
system.disableChatCommandDisplay("skip")
system.disableChatCommandDisplay("admin")
system.disableChatCommandDisplay("unadmin")
tfm.exec.newGame(7692692,true)
for name in pairs(tfm.get.room.playerList) do eventNewPlayer(name) end
end
function establecerEquipos()
teams.Team1 = {}
teams.Team2 = {}
local equipo = 1
local jugadoresTotal = {}
for i = 1, #jugadoresTotal do
numJugador = math.random(#jugadoresTotal)
agregarJugador = jugadoresTotal[numJugador]
table.remove(jugadoresTotal, numJugador)
if equipo == 1 then
table.insert(teams.Team1, agregarJugador)
equipo = 2
elseif equipo == 2 then
table.insert(teams.Team2, agregarJugador)
equipo = 1
end
end
function eventNewGame()
if gameStarted then
tfm.exec.setGameTime(gameTime)
currentMap = tostring(tfm.get.room.currentMap)
for n,p in pairs(tfm.get.room.playerList) do
if not PlayerInTeam(n) then
tfm.exec.killPlayer(n)
end
end
SetPlayerNameColor()
first = false
tfm.exec.setUIMapName(currentMap .. " <font
color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font
color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> /
<n>D:" ..ScoreToWin)
end
end
function eventNewPlayer(plr)
local info = {}
for key in next, macro_keys do
info[key] = {0, os_time() + macro_time, false, false}
system.bindKeyboard(plr, key, true, true)
end
macro_info[plr] = info
mice_info[plr] = {adv = 0}
if gameStarted then
if PlayerInTeam(plr) then tfm.exec.killPlayer(plr) return end
if autoJoin then
if #teams.Team1 == #teams.Team2 then
table.insert(teams.Team1,plr)
elseif #teams.Team1 > #teams.Team2 then
table.insert(teams.Team2,plr)
end
end
else
tfm.exec.respawnPlayer(plr)
end
end
function eventPlayerDied(plr)
if gameStarted then
local plrCount = 0
for n,p in pairs(tfm.get.room.playerList) do
if not p.isDead then
plrCount = plrCount + 1
end
end
if plrCount <= 0 then
mapToPlay()
end
end
end
first = true
if table.contain(teams.Team1,plr) then
teamScore.Team1 = teamScore.Team1 + 1
tfm.exec.setPlayerScore(plr, 1,true)
if tonumber(teamScore.Team1) >= tonumber(ScoreToWin) then
teamWon("Team 1", team1C, plr, teamColors.Blue)
end
else
teamScore.Team2 = teamScore.Team2 + 1
tfm.exec.setPlayerScore(plr, 1,true)
tfm.exec.setGameTime(4)
tfm.exec.setUIMapName(currentMap .. " <font
color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font
color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> /
<n>D:" ..ScoreToWin)
end
end
end
end
function PlayerCheck(plr)
local playerToSerch = plr
for n,p in pairs(tfm.get.room.playerList) do
if n == plr then
return true
end
end
return false
end
if gameStarted then
tfm.exec.setUIMapName(currentMap .. " <font
color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> / <font
color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> /
<n>D:" ..ScoreToWin)
end
function SetPlayerNameColor()
checkColor()
for i,v in pairs(teams.Team1) do
tfm.exec.setNameColor(v, "0x"..team1Color)
end
function FillTeams()
local t = 1
teams.Team1 = {}
teams.Team2 = {}
for n,p in pairs(tfm.get.room.playerList) do
if t == 1 then
table.insert(teams.Team1,n)
t = 2
elseif t == 2 then
table.insert(teams.Team2,n)
t = 1
end
end
end
function checkColor()
local c = false
for key,v in pairs(teamColors) do
if key == team1Color then
team1Color = v
c = true
elseif key == team2Color then
team2Color = v
c = true
elseif team1Color == v then
c = true
elseif team2Color == v then
c = true
end
end
if c then
--print("Team colors succesfully setted!")
else
team1Color = teamColors.Green
team2Color = teamColors.Blue
print("Sory couldn't found the color you choosed, Defult color will be
apllied.")
end
end
function table.clear(t,obj)
for i,v in ipairs(t) do
if v==obj then
table.remove(t,i)
end
end
end
function table.contain(t,obj)
for i,v in pairs(t) do
if v==obj then
return true
end
end
return false
end
function resetScore()
for n,p in pairs(tfm.get.room.playerList) do
tfm.exec.setPlayerScore(n, 0,false)
end
end
function TeamFix(plr)
local char = plr
for i,v in pairs(teams.Team1) do
if v == char then
return "team1"
end
end
for i,n in pairs(teams.Team2) do
if n == char then
return "team2"
end
end
return false
end
function PlayerInTeam(plr)
local player = plr
for i,v in pairs(teams.Team1) do
if v == player then
return true
end
end
for i,n in pairs(teams.Team2) do
if n == player then
return true
end
end
return false
end
function ShowStartBoard()
ui.addTextArea(0, "<p align='center'>Administrador: <font
color='#00ff40'><b>" .. admin[1], nil, 263, 367, 265, 20, 0x324650, 0x000000, 0.8,
true)
ui.addTextArea(1, "", nil, 209, 33, 381, 328, 0x324650, 0x000000, 1, true)
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)
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)
ui.addTextArea(4, "<p align='center'>Mod: " ..(chosenGameMode or "BC & RC"),
nil, 339, 301, 120, 19, 0x324650, 0x000000, 1, true)
ui.addTextArea(5, "<font size='12'><p align='center'><b>\\ LUA by Misterthepro
and odeyasitos/", nil, 209, 33, 381, 21, 0x324650, 0x000000, 1, true)
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)
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)
ui.addTextArea(15, "<p align='center'><a href='event:Fill'>Fill</a>", nil, 376,
335, 47, 20, 0x324650, 0x000000, 1, true)
function ShowAditionalGameModes()
ui.addTextArea(200, "", nil, 209, 33, 381, 328, 0x324650, 0x000000, 1, true)
ui.addTextArea(201, "<font size='12'><p align='center'><b>\\ OTROS MODOS DE
JUEGO /", nil, 215, 38, 369, 21, 0x324650, 0x000000, 1, true)
end
main()