View difference between Paste ID: CDfti3SE and pzVHBfcv
SHOW: | | - or go back to the newest paste.
1-
admin = "Vanepatrona"
1+
admin = "Stuckerrs"
2
teamPlayers = {
3-
    {"Vanepatrona", "", "", "", ""};
3+
    {"Stuckerrs", "", "", "", ""};
4
    {"", "", "", "", "", ""};
5
}
6-
goalScore = 2
6+
goalScore = 15
7-
maps = {203664,375455,394132,170514,173816,171776,199210,562897,172951,171148,166430,169076,330933,179488,172621,168754,159145,163596,152733,410040,158909,261814,195453,281985,191205,159932,2176211,586901,285589,257324,236768,303151,270924,1324259,1225867,563436,424604,523270,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,397478,261298,177652,408643,447805,155606,176619,460961,455271,172512,320607,166271,299942,186066,152260,155628,166805,178297,313138,167903,223947,191177,113156,150664,157203,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,172520}
7+
maps = {203664,170514,173816,171776,562897,166430,169076,330933,179488,172621,168754,159145,163596,152733,410040,158909,261814,281985,159932,2176211,285589,257324,236768,303151,270924,563436,424604,523270,172547,2693587,168204,2693344,193662,1788490,305680,149451,176253,342035,2466489,292808,438333,394125,162482,304861,159298,184648,268915,329318,261298,302080,159187,176710,161023,1852910,201172,549759,257715,397478,261298,177652,447805,460961,455271,172512,320607,166271,299942,186066,152260,155628,166805,178297,167903,223947,150664,157203,163159,197229,204647,163531,232675,216173,166361,169059,271411,277824,306365,172520,113156,149422,149451,6000050,150651,150664,151655,152260,152733,153996,155480,155606,155611,155628,155765,156720,157004,157203,157805,157960,158345,158417,158909,159187,159298,159932,160841,161023,161434,162482,163094,163159,163172,163531,163596,164544,164916,165186,166032,177652,166056,166271,166333,166361,166430,166805,167075,167903,168204,168754,169059,169076,169110,169139,169228,70514,171480,171482,171776,172501,172512,172520,172547,172605,172621,172951,172976,173623,173816,174223,175204,175280,176253,176507,176619,176710,176729,179005,179488,179492,179807,180801,182370,182769,183139,183141,184648,184817,184868,185289,185428,185529,185873,185887,186066,189819,190646,190996,191177,191203,191205,191443,191642,192158,192255,192560,192959,193662,195116,195672,197229,198988,199210,199710,199826,201000,202574,203664,204488,204647,205240,205506,206396,208056,208373,234675,208653,208940,209848,213752,213755,213874,214631,214755,216171,216173,217261,220352,222377,222910,223947,2795201,225744,226226,227093,230588,231137,231921,232469,232678,235037,236768,237091,242291,250153,254785,257218,257324,257715,258192,258908,259319,261298,261814,263819,263926,264091,268915,270143,270924,271193,271411,159145,272402,272518,272689,277427,277513,514311,277824,279337,281948,282584,284134,286254,289865,2574744,4617716,295465,295630,295932,297442,299942,299983,301610,302080,303151,303939,304861,305567,305614,590775,305820,306365,306384,306655,307324,313216,314743,315666,315800,316012,318129,d320483,320626,322582,327354,237743,239200,329571,330933,330967,331344,331988,332130,332906,333002,336305,337644,343456,354984,2914456,365061,368839,372255,372419,5404791,391924,392240,393426,394132,395216,395310,395961,397467,397469,397478,374995,399364,401630,403940,3133917,408577,410040,410045,412467,412913,419335,419369,419635,420877,422981,423311,424604,424685,424900,2932238,425884,431433,431749,432501,435812,438333,438364,438449,439092,444589,447805,449496,454049,455271,457726,458528,460961,467137,476706,478236,482791,492222,492399,496610,497965,499986,500000,500690,500748,500894,504485,505619,506032,506613,506940,510996,511136,512887,522719,523270,528032,531084,541223,541223,541693,541729,543010,551317,552986,556575,556841,380516,557066,557074,560526,560583,563897,563436,564198,568122,571683,574183,575497,584783,586901,587501,592189,593164,3734991,593431,593530,596239,2242899,605255,608368,612415,618999,654894,684566,692650,692740,721319,722837,729863,758595,783547,815336,834297,842167,868262,881158,886744,912356,1111252,919484,970919,976944,999963,1000006,1004622,1014343,1018394d,1066607,1130256,1156092,1157281,1162831,1164086,1225867,1226207,1242584,1355359,536905,1265789,1266330,1301649,1303323,1323048,1333846,1383297,1384078,1390405,1398609,1403454,1410539,1413528,1427980,1435902,1494499,1503203,1526894,1531604,1540221,1580356,1580835,1593066,1595965,1615753,1615949,1620703,1647131,1722755,1733211,1788490,1807217,1809410,1955745,1989803,1990413,2024960,2040569,2130169,2178800,2311703,2329940,2426969,2423300,2469365,256899,2520540,2636519,2738370,2788517,2794566,2846829,2989803,3038589,3136410,3199998,3242049,3295967,3326197,3333223,3380788,3456260,3551333,3668866,3668888,3690269,3908151,3988424,4067327,4445580,330841,549666,4114521,2176211,1523082,5960814,1256085,373105,375455,376704,378704,2252731,1646448,6137767,4890068,4488666,698992,3888888,4627777,528782,557132,357892,273373,225484,192519,5000126,6533602,6568526,159691,158053,3907267,3848147,6574593,293559,4763378,1601992,2692883,4770120,6774534,5517891,4877895,425533,556973,4769901,7016000,406154,6642996,6675248,223174,6999009,4895345,7147973,6999882,7097819,5750090,7053648,7001001,3089270,7000066,2617140,346830,7000001,6727980,6726357,6503426,6924913,4766009,6680648,201172,187478,182681,6827739,4854539,7024409,5933637,3205704,4000000,1553755,6575613,6586669,6586669,3828508,6450492,4632975,532860,4595576,6284671,6041917,4000010,366260,330827,6289411,3984871,219956,3500000,4660408,3985463,328351,5553707,5720741,5758150,5998000,6079100,5284625,5356911,4117513,178297,2918822,293658,6045500,5340984,5706542,5914063,1914925,4398794,5761507,5616777,2605186,5473125,157098,293306,4220381,3142783,4948551,2941840,2395201,4000662,3483300,5931069,5505990,3937567,6621953,2998268,4822672,4794517,3311534,4948659,4506542,621850,1852910,1551020,3734984,4720851,3846632,1923584,4675691,3838020,322649,2758747,3530999,4313858,4365527,600212,3295954,5092739,170483,4697673,5384241,4311255,4644584,6022675,6609034,4484685,3939000,3999979,3820501,4413656,4249695,823329,320607,4362335,4234558,4295473,1568331,4337732,4390388,1972688,7091488,5134116,4317592,5132197,4333895,4121359,4107909,4093488,4058168,4039451,4241333,4027263,4237910,4000009,4000008,4000007,3999997,3999992,3999991,3976766,6304911,3969628,3964892,5342889,3958217,5263927,3920916,3866663,3866660,3860578,3849999,3826546,3815568,3799357,3850000,3779861,3767893,3759157,3750360,3747520,3734998,3734996,3734990,3734989,3734988,1737800,3707630,6462982,394125,3668877,3659983,3645415,5036934,3603631,3588395,3576303,3076903,3561333,3560999,1939604,5292798,3535850,3527399,267971,2601214,3513929,3500755,3734997,3493490,3493456,3484437,1853529,3473704,3471016,3459986,3434941,3430712,3428069,3637540,3404894,3395605,5085011,3343092,3338283,3330219,3295960,3293485,3281758,3264848,4373748,3243455,3242050,5348692,3219400,3200001,3185979,3182487,3182006,3163166,3161324,3149125,3146209,3137929,208548,3118286,3099302,3085218,3075090,277631,3043779,3041105,5460041,3024606,6729952,3016226,3012311,3012178,3008515,3008319,3000006,2999994,2996951,2974387,2967631,2963166,2961800,2947140,2945156,2933390,2933011,2925531,2920826,4889180,2470461,2890123,2887929,2884392,2877042,2869337,2860683,2860211,2858882,2854813,2850177,2844637,2828481,2819876,2818330,2817711,3042080,2811229,2805938,2803483,2797076,2789121,2777168,2772507,2750014,2747525,2719419,2718406,2708585,7000990,2704483,2693587,2693344,3963960,2682583,2673019,2669415,2668918,2643916,2636207,2574960,5489869,2474044,2466489,2448730,2432090,2427910,2420714,2378364,2362046,2357991,2346943,2341982,2309030,2297260,5616978,2239788,2208924,2202628,5598943,2128560,2082776,2080400,2036898,2033229,2031184,2009003,1869912,5819555,1802528,1802012,613277,d4538472,1737297,6593495,1705006,3139767,7062569,1642725,1636814,1610638,1584555,5876254,1526368,1296299,1134969,1110982,1102513,814311,763368,733146,720672,159116,655207,651656,639878,597804,597348,593003,591528,554154,549759,544695,515684,507884,503679,431873,392861,4578236,371579,368585,366809,357837,353356,346684,343875,342640,322922,313214,313138,305680,301559,298424,296020,295487,294478,292808,292668,285961,285589,281985,a280949,277835,266398,259854,258289,257092,255943,253469,249760,235717,229974,215933,212322,197368,195453,187035,186855,3976977,176615,175454,170007,167333,5522262,3734999,155517,2484316,1962695,1952415,1951944,1949730,1872179,}
8-
------------------------------------------------------------
8+
-----------------------------------------------------------
9
teamColor = {0xCC0000, 0x0033FF}
10
teamScore = {0,0}
11
gameStarted = nil
12
gameFinished = nil
13
currentMap = nil
14
playersAlive = nil
15
playersInRoom = 0
16
players = {}
17
team = {}
18
first = nil
19
 
