Lua Mix
Lua Mix
CMDS:
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. !pause //the game will be paused until you put !pause again => it has been
not implemented yet
--]]
--Admin/Game Setup--
local admin = {"Vesgv#0000","MelaSudan#6969"} -- 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"
local mod = "Bootcamp"
function main()
tfm.exec.disableAllShamanSkills(true)
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoScore(true)
tfm.exec.disableAutoTimeLeft(true)
tfm.exec.disableDebugCommand(true)
tfm.exec.disablePhysicalConsumables(true)
checkColor()
ShowStartBoard()
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
currentMap = tostring(tfm.get.room.currentMap)
setTimeMode()
for n,p in pairs(tfm.get.room.playerList) do
if not PlayerInTeam(n) then
tfm.exec.killPlayer(n)
end
end
SetPlayerNameColor()
first = false
if mod == "Bootcamp" then
tfm.exec.setUIMapName(currentMap .."
<font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> /
<font color='#"..team2Color .."'>" ..team2C ..": "..teamScore.Team2.."</font> /
<n>D:" ..ScoreToWin .."</n> Time left: 0" ..
gameTime.Minutes ..":" ..gameTime.Seconds .."\n")
elseif mod =="Racing" then
tfm.exec.setUIMapName(currentMap .."
<font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> /
<font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2 .."</font> /
<n>D:"..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes
..":0" ..gameTime.Seconds .."\n")
elseif mod =="Mix" then
tfm.exec.setUIMapName(currentMap .."
<font color='#"..team1Color .."'>" ..team1C ..": ".. teamScore.Team1 .."</font> /
<font color='#" ..team2Color .."'>" ..team2C ..": "..teamScore.Team2 .."</font> /
<n>D:"..ScoreToWin .."</n> Time left: 0" .. gameTime.Minutes
..":0" ..gameTime.Seconds .."\n")
end
end
end
function eventNewPlayer(plr)
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
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
newMap()
print("WTF3")
end
end
end
end
end
end
end
new_map = function(L)
local k = true
local r = L[math.random(#L)]
while k == true do
if esta(r, already_maps) == true then
print(r)
r = L[math.random(#L)]
else
table.insert(already_maps, r)
k = false
end
end
return r
end
function newMap()
if mod == "Bootcamp" then
if b_c == true then
tfm.exec.newGame'#13'
b_c = false
else
tfm.exec.newGame'#3'
b_c = true
end
elseif mod == "Racing" then
tfm.exec.newGame'#17'
elseif mod == "Mix" then
if mix_v == true then
if b_c == true then
tfm.exec.newGame'#13'
b_c = false
else
tfm.exec.newGame'#3'
b_c = true
end
mix_v = false
else
tfm.exec.newGame'#17'
mix_v = true
end
end
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 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
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] .. " ".. admin[2], nil, 263, 365, 265, 20,
0x324650, 0x000000, 0.8, true)
ui.addTextArea(1, "", nil, 209, 33, 381, 326, 0x324650, 0x000000, 1, true)
ui.addTextArea(2, "<p align='center'><font size='12'
color='#" ..team1Color .."'>" .. (table.concat(teams.Team1,"\n") or ""), nil, 208,
66, 151, 254, 0x324650, 0x000000, 1, true)
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:" ..(mod or "Racing"), nil, 354, 60,
89, 19, 0x324650, 0x000000, 1, true)
ui.addTextArea(5, "<font size='12'><p align='center'><b>\\ LUA /", nil, 209,
33, 381, 21, 0x324650, 0x000000, 1, true)
ui.addTextArea(8, "<p align='center'><b><a href='event:bc'>Bootcamp</a>", nil,
365, 180, 69, 20, 0x001f3f, 0x000000, 1, true)
ui.addTextArea(9, "<p align='center'><b><a href='event:rc'>Racing</a>", nil,
365, 124, 69, 20, 0x001f3f, 0x000000, 1, true)
ui.addTextArea(18, "<p align='center'><b><a href='event:mix'>Mix</a>", nil,
365, 152, 69, 20, 0x540c0c, 0x000000, 1, true)
ui.addTextArea(10, "<p align='center'><font size='13'><b><a
href='event:start'>Start</a>", nil, 359, 236, 82, 23, 0x120D0D, 0x000000, 1, true)
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)
end
main()