Advertisement
Tectoon

[TFM] Rotação com painel Definições

Sep 30th, 2015
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.97 KB | None | 0 0
  1. admin =                 {       "Tectoon", "Theapps", "Sagazgamer" }
  2.  
  3. np= tfm.exec.disableAutoNewGame(true) or {"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","6266159"}
  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.                                 end
  25.                                 if tfm.get.room.currentMap ~= mapHistory[nbMap] then
  26.    
  27.                         nbMapH = nbMapH
  28.                         mapHistory[nbMapH] = tfm.get.room.currentMap
  29.                 end
  30.  
  31.                 tfm.exec.setGameTime ( parametre["Tempo por partidas"] )  
  32.                         end
  33.                 end
  34.         end
  35. end
  36.  
  37. eventLoop(0, 0)
  38.  
  39. mapHistory =    {       0       }
  40. nbMapL = 0
  41. nbMapH = 0
  42.  
  43. parametre =     {       ["Shaman auto"] = true,
  44.    
  45.                                         ["Tempo automático"] = true, ["Pontuação"] = true,
  46.                                         ["Morte de AFK"] = true,
  47.                                         ["Habilidades"] = true , ["Tempo por partidas"] = 120
  48.  
  49.                                 }
  50.  
  51.  
  52. aff =           {       lJoueurs = {} , joueur = {} , param = {} , param = {}
  53.                                 }
  54. joueur =         {}
  55. dernierProfil = {}
  56.  
  57. for k, v in pairs (tfm.get.room.playerList) do
  58.                 joueur[k] = {}  
  59. end
  60.  
  61. for k, pseudo in pairs(admin) do
  62.                 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)
  63.                 for l, m in pairs ( aff ) do
  64.                         aff[l][pseudo] = false
  65.  
  66.                 end
  67. end
  68.  
  69. function eventTextAreaCallback(id, source, callback)
  70.  
  71.                 if callback == 'parametre' then
  72.  
  73.                         if aff["param"][source] == false then
  74.                                 affParam( source )
  75.                         else
  76.                                 effParam( source )
  77.                         end
  78.    
  79.  
  80.                 elseif parametre[callback] ~= nil then
  81.  
  82.                         paraGestion(callback,  source )
  83.                         ui.updateTextArea (id, callback .. ": <a href='event:" .. callback .. "'>" .. B(parametre[callback]) .. "</a>", source )
  84.                 end
  85.    
  86. end
  87.  
  88.  
  89.  
  90. function eventPopupAnswer (id, playerName, answer)
  91.  
  92.                 if id == 3 then
  93.  
  94.                         parametre["Tempo por partidas"] = answer  
  95.    
  96.                 end
  97. end
  98.  
  99. function affParam(playerName)
  100.                 aff["param"][playerName] = true
  101.                 if aff["lJoueurs"][playerName] then
  102.                         effLJoueurs ( playerName )
  103.                 end
  104.  
  105.  
  106.                 b=0
  107.                 for k, v in pairs(parametre) do
  108.                         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)
  109.  
  110.                         b=b+1
  111.                 end
  112. end
  113.  
  114.  
  115. function effParam(playerName)
  116.                 aff["param"][playerName] = false
  117.                 for k=b,0,-1 do
  118.                         ui.removeTextArea(k+2000, playerName)
  119.                 end
  120. end
  121.  
  122. function B(v)
  123.                 if type(v) == "boolean" then
  124.                         if v==true then
  125.                                 return "<v><b>true</b></v>"
  126.                         else
  127.                                 return "<r><b>false</b></r>"
  128.                         end
  129.                 else
  130.                         return "<b>  "..v.."  </b>"
  131.                 end
  132. end
  133.  
  134.  
  135. function paraGestion ( paraModif , playerName)
  136.    
  137.                 if type(parametre[paraModif]) == "boolean" then
  138.                         parametre[paraModif] = not parametre[paraModif]
  139.                 end
  140.    
  141.                 if paraModif == "Shaman auto" then
  142.                         tfm.exec.disableAutoShaman( not parametre[paraModif] )
  143.                 elseif paraModif == "Tempo automático" then
  144.                         tfm.exec.disableAutoTimeLeft ( not parametre[paraModif] )
  145.                 elseif paraModif == "Pontuação" then
  146.                         tfm.exec.disableAutoScore ( not parametre[paraModif] )
  147.                 elseif paraModif == "Morte de AFK" then
  148.                         tfm.exec.disableAfkDeath ( not parametre[paraModif] )
  149.                 elseif paraModif == "Tempo por partidas" then
  150.                         ui.addPopup (3, 2, "enter default map time", playerName, 200, 200, 150, true)
  151.    
  152.    
  153.                 elseif paraModif == "Habilidades" then
  154.                         tfm.exec.disableAllShamanSkills ( not parametre[paraModif] )
  155.                 end
  156.  
  157.    
  158.  
  159.  
  160.  
  161. end
  162.  
  163. function mapGestion (action)
  164.                 if action == 'random' then
  165.                         nbMapL = math.random(#mapList)
  166.                         tfm.exec.newGame(mapList[nbMapL])
  167.  
  168.                 elseif action == 'repeat' then
  169.                         tfm.exec.newGame(tfm.get.room.currentMap)
  170.  
  171.                 else
  172.                         if action == '-1' and (nbMapL + action) > 0 then
  173.                                 nbMapL = nbMapL -1
  174.                                 tfm.exec.newGame ( mapList[nbMapL] )
  175.  
  176.                         elseif action == '+1' and (nbMapL + action) <= #mapList then
  177.                                 nbMapL = nbMapL + 1
  178.                                 tfm.exec.newGame ( mapList[nbMapL] )
  179.                 end
  180.                 end
  181. end
  182.  
  183.  
  184.  
  185.  
  186. function eventPlayerLeft ( playerName )
  187.  
  188.                 print ( playerName.. " vient de quitter le salon :(" )
  189.                 joueur[playerName] = nil
  190.  
  191. end
  192.  
  193. function eventPlayerDied ( playerName )
  194.  
  195.  
  196.                 if parametre["Respawn auto"] then
  197.                         tfm.exec.respawnPlayer ( playerName )
  198.                 end
  199.  
  200. end
  201.  
  202. function isadminin ( name )
  203.                 for k, v in pairs( adminin ) do
  204.                         if name == v then
  205.                                 return true
  206.                         end
  207.                 end
  208.                 return false
  209. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement