Tectoon

[TFM] Treinamento Racing

Jul 14th, 2015
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.76 KB | None | 0 0
  1. admin =                 {       "Tectoon", "Theapps", "Sagazgamer" }
  2.  
  3. players = {Sagazgamer}
  4. spectators = {}
  5. bscore = 0
  6. rscore = 0
  7. wait = 0
  8. endScore = 20
  9. winner = false
  10. newgame = false
  11. pause = false
  12. words = {"blue", "red", "score", "reset", "pause", "map"}
  13. owners = {Tectoon = true, Sagazgamer = true}
  14.  
  15. function eventNewGame()
  16.     tfm.exec.disableAutoTimeLeft(true)
  17.     if newgame == true then
  18.         rscore = 0
  19.         bscore = 0
  20.         newgame = false
  21.     end
  22.     if tfm.get.room.currentMap ~= "@2643833" then
  23.         tfm.exec.setUIMapName("<font color='#10CAC5'>Up to ".. endScore)
  24.     end
  25.     ui.updateTextArea(1, "<b><font size='16'><p align='center'><font color = '#030597'>".. bscore .. " <N>- <font color = '#9C0202'>"..rscore)
  26.     winner = false
  27.     wait = 6
  28.     for name in pairs(tfm.get.room.playerList) do
  29.         if players[name].spectator == true then
  30.             tfm.exec.killPlayer(name)
  31.         elseif players[name].blueteam == true then
  32.             tfm.exec.setNameColor(name, 0x056CF2)
  33.         elseif players[name].redteam == true then
  34.             tfm.exec.setNameColor(name, 0xC90000)
  35.         end
  36.     end
  37. end
  38.  
  39. function victory(team)
  40.     tfm.exec.newGame("@2643833")
  41.     tfm.exec.setGameTime(30)
  42.     tfm.exec.setUIMapName("<ROSE>GO ".. team)
  43.     if team == "BLUE" then
  44.         for name in pairs(tfm.get.room.playerList) do
  45.             if players[name].redteam == true then
  46.                 tfm.exec.killPlayer(name)
  47.             end
  48.             if players[name].spectator == true then
  49.                 tfm.exec.killPlayer(name)
  50.             end
  51.             if players[name].blueteam == true then
  52.                 tfm.exec.setNameColor(name, 0x056CF2)
  53.             end
  54.         end
  55.     end
  56.     if team == "RED" then
  57.         for name in pairs(tfm.get.room.playerList) do
  58.             if players[name].blueteam == true then
  59.                 tfm.exec.killPlayer(name)
  60.             end
  61.             if players[name].spectator == true then
  62.                 tfm.exec.killPlayer(name)
  63.             end
  64.             if players[name].redteam == true then
  65.                 tfm.exec.setNameColor(name, 0xC90000)
  66.             end
  67.         end
  68.     end
  69. end
  70.  
  71. function eventPlayerLeft(name)
  72.    players[name] = nil
  73. end
  74. function eventPlayerWon(name)
  75.     if winner == false then
  76.         winner = true
  77.         if players[name].blueteam == true and pause == false then
  78.             bscore = bscore + 1
  79.             local totalb = endScore - bscore
  80.             if totalb == 1 and bscore == rscore then
  81.                 endScore = endScore + 1
  82.                 tfm.exec.setUIMapName("<font color='#10CAC5'>Up to ".. endScore)
  83.             elseif bscore >= endScore then
  84.                 tfm.exec.chatMessage("<BV>BLUE WINS!!!!!")
  85.                 victory("BLUE")
  86.             else
  87.                 ui.updateTextArea(1, "<b><font size='16'><p align='center'><font color = '#030597'>".. bscore .. " <N>- <font color = '#9C0202'>"..rscore)
  88.             end
  89.         elseif players[name].redteam == true and pause == false then
  90.             rscore = rscore + 1
  91.             local totals = endScore - rscore
  92.             if totals == 1 and rscore == bscore then
  93.                 endScore = endScore + 1
  94.                 tfm.exec.setUIMapName("<font color='#10CAC5'>Up to ".. endScore)
  95.             elseif rscore >= endScore then
  96.                 tfm.exec.chatMessage("<R>RED WINS!!!!!")
  97.                 victory("RED")
  98.             else
  99.                 ui.updateTextArea(1, "<b><font size='16'><p align='center'><font color = '#030597'>".. bscore .. " <N>- <font color = '#9C0202'>"..rscore)
  100.             end
  101.         end
  102.     end
  103. end
  104.  
  105. function eventNewPlayer(name)
  106.     ui.addTextArea(1, "<b><font size='16'><p align='center'><font color = '#030597'>".. bscore .. " <N>- <font color = '#9C0202'>"..rscore, nil , 720, 20, 75, 23, 0x00001, nil, 0.2)
  107.     tfm.exec.chatMessage("<J>Bem-vindo ao torneio racing!", name)
  108.     players[name] = {
  109.         spectator = true,
  110.         blueteam = false,
  111.         redteam = false
  112.     }
  113. end
  114.  
  115. function eventLoop()
  116.     if tfm.get.room.currentMap == "@2643833" then
  117.         wait = wait - 1
  118.         if wait <= 0 and wait >= -30 then
  119.             tfm.exec.addShamanObject(28, math.random()*800, math.random()*400)
  120.             tfm.exec.addShamanObject(28, math.random()*800, math.random()*400)
  121.             tfm.exec.addShamanObject(40, math.random()*800, math.random()*400)
  122.             print(wait)
  123.             if wait <= -5 and wait >= -7 then
  124.                 newgame = true
  125.             end
  126.         end
  127.     end
  128. end
  129.  
  130. function eventChatCommand(name, cmd)
  131.     local args = {}
  132.     for arg in cmd:gmatch("%S+") do
  133.         table.insert(args, arg)
  134.     end
  135.     if owners[name] then
  136.         if args[1] == "blue" and args[2] ~= nil then
  137.             for n in pairs(tfm.get.room.playerList) do
  138.                 if n == args[2] and players[args[2]].blueteam == false then
  139.                     nom = args[2]
  140.                 end
  141.             end
  142.             if nom ~= nil then
  143.                 tfm.exec.setNameColor(nom, 0x056CF2)
  144.                 tfm.exec.chatMessage("<BV>Bem-vindo à equipe azul", nom)
  145.                 players[nom].blueteam = true
  146.                 players[nom].spectator = false
  147.                 if players[nom].redteam == true then
  148.                     players[nom].redteam = false
  149.                 end
  150.             end
  151.             elseif args[1] == "reset" then
  152.                 rscore = 0
  153.                 bscore = 0
  154.                 ui.updateTextArea(1, "<b><font size='16'><p align='center'><font color = '#030597'>".. bscore .. " <N>- <font color = '#9C0202'>"..rscore)
  155.                 for nam in pairs(tfm.get.room.playerList) do
  156.                     if tfm.get.room.playerList[nam] then
  157.                         tfm.exec.setNameColor(nam, 0)
  158.                         players[nam].blueteam=false
  159.                         players[nam].redteam=false
  160.                         players[nam].spectator=true
  161.                     end
  162.                     if nam == "Aeon" then
  163.                         players[nam].spectator=false
  164.                     end
  165.                 end
  166.                 tfm.exec.newGame()
  167.             elseif args[1] == "pause" then
  168.                 pause = not pause
  169.                 if pause then
  170.                     tfm.exec.chatMessage("<BL>O jogo agora está em pausa.")
  171.                 else
  172.                     tfm.exec.chatMessage("<BL>O jogo é agora retomado.")
  173.                 end
  174.             elseif args[1] == "map" then
  175.                 tfm.exec.newGame(tonumber(args[2]) or 3683520)
  176.             elseif args[1] == "score" then
  177.                 endScore = tonumber(args[2] or 20) or 20
  178.                 tfm.exec.chatMessage("<ROSE>Você mudou a pontuação vencedora para: " .. endScore, name)
  179.                 tfm.exec.setUIMapName("<font color='#10CAC5'>Up to ".. endScore)
  180.             elseif args[1] == "red" and args[2] ~= nil then
  181.             for n in pairs(tfm.get.room.playerList) do
  182.                 if n == args[2] and players[args[2]].redteam == false then
  183.                     nom = args[2]
  184.                 end
  185.             end
  186.             if nom ~= nil then
  187.                 tfm.exec.setNameColor(nom, 0xC90000)
  188.                 tfm.exec.chatMessage("<R>Bem-vindo à equipe vermelha", args[2])
  189.                 players[nom].redteam = true
  190.                 players[nom].spectator = false
  191.                 if players[nom].blueteam == true then
  192.                     players[nom].blueteam = false
  193.                 end
  194.             end
  195.         end
  196.     end
  197. end
  198.  
  199. function table.delete(t, element)
  200.     for key, value in ipairs(t) do
  201.         if value == element then
  202.             table.remove(t, key)
  203.         end
  204.     end
  205. end
  206.  
  207. for i,p in pairs(tfm.get.room.playerList) do
  208.     eventNewPlayer(i)
  209. end
  210.    
  211. tfm.exec.disableAutoNewGame(true);
  212. mapas={[[@5515862]],[[@398041]],[[@1661852]],[[@3638794]],[[@1856349]],[[@1368233]],[[@3967250]],[[@4238784]],[[@4174318]],[[@3544895]],[[@229827]],[[@330590]],[[@211528]],[[@210188]],[[@5405469]],[[@5172709]],[[@3799507]],[[@3680180]],[[@214660]],[[@2577060]],[[@425797]],[[@314205]],[[@3901403]],[[@982242]],[[@508451]],[[@2813487]],[[@156510]],[[@606723]],[[@976721]],[[@3683294]],[[@3946626]],[[@332467]],[[@3845214]],[[@397501]],[[@3668754]],[[@1665516]],[[@3889414]],[[@3854268]],[[@1483155]],[[@2331474]],[[@3727755]],[[@266854]],[[@1646120]],[[@905496]],[[@3847244]],[[@278506]],[[@229834]],[[@220500]],[[@3721990]],[[@406266]],[[@1976857]],[[@301315]],[[@229944]],[[@217900]],[[@3684784]],[[@3696662]],[[@4685111]],[[@1654903]],[[@3630433]],[[@3620542]],[[@3617674]],[[@3603799]],[[@3556489]],[[@3556690]],[[@3572407]],[[@3537419]],[[@3584689]],[[@3347209]],[[@3267620]],[[@3209087]],[[@3156569]],[[@3036416]],[[@2953315]],[[@2883986]],[[@2725924]],[[@2683170]],[[@2682985]],[[@2645615]],[[@2588032]],[[@2586491]],[[@2564883]],[[@2536577]],[[@2453022]],[[@2393139]],[[@2372538]],[[@2287914]],[[@2286056]],[[@2228834]],[[@2223685]],[[@2219308]],[[@2214661]],[[@2185089]],[[@2174319]],[[@2150335]],[[@2144010]],[[@2138401]],[[@2134537]],[[@2118599]],[[@2101747]],[[@2079190]],[[@2076632]],[[@2068543]],[[@2048474]],[[@2047177]],[[@2023552]],[[@2018511]],[[@2012147]],[[@2007205]],[[@2007170]],[[@2005559]],[[@1987990]],[[@1982476]],[[@1979131]],[[@1976007]],[[@1975753]],[[@1975684]],[[@1975275]],[[@1973574]],[[@1965819]],[[@1964752]],[[@1964700]],[[@1956555]],[[@1956002]],[[@1954898]],[[@1954369]],[[@1705316]],[[@1862823]],[[@1862800]],[[@1794287]],[[@1924227]],[[@1923785]],[[@1687268]],[[@1716949]]};
  213. function nextRound()
  214.     tfm.exec.newGame(mapas[math.random(#mapas)]);
  215. end
  216. function eventNewGame()
  217.     vivo=0
  218.     for name,player in pairs(tfm.get.room.playerList) do
  219.         vivo=vivo+1
  220.     end
  221. end
  222.  
  223. for i in pairs(tfm.get.room.playerList) do
  224. end
  225.  
  226. function eventPlayerDied(name)
  227.     vivo=vivo-1
  228. end
  229. function eventPlayerWon(name)
  230.     vivo=vivo-1
  231. end
  232. function eventLoop(tempoPassado, tempoFaltando)
  233.     if vivo == 0 or tempoFaltando < 1000 then
  234.         nextRound();
  235.     end
  236. end
  237. nextRound();
  238.  
  239. parametre =     { ["Tempo automático"] = true }
  240.  
  241.  
  242. aff =           { lJoueurs = {} , joueur = {}
  243.                                 }
  244.  
  245.  
  246. joueur =         {}
  247.  
  248. for k, pseudo in pairs(admin) do
  249.                 ui.addTextArea (1, "<p align='center'><b><a href='event:time'>time</a></b></p>", pseudo, 60, 30, 35, 20, 0x324650, 0x324650, 0.75, true)
  250.         ui.addTextArea (4, "<p align='center'><b><a href='event:map'>Mapa</a></b></p>", pseudo, 10, 30, 35, 20, 0x324650, 0x324650, 0.5, true)
  251.                
  252.                 for l, m in pairs ( aff ) do
  253.                         aff[l][pseudo] = false
  254.  
  255.                 end
  256. end
  257.  
  258.  
  259.  
  260. function eventTextAreaCallback(id, source, callback)
  261.  
  262.                 if callback == 'time' then
  263.    
  264.                         ui.addPopup (0, 2, "Tempo para definir:", source, 10, 70, 150, true)
  265.  
  266.  elseif callback == 'map' then  
  267.  
  268.                         ui.addPopup (1, 2, "Código do Mapa::", source, 10, 70, 150, true)
  269.  
  270.                 elseif parametre[callback] ~= nil then
  271.  
  272.                         paraGestion(callback,  source )
  273.                         ui.updateTextArea (id, callback .. ": <a href='event:" .. callback .. "'>" .. B(parametre[callback]) .. "</a>", source )
  274.    
  275.  
  276.                 elseif joueur[callback] ~= nil or callback == "Nomes" then
  277.    
  278.                         if aff["joueur"][source] then
  279.                                 effJoueur ( source )
  280.                                 if callback ~= dernierProfil[source] then
  281.                                         eventTextAreaCallback(id, source, callback)
  282.                                 end
  283.  
  284.                         else
  285.                                 affJoueur(source, callback)
  286.                                 ui.updateTextArea (id, "<p align='center'><b><V><a href='event:" .. callback .. "'>" .. callback .. "</a></N></b></p>", source)
  287.                         end
  288.    
  289.                         dernierProfil[source] = callback
  290.  
  291.                 elseif parametreJ[callback] ~= nil then
  292.                         if dernierProfil[source] == "all" then
  293.  
  294.                                 for k, v in pairs ( joueur ) do
  295.                                         if all[callback] ~= nil then
  296.                                                 joueur[k][callback] = all[callback]
  297.                                         end
  298.    
  299.                                         paraJGestion ( k, callback )
  300.                                 end
  301.  
  302.                         end
  303.  
  304.    
  305.                 end
  306.    
  307. end
  308.  
  309. function eventPopupAnswer (id, playerName, answer)
  310.  
  311.                 if id == 0 then
  312.                         tfm.exec.setGameTime(answer, true)  
  313.    
  314.  
  315. elseif id == 1 then
  316.                         tfm.exec.newGame(answer)
  317.  
  318.    
  319.                 end
  320. end
  321.  
  322. print([[<font color="#FADE55"><b>[~Tribo Admin]</b></font> <N>Module carregado com sucesso!]]);
Advertisement
Add Comment
Please, Sign In to add comment