20
teamList = {"",""}
21
for i=1,2 do
22
    for _,name in pairs(teamPlayers[i]) do
23
        team[name] = i
24
        teamList[i] = teamList[i] .. name .. "\n"
25
    end
26
end
27
 
28
function main()
29
  tfm.exec.disableAutoNewGame(true)
30
    tfm.exec.disableAutoShaman(true)
31
    tfm.exec.disableAutoTimeLeft(true)
32
 tfm.exec.disablePhysicalConsumables(true)
33
   
34
    for name in pairs(tfm.get.room.playerList) do
35
        eventNewPlayer(name)
36
    end
37
   
38
  tfm.exec.newGame(0)
39
   
40
    local x = {110,690}
41
    for name,t in pairs(team) do
42
        tfm.exec.movePlayer(name, x[t], 350)
43
    end
44
    tfm.exec.movePlayer(admin, 400, 350)
45
   
46
    ui.addTextArea(1, "<font size='16'>Equipo 1</font>\n\n"..teamList[1], nil, 30, 54, 160, 320, 0x4a4d60, 0x3a3d4b, 0.8, true)
47
    ui.addTextArea(2, "<font size='16'>Equipo 2</font>\n\n"..teamList[2], nil, 610, 54, 160, 320, 0x4a4d60, 0x3a3d4b, 0.8, true)
48
    ui.addTextArea(3, "<p align='center'><font size='16'><a href='event:start'> Empezar </a></font></p>", admin, 320, 180, 160, 32, 0x4a4d60, 0x3a3d4b, 1, true)
49
end
50
 
51
function startGame()
52
  local newMap
53
  repeat
54
    newMap = math.random(#maps)
55
  until newMap ~= currentMap
56
  currentMap = newMap
57
  tfm.exec.newGame(maps[newMap])
58
end
59
 
60
function endGame()
61
  startGame()
62
end
63
 
64
function eventNewGame()
65
  playersAlive = playersInRoom
66
    first = false
67
   
68
    for name,t in pairs(team) do
69
        tfm.exec.setNameColor(name, teamColor[t])
70
    end
71
   
72
    tfm.exec.setGameTime(300)
73
end
74
 
75
function eventNewPlayer(name)
76
    if team[name] then
77
        playersInRoom = playersInRoom + 1
78
    end
79
end
80
 
81
function eventPlayerLeft(name)
82
    if team[name] then
83
        playersInRoom = playersInRoom - 1
84
    end
85
end
86
 
87
function eventPlayerDied(name)
88
    if not gameStarted then return end
89
    if team[name] then
90
        playersAlive = playersAlive - 1
91
        checkPlayers()
92
    end
93
end
94
 
95
function eventPlayerWon(name)
96
    if not gameStarted then return end
97
    if team[name] then
98
        if not first then
99
            first = true
100
            local t = team[name]
101
            teamScore[t] = teamScore[t] + 1
102
            updateScore()
103
            tfm.exec.setGameTime(5)
104
            if teamScore[t] == goalScore then
105
                gameStarted = false
106
                gameFinished = true
107
                local c = {"#F90505","#0045FF"}
108
                ui.addTextArea(5, "<p align='center'><font size='20' color='" .. c[t] .. "'>¡El equipo " .. t .. " ha ganado!</font></p>", nil, 0, 170, 800, 60, 0, 0, 0, true)
109
            end
110
        end
111
        playersAlive = playersAlive - 1
112
        checkPlayers()
113
    end
114
end
115
 
116
function checkPlayers()
117
  if playersAlive == 0 then
118
    endGame()
119
  end
120
end
121
 
122
function eventLoop(t, tr)
123
    if gameFinished then
124
        for i=1,8 do
125
            local x,y = math.random(0,800), math.random(0,400)
126
            for j=1,5 do
127
                tfm.exec.displayParticle(math.random(21,24), x, y, math.random(-5,5), 0, 0, math.random(10)/10, nil)
128
            end
129
        end
130
    end
131
    if not gameStarted then return end
132
  if tr <= 0 then
133
    endGame()
134
  end
135
end
136
 
137
function eventTextAreaCallback(id, name, cb)
138
    if id == 3 and not gameStarted then
139
        gameStarted = true
140
        for i=1,3 do
141
            ui.removeTextArea(i)
142
        end
143
        updateScore()
144
        startGame()
145
    end
146
end
147
 
148
function updateScore()
149
    local t = string.format("<p align='center'><font size='32'><font color='#F90505'>%02d</font> - <font color='#0045FF'>%02d</font></font></p>", teamScore[1], teamScore[2])
150
    ui.addTextArea(4, t, nil, 320, 20, 160, 43, 0x4a4d60, 0x3a3d4b, 0, true)
151
end
152
 
153
main()