Advertisement
Tectoon

[TFM] Definições do cafofo

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