Vous êtes sur la page 1sur 15

--[[

__ __ __ ___ __ _ __ __ ____
/ / / / / / / _ | / / | | / / _/_/ / __/
/ /__/ /_/ / / __ | / / | |/ / _/_/ _\ \
/____/\____/ /_/ |_| / / |___/ /_/ /___/
/_/
_____ _ _ _ _
|_ _| | || | | | | |
| | _ __ ___ | || | ___ __ _ _ __ __| | ___ | | ___
| | | '__| / _ \ | || | / _ \ / _` || '_ \ / _` | / _ \ | | / _ \
| | | | | (_) || || || __/| (_| || | | || (_| || (_) || || (_) |
\_/ |_| \___/ |_||_| \___| \__,_||_| |_| \__,_| \___/ |_| \___/
V4.9
-------------------------------------------------------------------
No olvides cambiar tu nombre desde "local ADMINISTRADOR"
-------------------------------------------------------------------
Comandos:
!skip - Para cambiar de mapa
!puntos - Para cambiar el puntaje, ej: !puntos team1 5
!np @codigo - Para poner cualquier mapa
!pausa - Para pausar el juego
!team - Para asignar jugadores a un equipo, ej: !team1 Gurbetana
!d NUMERO - Asigna el puntaje para ganar, ej: !d 20
!add team nick - A�ade un jugador a el equipo especificado, ej: !a�adir team4
Soubyy#4012
!reset - Resetea el juego
!quitar TEAM NOMBRE - saca a un jugador del equipo
!puntaje - para ver el puntaje [SOLO EN MODO SOLO]
--------------------------------------------------------------------
]]
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
local Admin = "Soubyy#4012" -- Cambia tu nombre para ser ADMINISTRADOR
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
local WINS = 30 -- Puntaje para ganar.
-----------------------------------------------------------------------------------
-
system.disableChatCommandDisplay("np", true)
system.disableChatCommandDisplay("pause", true)
system.disableChatCommandDisplay("saltar", true)
system.disableChatCommandDisplay("puntaje", true)
tfm.exec.disablePhysicalConsumables()
tfm.exec.disableAutoShaman()
tfm.exec.disableAutoNewGame()
tfm.exec.disableAutoTimeLeft()
local teams = {
[1] = {},
[2] = {},
[3] = {},
[4] = {},
}
local points = {
[1] = 0,
[2] = 0,
[3] = 0,
[4] = 0,
}
local equipos = {}
local puntos = {}
local modob = "BURLAS RAC�NG BY - SOUBYY :)"
local modo = "bootcamp"
local modo2 = "Solo"
local modo2b = "normal"
local tiempo = 60
tonumber(tiempo)
local isfirst = true
local gameRunning = false
local winTime = false
local playersInGame = {}
local distanciax = 30
local distanciay = 80
local textarealugar = 300
local textareaid = 0
local mapasmix =
{7102662,157805,157004,156720,153996,151655,150651,149422,124000,203664,375455,3941
32,170514,173816,171776,199210,562897,172951,171148,166430,169076,330933,179488,172
621,168754,159145,163596,152733,410040,158909,261814,195453,281985,191205,159932,21
76211,586901,285589,257324,236768,303151,270924,1324259,1225867,563436,424604,52327
0,172547,2693587,168204,2693344,193662,1788490,305680,149451,176253,342035,2466489,
292808,176615,438333,394125,162482,304861,458528,159298,184648,268915,329318,373105
,261298,302080,449496,159187,176710,161023,366260,1852910,201172,549759,257715,3974
78,261298,177652,408643,447805,155606,176619,460961,455271,172512,320607,166271,299
942,186066,152260,155628,166805,178297,313138,167903,223947,191177,113156,150664,15
7203,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,1
72520,247329,250610,2118599,445133,149853,212903,220737,397296,2617003,629731,32962
7,221767,422655,417816,164931,245152,371072,2458243,214788,274963,2439335,269534,86
79,321268,398041,5591416,5650343,5650250,161730,4273207,4091580,5650303,5172709,565
0469,214660,3579335,4003729,508451,314205,156510,5545443,606723,3946626,332467,1665
516,1614563,3679884,414899,1531388,905496,3834905,3821104,1851411,3816991,2331474,3
13245,266854,193588,2141379,3738767,232791,285752,278506,406266,1976857,301315,1804
69,3693822,280896,403698,259604,418022,323366,594883,477603,437860,590641,3688419,3
682405,645288,419374,664949,704015,398942,195720,314159,613985,3683383,3683201,3680
223,3680221,363625,1693705,319524,3667358,1718723,1490438,3630433,3620542,3617674,3
556489,3548406,3548376,3408247,2953315,2883986,2683170,2645615,2536577,2453022,2372
538,2287914,2286056,2223685,2150335,2150335,2101747,2018511,2007205,1975684,1964752
,1964700,1956555,1923785,1862800,1716949,1674534,1658171,1659639,1657360,1657021,16
54105,1651658,1643157,1634741,1632706,1622737,1619934,1618110,1613550,1612796,16124
36,1608638,6212895,1602654,1601492,1586439,1588884,1573997,1567620,1542618,1539791,
1513407,1509474,1503393,1487161,1450554,1425101,1394120,1393405,1373000,1371239,136
8222,1359797,1358446,1352534,1346440,1321664,1321417,1281981,1255130,1222899,121418
2,1195842,1143815,1132357,1058681,979179,829657,813156,798953,749102,737841,627609,
624721,608459,616373,594049,606719,586688,580031,564033,558790,551126,545493,536235
,528428,511275,508106,501711,496945,496091,483924,472665,472379,447556,445133,44449
0,441047,438154,436447,436107,431373,430145,429822,428517,427300,425806,424795,4223
61,421302,420956,420806,418658,418600,416142,412316,410813,412211,410565,410532,410
230,407457,407455,407230,407165,406982,406881,406486,405295,403910,401995,401945,40
1778,397938,397812,397296,396861,396645,391625,387270,387180,386046,385295,386029,3
79745,378826,379866,364998,359055,352885,352710,350251,344952,340069,339896,339643,
337774,323600,319841,317754,309029,308711,308435,306213,292348,278916,277784,275514
,270819,1017676,160762,2089069,234039,267187,263163,262144,330590,403698,396105,653
8564,396105,419735,6547536,355658,6607378,191716,292348,6456247,5326916,6077025,356
722,2564883,1450554,494706,254291,1503393,6467947,6263285,2953315,6114281,412752,40
38817,5461992,319841,359901,191716,452016,1450554,397296,250610,499684,5848412,2387
91,2283,232274,1716693,330590,459349,6583596,455167,6460747,251459,244888,5755208,2
40973,235501,235034,234039,233398,232274,230510,216735,216439,216505,214037,212542,
211565,198715,193936,191716,186604,180274,176263,178657,146801,145020,3154,2283,538
2692,5249500,4412890,5163891,789128,2245005,2030343,5712914,372401,5087373,4953687,
2369254,4853690,226069,422509,5436200,732880,4038817,400866,3730656,3985806,355658,
5175727,5699298,5588646,3921436,3639993,3984750,508796,1985019,4734427,1703617,2890
68,197219,333666,6077025,5710586,322321,331572,4741601,158128,6310411,6312498,63103
96,6312188,6473912,6389619,6854536,6854539,6312173,6315208,6312203,6310370,6310383,
6853060,6310440,6547670,7062105,6545742,6985344,960547}
local mapasbootcamp=
{157960,157805,157004,156720,153996,151655,150651,149422,124000,203664,375455,39413
2,170514,173816,171776,199210,562897,172951,171148,166430,169076,330933,179488,1726
21,168754,159145,163596,152733,410040,158909,261814,195453,281985,191205,159932,217
6211,586901,285589,257324,236768,303151,270924,1324259,1225867,563436,424604,523270
,172547,2693587,168204,2693344,193662,1788490,305680,149451,176253,342035,2466489,2
92808,176615,438333,394125,162482,304861,458528,159298,184648,268915,329318,373105,
261298,302080,449496,159187,176710,161023,366260,1852910,201172,549759,257715,39747
8,261298,177652,408643,447805,155606,176619,460961,455271,172512,320607,166271,2999
42,186066,152260,155628,166805,178297,313138,167903,223947,191177,113156,150664,157
203,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,17
2520}
local mapasracing =
{7481567,7602093,7372959,7590541,7590344,7591132,7590838,7373749,7592765,7602093,76
02100,7602102,7602103,7602104,7602105,7602106,7602107,7602108,7602109,7602110,76021
11,7602112,7602115,7602117,7602118,7602119,7602120,7602121,7602122,7602124,7602125,
7602127,7602128,7602129,7602131,7602133,7602135,7602138,7602140,7602142,7602143,760
2145,7602176,7602178,7602179,7602192,7602193,7602194,7602196,7602197,7602198,760219
9,7602201,6119572,6119642,6119643,6119641.6119655,6120650,6133176,614352,6274154,63
1036,7465241,7485501,6799629,6755943,324428,7602202,7602205,7602504,7602506,7602507
,7602509,7602510,7602514,7602515,7602516,7602517,7602519,7602520,7602521,7602524,76
02525,7602526,7602527,7602529,7602531,7602533,7602534,7602536,7602537,7329765,75871
27,5378798,4322359,7602544,7602545,7602546,7602550,7602553,7602808,7602810,7602811,
7602812,7602813,7602814,7606658,7606659,7608115,7608128,7608132,7608138,7608139,760
8139,7608141,7608144,7608148,7608155,7608160,7608163,7608172,7608176,7608182,760818
3,7608185,7608189,7608192,7608196,7608201,7608205,7608213,7608217,7608220,7608226,7
608228,7608236,7608244,7608248,7608273,7608324,7608484,7608497,7608500,7608507,7608
511,7608514,7608515,7608518,7608520,7608529,7608533,7608537,7608580,7608588,7608592
,7608597,7608599,7608603,7608604,7608608}
local maps = mapasracing
local equipoc= {}
local colors = {
[1] = "e54427",
[2] = "0a98db",
[3] = "00ff00",
[4] = "ffff00",
}
local queue = {}
local nteam = 1
local kapat = {}
local posicion = {}
local numeroposicion = 1
function newMap()
local mapcode = maps[math.random(#maps)]
if #queue > 0 then
mapcode = queue[1]
table.remove(queue, 1)
end
tfm.exec.newGame(mapcode)
for player, data in pairs(tfm.get.room.playerList) do
if not playersInGame[player] then
tfm.exec.killPlayer(player)
end
end
tfm.exec.setGameTime(tiempo)
borrarScoreSolo()
end
function eventPlayerWon(player)
if not isfirst then
isfirst = true
tfm.exec.setGameTime(3)
if modo2b == "Solo" then
if puntos[player] >= WINS - 1 then
gameRunning = false
winTime = os.time()
ui.addTextArea(29, string.format("<p align='center'><font size='37'
color='#000000'>%s gan�\nLos otros son perdedores xdxdxd", player), nil, 3, 168,
800, 500, 0, 0, 0, true)
ui.addTextArea(30, string.format("<p align='center'><font size='37'><font
color='#cecece'><font color='#ff0000'>%s </font>gan�\nLos otros son perdedores
xdxdxd", player), nil, 1, 170, 800, 500, 0, 0, 0, true)
end
tfm.exec.setGameTime(3)
for i = 0, 3 do
defaultEffect(9, {13}, math.random(800), math.random(400), 20)
end
puntos[player] = puntos[player]+1
equipoc[player] = "0x115b17"
displayScoreSolo()
end
if modo2b == "normal" then
if table.contains(teams[1], player) then
tfm.exec.setGameTime(3)
for i = 0, 3 do
defaultEffect(9, {13}, math.random(800), math.random(400), 20)
end
points[1] = points[1]+1
elseif table.contains(teams[2], player) then
tfm.exec.setGameTime(3)
for i = 0, 3 do
defaultEffect(9, {9}, math.random(800), math.random(400), 20)
end
points[2] = points[2]+1
elseif table.contains(teams[3], player) then
tfm.exec.setGameTime(3)
for i = 0, 3 do
defaultEffect(9, {9}, math.random(800), math.random(400), 20)
end
points[3] = points[3]+1
elseif table.contains(teams[4], player) then
tfm.exec.setGameTime(3)
for i = 0, 3 do
defaultEffect(9, {9}, math.random(800), math.random(400), 20)
end
points[4] = points[4]+1
else
isfirst = false
end
winner = false
if points[1] >= WINS then
winner = 1
elseif points[2] >= WINS then
winner = 2
elseif points[3] >= WINS then
winner = 3
elseif points[4] >= WINS then
winner = 4
end
if winner then
gameRunning = false
winTime = os.time()
local names = {
"Team Red",
"Team Blue",
"Team Yellow",
"Team White",
}
ui.addTextArea(26, string.format("<p align='center'><font size='37'
color='#000000'>GG Noobs %s BY\nSOUBYY", names[winner]), nil, 0, 171, 800, 500, 0,
0, 0, true)
ui.addTextArea(27, string.format("<p align='center'><font size='37'
color='#000000'>GG Noobs %s BY\nSOUBYY", names[winner]), nil, 1, 170, 800, 500, 0,
0, 0, true)
ui.addTextArea(28, string.format("<p align='center'><font size='37'
color='#000000'>GG Noobs %s BY\nSOUBYY", names[winner]), nil, 2, 169, 800, 500, 0,
0, 0, true)
ui.addTextArea(29, string.format("<p align='center'><font size='37'
color='#000000'>GG Noobs %s BY\nSOUBYY", names[winner]), nil, 3, 168, 800, 500, 0,
0, 0, true)
ui.addTextArea(30, string.format("<p align='center'><font size='37'><font
color='#cecece'>GG Noobs <font color='#%s'>%s</font> BY\nSOUBYY", colors[winner],
names[winner]), nil, 1, 170, 800, 500, 0, 0, 0, true)
end
displayScore()
end
end
end
function eventLoop(elapsed, remain)
if gameRunning then
remain = remain/1000
if remain < 0 then
remain = 100
newMap()
end
else
if winTime then
if winTime > os.time()-30000 then
for i = 0, 2 do
defaultEffect(9, {11, 9, 0, 13}, math.random(800), math.random(400), 80)
end
else
winTime = false
ui.removeTextArea(26)
ui.removeTextArea(27)
ui.removeTextArea(28)
ui.removeTextArea(29)
ui.removeTextArea(30)
displayTeams()
teams = {
[1] = {},
[2] = {},
[3] = {},
[4] = {},
}
points = {
[1] = 0,
[2] = 0,
[3] = 0,
[4] = 0,
}
playersInGame = {}
end
end
end
end
function string.title(s)
return string.gsub(s, "%a", function(c)
return string.upper(c)
end, 1)
end
function resetmostrarjugadoresSolo()
distanciax = 30
distanciay = 80
textarealugar = 302
textareaid = 0
end
function eventChatCommand(player, command)
if modo2b == "Solo" then
args = string.split(command, " ")
if args[1] == "puntaje" then
resetmostrarjugadoresSolo()
ui.addTextArea(300, "<p align='center'><V><a href='event:cerrarpuntaje'>X", player,
30, 50, 30, 16, FF0000, FF0000, 1, true)
ui.addTextArea(301, string.format("<p align='center'><V>Solo a %s puntos",WINS),
player, 80, 45, 180, 18, FF0000, FF0000, 1, true)
for k,players in pairs(tfm.get.room.playerList) do
if puntos[k] then
equipos[k] = k
playersInGame[k] = true
if textareaid >= 32 then
else
ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s -
%s",k,puntos[k]), player, distanciax, distanciay, 140, 18, FF0000, FF0000, 1, true)
distanciay = distanciay + 37
textareaid = textareaid + 1
textarealugar = textarealugar + 1
if textareaid == 8 then
distanciax = distanciax + 190
distanciay = 80
textareaid = 0
end
end
end
end
end
end
if player:lower() == Admin:lower() then
args = string.split(command, " ")
if args[1] == "team1" then
if modo2b == "normal" then
table.remove(args, 1)
teams[1] = {}
points[1] = 0
for index, player in pairs(args) do
player = string.title(player)
table.insert(teams[1], player)
playersInGame[player] = true
end
displayTeams()
end
elseif args[1] == "team2" and modo2b == "normal" then
table.remove(args, 1)
teams[2] = {}
points[2] = 0
for index, player in pairs(args) do
player = string.title(player)
table.insert(teams[2], player)
playersInGame[player] = true
end
displayTeams()
elseif args[1] == "team3" and modo2b == "normal" then
table.remove(args, 1)
teams[3] = {}
points[3] = 0
for index, player in pairs(args) do
player = string.title(player)
table.insert(teams[3], player)
playersInGame[player] = true
end
displayTeams()
elseif args[1] == "team4" and modo2b == "normal" then
table.remove(args, 1)
teams[4] = {}
points[4] = 0
for index, player in pairs(args) do
player = string.title(player)
table.insert(teams[4], player)
playersInGame[player] = true
end
displayTeams()
elseif args[1] == "skip" then
newMap()
elseif args[1] == "np" then
if args[2] then
table.insert(queue, args[2])
end
elseif args[1] == "d" then
if args[2] then
WINS = tonumber(args[2])
displayScore()
end
elseif args[1] == "add" and modo2b == "Solo" then
if args[2] then
table.remove(args, 1)
for index, player in pairs(args) do
equipos[player] = player
puntos[player] = 0
playersInGame[player] = true
end
end
elseif args[1] == "add" and modo2b == "normal" then
if args[2] and args[3] then
if args[2] == "team1" and modo2b == "normal" then
table.remove(args, 1)
table.remove(args, 1)
for index, player in pairs(args) do
player = string.title(player)
table.insert(teams[1], player)
playersInGame[player] = true
end
end
if args[2] == "team2" and modo2b == "normal" then
table.remove(args, 1)
table.remove(args, 1)
for index, player in pairs(args, 3) do
player = string.title(player)
table.insert(teams[2], player)
playersInGame[player] = true
end
end
if args[2] == "team3" and modo2b == "normal" then
table.remove(args, 1)
table.remove(args, 1)
for index, player in pairs(args) do
player = string.title(player)
table.insert(teams[3], player)
playersInGame[player] = true
end
end
if args[2] == "team4" and modo2b == "normal" then
table.remove(args, 1)
table.remove(args, 1)
for index, player in pairs(args) do
player = string.title(player)
table.insert(teams[4], player)
playersInGame[player] = true
end
end
end
elseif args[1] == "quitar" then
if args[2] then
for index, player in pairs(args) do
player = string.title(player)
playersInGame[player] = false
end
end
elseif args[1] == "reset" then
teams[1] = {}
points[1] = 0
teams[2] = {}
points[2] = 0
teams[3] = {}
points[3] = 0
teams[4] = {}
points[4] = 0
displayTeams()
elseif args[1] == "puntos" and modo2b == "normal" then
if args[2] and args[3] then
local team = tonumber(args[2]:match("team(%d+)") or 0)
if team > 0 and team < 5 then
local newScore = tonumber(args[3]) or points[team]
points[team] = newScore
displayScore()
end
end
elseif args[1] == "pausa" then
gameRunning = not gameRunning
if not gameRunning then
ui.addTextArea(90, "", nil, 235, 200, 302, 22, FF0000, FF0000, 1, true)
ui.addTextArea(91, "<p align='center'><V> Juego pausado ", nil, 235, 200, 300, 20,
0x324650, 0x324650, 1, true)
tfm.exec.disableAutoTimeLeft(true)
else
ui.removeTextArea(90)
ui.removeTextArea(91)
tfm.exec.disableAutoTimeLeft(false)
end
end
end
end
function eventNewGame()
if modo2b == "normal" then
if gameRunning then
isfirst = false
for i, p in pairs(teams[1]) do
tfm.exec.setNameColor(p, "0x"..colors[1])
end
for i, p in pairs(teams[2]) do
tfm.exec.setNameColor(p, "0x"..colors[2])
end
for i, p in pairs(teams[3]) do
tfm.exec.setNameColor(p, "0x"..colors[3])
end
for i, p in pairs(teams[4]) do
tfm.exec.setNameColor(p, "0x"..colors[4])
end
displayScore()
end
end
if modo2b == "Solo" then
if gameRunning then
isfirst = false
for k,players in pairs(tfm.get.room.playerList) do
tfm.exec.setNameColor(k, "FF0000")
equipoc[k] = "FF0000"
end
displayScore()
end
end
end
function displayScore()
if modo2b == "normal" then
ui.addTextArea(25, string.format("<p align='center'><font size='20'><font color='#
%s'>%s<N> x <font color='#%s'>%s <N> x <font color='#%s'>%s <N> x <font color='#
%s'>%s <N> / <font color='FF0000'>%s", colors[1], points[1], colors[2], points[2],
colors[3], points[3], colors[4], points[4], WINS), nil, 0, 22, 800, 30, 0, 0, 0,
true)
end
end
function displayScoreSolo()
resetmostrarjugadoresSolo()
ui.addTextArea(300, string.format("<p align='center'><V>Solo a %s puntos",WINS),
nil, 80, 45, 180, 18, FF0000, FF0000, 1, true)
for k,players in pairs(tfm.get.room.playerList) do
if puntos[k] then
equipos[k] = k
playersInGame[k] = true
if textareaid >= 32 then
else
ui.addTextArea(textarealugar, string.format("<p align='center'><V>%s -
%s",k,puntos[k]), nil, distanciax, distanciay, 140, 18, equipoc[k], FF0000, 1,
true)
distanciay = distanciay + 37
textareaid = textareaid + 1
textarealugar = textarealugar + 1
if textareaid == 8 then
distanciax = distanciax + 190
distanciay = 80
textareaid = 0
end
end
end
end
end
function borrarScoreSolo()
for i = 300, 340 do
ui.removeTextArea(i)
end
end
function displayTeams()
ui.addTextArea(38, "", nil, 235, 30, 302, 22, FF0000, FF0000, 1, true)
ui.addTextArea(37, "<p align='center'><V>Admin: "..Admin, nil, 235, 30, 300, 20,
FF0000, FF0000, 1, true)
--ui.addTextArea(1, "", nil, 400, 69, 400, 260, FF0000, FF0000, 1, true)
ui.addTextArea(2, "", nil, 0, 71, 800, 290, FF0000, FF0000, 1, true)
--ui.addTextArea(3, "", nil, 331, 70, 400, 260, FF0000, FF0000, 1, true)
ui.addTextArea(4, "", nil, 57, 79, 142, 22, FF0000, FF0000, 1, true)
ui.addTextArea(5, "<p align='center'><V>Team 1", nil, 58, 80, 140, 20, FF0000,
FF0000, 1, true)
ui.addTextArea(6, "", nil, 227, 79, 142, 22, FF0000, FF0000, 1, true)
ui.addTextArea(7, "<p align='center'><V>Team 2", nil, 228, 80, 140, 20, FF0000,
FF0000, 1, true)
ui.addTextArea(8, "", nil, 417, 79, 142, 22, FF0000, FF0000, 1, true)
ui.addTextArea(9, "<p align='center'><V>Team 3", nil, 418, 80, 140, 20, FF0000,
FF0000, 1, true)
ui.addTextArea(10, "", nil, 587, 79, 142, 22, FF0000, FF0000, 1, true)
ui.addTextArea(11, "<p align='center'><V>Team 4", nil, 588, 80, 140, 20, FF0000,
FF0000, 1, true)
ui.addTextArea(12, "<p align='center'><font color='#FF0000'>|</font>", nil, 210,
102, 140, 200, 0, 0, 0, true)
ui.addTextArea(39, "<p align='center'><font color='#FF0000'>|</font>", nil, 450,
102, 140, 200, 0, 0, 0, true)
ui.addTextArea(40, "", nil, 59, 120, 140, 200, FF0000, FF0000, 1, true)
ui.addTextArea(31, "<p align='center'><font
color='#"..colors[1].."'>"..table.concat(teams[1], "\n"), nil, 60, 121, 138, 198,
FF0000, FF0000, 1, true)
ui.addTextArea(32, "", nil, 419, 120, 140, 200, FF0000, FF0000, 1, true)
ui.addTextArea(33, "<p align='center'><font
color='#"..colors[3].."'>"..table.concat(teams[3], "\n"), nil, 420, 121, 138, 198,
FF0000, FF0000, 1, true)
ui.addTextArea(34, "", nil, 589, 120, 140, 200, FF0000, FF0000, 1, true)
ui.addTextArea(35, "<p align='center'><font
color='#"..colors[4].."'>"..table.concat(teams[4], "\n"), nil, 590, 121, 138, 198,
FF0000, FF0000, 1, true)
ui.addTextArea(36, "", nil, 229, 120, 140, 200, FF0000, FF0000, 1, true)
ui.addTextArea(13, "<p align='center'><font
color='#"..colors[2].."'>"..table.concat(teams[2], "\n"), nil, 230, 121, 138, 198,
FF0000, FF0000, 1, true)
ui.addTextArea(14, "<p align='center'><font color='#FF0000'>____ ____</font>", nil,
325, 197, 140, 200, 0, 0, 0, true)
ui.addTextArea(15, "", nil, 374, 202, 40, 20, FF0000, FF0000, 1, true)
ui.addTextArea(16, "<p align='center'><V>VS", nil, 375, 203, 38, 18, FF0000,
FF0000, 1, true)
ui.addTextArea(42, "", Admin, 749, 81, 40, 20, FF0000, FF0000, 1, true)
ui.addTextArea(41, "<p align='center'><V><a href='event:salir'>X", Admin, 750, 82,
38, 18, FF0000, FF0000, 1, true)
ui.addTextArea(45, "", Admin, 744, 139, 52, 20, FF0000, FF0000, 1, true)
ui.addTextArea(46, "<p align='center'><V><a href='event:reset'>Reset", Admin, 745,
140, 50, 18, FF0000, FF0000, 1, true)
ui.addTextArea(47, "", Admin, 741, 173, 57, 20, FF0000, FF0000, 1, true)
ui.addTextArea(54, "", Admin, 741, 209, 57, 20, FF0000, FF0000, 1, true)
if modo2 == "Solo" then
ui.addTextArea(51, "<p align='center'><V><a href='event:Solo'><font
size='12'>"..modo2, Admin, 742, 210, 55, 18, FF0000, FF0000, 1, true)
end
verificarmodo()
ui.addTextArea(53, "", Admin, 741, 245, 57, 20, FF0000, FF0000, 1, true)
ui.addTextArea(52, "<p align='center'><V><a href='event:kapat'><font
size='12'>kapat", Admin, 742, 246, 55, 18, FF0000, FF0000, 1, true)
ui.addTextArea(55, "", Admin, 741, 279, 57, 20, FF0000, FF0000, 1, true)
ui.addTextArea(56, "<p align='center'><V><a href='event:Se�'><font size='12'>Se�",
Admin, 742, 280, 55, 18, FF0000, FF0000, 1, true)
ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", Admin,
375, 203, 38, 18, FF0000, FF0000, 1, true)
end
function verificarmodo()
ui.addTextArea(50, string.format("<p align='center'><V>Modo %s - %s
",modob,modo2b),nil, 235, 375, 300, 17, FF0000, FF0000, 1, true)
if modo2 == "normal" then
ui.addTextArea(51, "<p align='center'><V><a href='event:normal'><font
size='8'>"..modo2, Admin, 742, 210, 55, 18, FF0000, FF0000, 1, true)
end
if modo == "bootcamp" then
ui.addTextArea(48, "<p align='center'><V><a href='event:bootcamp'><font
size='9'>"..modo, Admin, 742, 174, 55, 18, FF0000, FF0000, 1, true)
end
if modo == "racing" then
ui.addTextArea(48, "<p align='center'><V><a href='event:racing'><font
size='9'>"..modo, Admin, 742, 174, 55, 18, FF0000, FF0000, 1, true)
end
if modo == "mix" then
ui.addTextArea(48, "<p align='center'><V><a href='event:mix'><font
size='9'>"..modo, Admin, 742, 174, 55, 18, FF0000, FF0000, 1, true)
end
end
function contarjugadores()
local players=0
function eventNewPlayer(name)--Cuando un jugador entre a la sala...
players=players+1--Sumamos 1 a nuestra tabla
end
function eventPlayerLeft(name)--Cuando un jugador salga de la sala...
players=players-1--Restamos 1 a nuestra tabla
end
for name in pairs(tfm.get.room.playerList) do--Por cada jugador que est� en la
sala...
eventNewPlayer(name)--Le ejecutamos la funci�n eventNewPlayer
end
end
function eventTextAreaCallback(id, player, callback)
if callback == 'iniciarJogo' then
gameRunning = true
for i = 1, 20 do
ui.removeTextArea(i)
end
for i = 31, 56 do
ui.removeTextArea(i)
end
borrarScoreSolo()
defaultEffect(9, {9}, 400, 212, 80)
newMap()
end
if callback == 'salir' then
tfm.system.exit()
end

if callback == 'Se�' then


nteam = 1
kapat = {}
playersInGame = {}

teams = {
[1] = {},
[2] = {},
[3] = {},
[4] = {},
}
contarjugadores()
for k,players in pairs(tfm.get.room.playerList) do
if nteam > 4 then
nteam = 1
end
table.insert(teams[nteam], k)
playersInGame[k] = true
nteam = nteam + 1
displayTeams()
end
end

if callback == 'kapat' then


nteam = 1
kapat = {}
playersInGame = {}

teams = {
[1] = {},
[2] = {},
[3] = {},
[4] = {},
}
contarjugadores()

for k,players in pairs(tfm.get.room.playerList) do


kapat[k] = k
playersInGame[k] = true
end

for k,players in pairs(tfm.get.room.playerList) do


if nteam > 4 then
nteam = 1
end
if kapat[k] == k then
jugador = kapat[math.random(#kapat)]
table.insert(teams[players], jugador)
kapat[k] = ""
nteam = nteam + 1
displayTeams()
end
end

end

if callback == 'reset' then


teams[1] = {}
points[1] = 0
teams[2] = {}
points[2] = 0
teams[3] = {}
points[3] = 0
teams[4] = {}
points[4] = 0
displayTeams()
end
if callback == 'bootcamp' then
tiempo = 150
modob = "bootcamp"
modo = "mix"
verificarmodo()
maps = mapasbootcamp
end
if callback == 'racing' then

tiempo = 60
modob = "racing"
modo = "bootcamp"
verificarmodo()
maps = mapasracing
end
if callback == 'mix' then
tiempo = 90
modob = "mix"
modo = "racing"
verificarmodo()
maps = mapasmix
end
if callback == 'Solo' then
modo2b = "Solo"
modo2 = "normal"
displayTeams()
for i = 4, 15 do
ui.removeTextArea(i)
end
for i = 31, 36 do
ui.removeTextArea(i)
end
for i = 39, 40 do
ui.removeTextArea(i)
end
contarjugadores()
for k,players in pairs(tfm.get.room.playerList) do
equipos[k] = k
puntos[k] = 0
equipoc[k] = "0x324650"
playersInGame[k] = true
if textareaid >= 32 then
else
ui.addTextArea(textarealugar, "<p align='center'><V>"..k, nil, distanciax,
distanciay, 140, 18, FF0000, FF0000, 1, true)
distanciay = distanciay + 37
textareaid = textareaid + 1
textarealugar = textarealugar + 1
if textareaid == 8 then
distanciax = distanciax + 190
distanciay = 80
textareaid = 0
end
ui.addTextArea(16, "<p align='center'><V><a href='event:iniciarJogo'>GO", Admin,
375, 203, 38, 18, FF0000, FF0000, 1, true)
end
end
end
if callback == 'normal' then
modo2b = "normal"
modo2 = "Solo"
resetmostrarjugadoressolo()
displayTeams()
end
if callback == 'cerrarpuntaje' then
borrarScoreSolo()
end
end
function string.split(s, pattern, n)
local st = {}
for sb in string.gmatch(s, "[^"..pattern.."]+") do
if not n or n > -1 then
table.insert(st,sb)
else
st[#st] = st[#st]..pattern..sb
end
n = n and n-1 or false
end
return st
end
function table.contains(tableT, element)
for _, value in pairs(tableT) do
if value == element then
return true
end
end
return false
end
defaultEffect=function(id,p,x,y,rand)
local minDist = 1
local outerBorder = 20
local maxDist = 30
local totalParticles = rand and 40 or (id == -1 and 35 or 75)
for i = 1, totalParticles do
if rand then
id = p[math.random(#p)]
end
local dist = math.min(math.random(minDist, maxDist), outerBorder)
local angle = math.random(0, 360)
local r = math.rad(angle)
local dx = math.cos(r)
local dy = math.sin(r)
local vx = dist * dx / 10
local vy = dist * dy / 10
local ax = -vx / dist / 15
local ay = (-vy / dist / 15) + 0.05
if id == -1 then
tfm.exec.displayParticle(9, x + dx, y + dy, vx, vy, ax, ay, nil)
tfm.exec.displayParticle(1, x + dx, y + dy, vx, vy, ax, ay, nil)
else
tfm.exec.displayParticle(id, x + dx, y + dy, vx, vy, ax, ay, nil)
end
end
end
displayTeams()
function eventPlayerDied()
local alive = 0
for k,v in pairs(tfm.get.room.playerList) do
if not v.isDead then
alive = alive+1
end
end
if alive == 0 then
newMap()
end
end

Vous aimerez peut-être aussi