Advertisement
Tectoon

[TFM] Treinamento Shaman V1.2

Sep 29th, 2015
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.78 KB | None | 0 0
  1. admin =                 {       "Tectoon", "Theapps", "Sagazgamer" }
  2.  
  3. np= tfm.exec.disableAutoNewGame(true) or {[[@1703644]], [[@360778]], [[@183740]], [[@4624694]], [[@2065627]], [[@1474189]], [[@1482964]], [[@626107]], [[@4530334]], [[@2593758]], [[@524924]], [[@2722183]]}
  4.  
  5. function eventLoop(a, b)
  6.     local c= 0;
  7.     table.foreach(tfm.get.room.playerList, function(i,v) c= not v.isDead and c+1 or c end)
  8.     c= (c == 0 or b <=0) and tfm.exec.newGame(np[math.random(#np)]) or nil;
  9. end
  10.  
  11. eventNewGame = function()
  12.         sh = 2
  13.         alive = 0
  14.         maxscore = 0
  15.         for i in pairs(tfm.get.room.playerList) do
  16.                 alive = alive + 1
  17.                 for l = 1,2 do
  18.                         if tfm.get.room.playerList[i].score < maxscore + 1 and sh ~= 0 then
  19.                                 sh = sh - 1
  20.                                 tfm.exec.setShaman(i)
  21.                                 tfm.exec.setPlayerScore(i, 0, false)
  22.                                 if sh == 1 then
  23.                                         tfm.exec.setNameColor(i, 0xFF1100) ------- Aonde está FFAB35 você mude para outro código, outra cor, que será a cor do shaman
  24.                                         tfm.exec.setUIMapName("Treinamento Shaman V1.2")
  25.                                 end
  26.                                 if tfm.get.room.currentMap ~= mapHistory[nbMap] then
  27.    
  28.                         nbMapH = nbMapH
  29.                         mapHistory[nbMapH] = tfm.get.room.currentMap
  30.                 end
  31.  
  32.                 tfm.exec.setGameTime ( parametre["Tempo por partidas"] )  
  33.  
  34.                 for k, v in pairs ( joueur ) do
  35.                         eventPlayerRespawn ( k )
  36.                 end
  37.                         end
  38.                 end
  39.         end
  40. end
  41.  
  42. eventLoop(0, 0)
  43.  
  44. mapHistory =    {       0       }
  45. nbMapL = 0
  46. nbMapH = 0
  47.  
  48. parametre =     {       ["Shaman auto"] = true,
  49.    
  50.                                         ["Novo mapa auto"] = true, ["Tempo automático"] = true, ["Pontuação"] = true,
  51.                                         ["Morte de AFK"] = true,
  52.  
  53.                                         ["Meep para todos"] =false, ["Todos Shaman"] = false,
  54.  
  55.                                         ["Habilidades"] = true , ["Tempo por partidas"] = 120
  56.  
  57.                                 }
  58.  
  59.  
  60. aff =           {       lJoueurs = {} , joueur = {} , param = {} , param = {}
  61.                                 }
  62. joueur =         {}
  63. dernierProfil = {}
  64.  
  65. for k, v in pairs (tfm.get.room.playerList) do
  66.                 joueur[k] = {}  
  67. end
  68.  
  69. for k, pseudo in pairs(admin) do
  70.                 ui.addTextArea (3, "<p align='center'><b><a href='event:parametre'>Definições</a></b></p>", pseudo, 10, 30, 80, 20, 0x000000, 0x324650, 0.75, true)
  71.                 for l, m in pairs ( aff ) do
  72.                         aff[l][pseudo] = false
  73.  
  74.                 end
  75. end
  76.  
  77. function eventTextAreaCallback(id, source, callback)
  78.  
  79.                 if callback == 'parametre' then
  80.  
  81.                         if aff["param"][source] == false then
  82.                                 affParam( source )
  83.                         else
  84.                                 effParam( source )
  85.                         end
  86.    
  87.  
  88.                 elseif parametre[callback] ~= nil then
  89.  
  90.                         paraGestion(callback,  source )
  91.                         ui.updateTextArea (id, callback .. ": <a href='event:" .. callback .. "'>" .. B(parametre[callback]) .. "</a>", source )
  92.                 end
  93.    
  94. end
  95.  
  96.  
  97.  
  98. function eventPopupAnswer (id, playerName, answer)
  99.  
  100.                 if id == 3 then
  101.  
  102.                         parametre["Tempo por partidas"] = answer  
  103.    
  104.                 end
  105. end
  106.  
  107. function affParam(playerName)
  108.                 aff["param"][playerName] = true
  109.                 if aff["lJoueurs"][playerName] then
  110.                         effLJoueurs ( playerName )
  111.                 end
  112.  
  113.  
  114.                 b=0
  115.                 for k, v in pairs(parametre) do
  116.                         ui.addTextArea (b+2000, k.." : <a href='event:"..k.."'>"..B(v).."</a>" , playerName, 10+185*math.floor(b/6), 65+35*(b % 6), 170, 20, 0x324650, 0x324650, 0.75, true)
  117.  
  118.                         b=b+1
  119.                 end
  120. end
  121.  
  122.  
  123. function effParam(playerName)
  124.                 aff["param"][playerName] = false
  125.                 for k=b,0,-1 do
  126.                         ui.removeTextArea(k+2000, playerName)
  127.                 end
  128. end
  129.  
  130. function B(v)
  131.                 if type(v) == "boolean" then
  132.                         if v==true then
  133.                                 return "<v><b>true</b></v>"
  134.                         else
  135.                                 return "<r><b>false</b></r>"
  136.                         end
  137.                 else
  138.                         return "<b>  "..v.."  </b>"
  139.                 end
  140. end
  141.  
  142.  
  143. function paraGestion ( paraModif , playerName)
  144.    
  145.                 if type(parametre[paraModif]) == "boolean" then
  146.                         parametre[paraModif] = not parametre[paraModif]
  147.                 end
  148.    
  149.                 if paraModif == "Shaman auto" then
  150.                         tfm.exec.disableAutoShaman( not parametre[paraModif] )
  151.                 elseif paraModif == "Novo mapa auto" then
  152.                         tfm.exec.disableAutoNewGame ( not parametre[paraModif] )
  153.                 elseif paraModif == "Tempo automático" then
  154.                         tfm.exec.disableAutoTimeLeft ( not parametre[paraModif] )
  155.                 elseif paraModif == "Pontuação" then
  156.                         tfm.exec.disableAutoScore ( not parametre[paraModif] )
  157.                 elseif paraModif == "Morte de AFK" then
  158.                         tfm.exec.disableAfkDeath ( not parametre[paraModif] )
  159.                 elseif paraModif == "Tempo por partidas" then
  160.                         ui.addPopup (3, 2, "enter default map time", playerName, 200, 200, 150, true)
  161.  
  162.  
  163.                 elseif paraModif == "Meep para todos" and parametre[paraModif] then
  164.                         for k, v in pairs ( joueur ) do
  165.                                 tfm.exec.giveMeep ( k )
  166.                         end
  167.                 elseif paraModif == "Todos Shaman" and parametre[paraModif] then
  168.                         for k, v in pairs ( joueur ) do
  169.                                 tfm.exec.setShaman ( k )
  170.                         end
  171.    
  172.    
  173.                 elseif paraModif == "Habilidades" then
  174.                         tfm.exec.disableAllShamanSkills ( not parametre[paraModif] )
  175.                 end
  176.  
  177.    
  178.  
  179.  
  180.  
  181. end
  182.  
  183. function mapGestion (action)
  184.                 if action == 'random' then
  185.                         nbMapL = math.random(#mapList)
  186.                         tfm.exec.newGame(mapList[nbMapL])
  187.  
  188.                 elseif action == 'repeat' then
  189.                         tfm.exec.newGame(tfm.get.room.currentMap)
  190.  
  191.                 else
  192.                         if action == '-1' and (nbMapL + action) > 0 then
  193.                                 nbMapL = nbMapL -1
  194.                                 tfm.exec.newGame ( mapList[nbMapL] )
  195.  
  196.                         elseif action == '+1' and (nbMapL + action) <= #mapList then
  197.                                 nbMapL = nbMapL + 1
  198.                                 tfm.exec.newGame ( mapList[nbMapL] )
  199.                 end
  200.                 end
  201. end
  202.  
  203.  
  204.  
  205.  
  206. function eventPlayerLeft ( playerName )
  207.  
  208.                 print ( playerName.. " vient de quitter le salon :(" )
  209.                 joueur[playerName] = nil
  210.  
  211. end
  212.  
  213. function eventPlayerDied ( playerName )
  214.  
  215.  
  216.                 if parametre["Respawn auto"] then
  217.                         tfm.exec.respawnPlayer ( playerName )
  218.                 end
  219.  
  220. end
  221.  
  222. function eventPlayerRespawn ( playerName )
  223.  
  224.                 if parametre["Todos Shaman"] then
  225.                         tfm.exec.setShaman ( playerName )
  226.                 end
  227.                 if parametre["Meep para todos"] then
  228.                         tfm.exec.giveMeep ( playerName )
  229.                 end
  230. end
  231.  
  232. function isadminin ( name )
  233.                 for k, v in pairs( adminin ) do
  234.                         if name == v then
  235.                                 return true
  236.                         end
  237.                 end
  238.                 return false
  239. end
  240.  
  241. function eventChatCommand(p,c)
  242.  local args={}
  243.     for i in c:gmatch('[^%s]+') do
  244.         table.insert(args,i)
  245.     end
  246.      if args[1]==[[skip]] and p==[[Sagazgamer]] then
  247.     tfm.exec.newGame(np[math.random(#np)])
  248.     tfm.exec.setUIMapName("<J> Treinamento Shaman V1.2")
  249.                 print("<J>Próximo mapa<n> Mapa carregado com sucesso!")
  250. elseif args[1]=="reset" and p==[[Sagazgamer]] then
  251.     tfm.exec.newGame(tfm.get.room.currentMap)
  252.     print("<J>Resetando Mapa...<n> Mapa resetado com sucesso!")
  253.   end
  254. end
  255.  
  256. for i,command in ipairs({"skip","reset"}) do
  257.         system.disableChatCommandDisplay(command)
  258.         end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement