Advertisement
podoko_Lua

Premier utilitaire [v 1.0]

Jan 12th, 2014
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.39 KB | None | 0 0
  1.    
  2.  
  3. admin =         {   "Pseudo", "Pseudo", "Pseudo" }  -- Remplacez "Pseudo" par "Votre pseudo"
  4.  
  5. mapList =   {   "@277994", "@2119048", "@3014000", "@3471523", "@4087743",
  6.                     "@3998852", "@3997006", "@423670", "@4672806", "@3758121",
  7.                     "@4160083", "@4057776", "@825035", "@469280", "@1081762",
  8.                     "@1933292", "@2734103", "@204059", "@251430", "@3464359",
  9.                     "@2746128", "@523865", "@3296031", "@3630912", "@1474189",
  10.    
  11.                 }               -- Pour ajouter vos maps : ,"@code1", "@code2"
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  --------------------------------------
  18.  --  Évitez de toucher à ce qui suit --
  19.  --------------------------------------
  20.  
  21.  
  22.  
  23.  
  24.  
  25. mapHistory =    {   0   }
  26. nbMap = 0
  27.  
  28. parametre = {   autoCheese = false, autoRez = false, autoSham = true,
  29.    
  30.                     autoNewGame = true, autoTimeLeft = true, autoScore = true,
  31.                     afkDeath = true,
  32.  
  33.                     allVamp = false, allMeep =false, allSham = false,
  34.    
  35.                     shamSkill = true , mapTime = 120
  36.    
  37.                 }
  38.  
  39. parametreJ =    {   sham="sham", cheese="cheese", vampire="vampire",
  40.                     meep="meep", kill="kill", respawn="respawn", win="win",
  41.                     fly="fly", tp="tp"
  42.  
  43.                 }
  44.  
  45.  
  46. aff =       {   lJoueurs ={} , joueur = {} , param = {}
  47.                 }
  48.  
  49. all =       {   fly = false , tp = false }
  50.  
  51.  
  52. joueur =     {}
  53. dernierProfil = {}
  54.  
  55. for k, v in pairs (tfm.get.room.playerList) do
  56.         joueur[k] = {}
  57.         joueur[k]["fly"] = false
  58.         joueur[k]["tp"] = false
  59.    
  60. end
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. for k, pseudo in pairs(admin) do
  68.         ui.addTextArea (1, "<p align='center'><b><a href='event:time'>time</a></b></p>", pseudo, 60, 30, 35, 20, 0x324650, 0x324650, 1, true)
  69.         ui.addTextArea (2, "<p align='center'><b><a href='event:joueurs'>joueurs</a></b></p>", pseudo, 110, 30, 80, 20, 0x324650, 0x324650, 1, true)
  70.         ui.addTextArea (3, "<p align='center'><b><a href='event:parametre'>paramètres</a></b></p>", pseudo, 205, 30, 80, 20, 0x324650, 0x324650, 1, true)
  71.         ui.addTextArea (4, "<p align='center'><b><a href='event:map'>map</a></b></p>", pseudo, 10, 30, 35, 20, 0x324650, 0x324650, 1, true)
  72.         ui.addTextArea (5, "<font size='15' color='#1'><b> <a href='event:-1'>&lt;  </a> <a href='event:repeat'>|| </a>  <a href='event:+1'>&gt;</a>   <a href='event:random'>R</a></b></font>", pseudo, 300, 30, 120, 20, 0,0,1, true)
  73.  
  74.         for l, m in pairs ( aff ) do
  75.             aff[l][pseudo] = false
  76.  
  77.         end
  78. end
  79.  
  80.  
  81.  
  82. function eventTextAreaCallback(id, source, callback)
  83.  
  84.         if callback == 'time' then
  85.    
  86.             ui.addPopup (0, 2, "time to set", source, 10, 70, 150, true)
  87.    
  88.    
  89.         elseif callback == 'map' then  
  90.  
  91.             ui.addPopup (1, 2, "map to play", source, 10, 70, 150, true)
  92.    
  93.  
  94.         elseif callback == 'joueurs' then
  95.  
  96.             if aff["lJoueurs"][source] == false then
  97.                 affLJoueurs ( source )
  98.             else
  99.                 effLJoueurs ( source )
  100.             end
  101.    
  102.  
  103.         elseif callback == 'parametre' then
  104.  
  105.             if aff["param"][source] == false then
  106.                 affParam( source )
  107.             else
  108.                 effParam( source )
  109.             end
  110.    
  111.  
  112.         elseif parametre[callback] ~= nil then
  113.  
  114.             paraGestion(callback,  source )
  115.             ui.updateTextArea (id, callback .. ": <a href='event:" .. callback .. "'>" .. B(parametre[callback]) .. "</a>", source )
  116.    
  117.  
  118.         elseif joueur[callback] ~= nil or callback == "all" then
  119.    
  120.             if aff["joueur"][source] then
  121.                 effJoueur ( source )
  122.                 if callback ~= dernierProfil[source] then
  123.                     eventTextAreaCallback(id, source, callback)
  124.                 end
  125.  
  126.             else
  127.                 affJoueur(source, callback)
  128.                 ui.updateTextArea (id, "<p align='center'><b><V><a href='event:" .. callback .. "'>" .. callback .. "</a></N></b></p>", source)
  129.             end
  130.    
  131.             dernierProfil[source] = callback
  132.  
  133.         elseif parametreJ[callback] ~= nil then
  134.             if dernierProfil[source] == "all" then
  135.  
  136.                 for k, v in pairs ( joueur ) do
  137.                     if all[callback] ~= nil then
  138.                         joueur[k][callback] = all[callback]
  139.                     end
  140.    
  141.                     paraJGestion ( k, callback )
  142.                 end
  143.                 all[callback] = not all[callback]
  144.             else
  145.  
  146.                 paraJGestion ( dernierProfil[source], callback )
  147.    
  148.             end
  149.  
  150.         elseif id == 5 then
  151.    
  152.             mapGestion(callback)
  153.  
  154.         end
  155.    
  156. end
  157.  
  158.  
  159.  
  160. function eventPopupAnswer (id, playerName, answer)
  161.  
  162.         if id == 0 then
  163.             tfm.exec.setGameTime(answer, true)
  164.  
  165.         elseif id == 1 then
  166.             tfm.exec.newGame(answer)
  167.  
  168.         elseif id == 3 then
  169.  
  170.             parametre["mapTime"] = answer  
  171.    
  172.         end
  173. end
  174.  
  175.  
  176.  
  177.  
  178.  
  179. function affLJoueurs(playerName)
  180.         aff["lJoueurs"][playerName] = true
  181.         if aff["param"][playerName] then
  182.             effParam ( playerName )
  183.         end
  184.         ui.addTextArea(1000, "<p align='center'><a href='event:all'>all</a></p>", playerName, 110, 65, 80, 20, 0x324650, 0x324650, 1, true)
  185.         a=1
  186.         for k, v in pairs(joueur) do
  187.             ui.addTextArea(1000+a, "<p align='center'><a href='event:" ..k.. "'>" .. k .. "</a></p>", playerName, 110-100*math.floor(a/10), 65+35*(a%10), 80, 20, 0x324650, 0x324650, 1, true)
  188.             a=a+1
  189.         end
  190. end
  191.  
  192. function effLJoueurs(playerName)
  193.         aff["lJoueurs"][playerName] = false
  194.  
  195.  
  196.         if aff["joueur"][playerName] then
  197.             effJoueur ( playerName )
  198.         end
  199.  
  200.         for k=a+1000,1000,-1 do
  201.             ui.removeTextArea(k, playerName)
  202.         end
  203. end
  204.  
  205.  
  206. function affParam(playerName)
  207.         aff["param"][playerName] = true
  208.         if aff["lJoueurs"][playerName] then
  209.             effLJoueurs ( playerName )
  210.         end
  211.  
  212.  
  213.         b=0
  214.         for k, v in pairs(parametre) do
  215.             ui.addTextArea (b+2000, k.." : <a href='event:"..k.."'>"..B(v).."</a>" , playerName, 10+150*((b-b%6)/6), 65+35*(b % 6), 135, 20, 0x324650, 0x324650, 1, true)
  216.  
  217.             b=b+1
  218.         end
  219. end
  220.  
  221.  
  222. function effParam(playerName)
  223.         aff["param"][playerName] = false
  224.         for k=b,0,-1 do
  225.             ui.removeTextArea(k+2000, playerName)
  226.         end
  227. end
  228.  
  229.  
  230.  
  231.  
  232. function affJoueur ( playerName, callback )
  233.         aff["joueur"][playerName] = true
  234.  
  235.         c = 0
  236.         for k, v in pairs ( parametreJ ) do
  237.             c = c+1
  238.             ui.addTextArea (c+3000, "<a href='event:"..v.."'>"..v.."</a>", playerName, 205, 30+35*c, 60, 20, 0x324650, 0x324650, 1, true)
  239.         end
  240.  
  241. end
  242.  
  243. function effJoueur ( playerName )
  244.         aff["joueur"][playerName] = false
  245.    
  246.         for k = c, 0, -1 do
  247.             ui.removeTextArea( k+3000, playerName )
  248.         end
  249.  
  250. end
  251.  
  252.  
  253.  
  254.  
  255. function B(v)
  256.         if type(v) == "boolean" then
  257.             if v==true then
  258.                 return "<v><b>true</b></v>"
  259.             else
  260.                 return "<r><b>false</b></r>"
  261.             end
  262.         else
  263.             return "<b>  "..v.."  </b>"
  264.         end
  265. end
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276. function paraGestion ( paraModif , playerName)
  277.    
  278.         if type(parametre[paraModif]) == "boolean" then
  279.             parametre[paraModif] = not parametre[paraModif]
  280.         end
  281.    
  282.    
  283.         if paraModif == "autoCheese" and parametre[paraModif] then
  284.             for k, v in pairs (joueur) do
  285.                 tfm.exec.giveCheese ( k )
  286.             end
  287.         elseif paraModif == "autoRez" and parametre[paraModif] then
  288.             for k, v in pairs (joueur) do
  289.                 tfm.exec.respawnPlayer ( k )
  290.             end
  291.  
  292.  
  293.  
  294.         elseif paraModif == "autoSham" then
  295.             tfm.exec.disableAutoShaman( not parametre[paraModif] )
  296.         elseif paraModif == "autoNewGame" then
  297.             tfm.exec.disableAutoNewGame ( not parametre[paraModif] )
  298.         elseif paraModif == "autoTimeLeft" then
  299.             tfm.exec.disableAutoTimeLeft ( not parametre[paraModif] )
  300.         elseif paraModif == "autoScore" then
  301.             tfm.exec.disableAutoScore ( not parametre[paraModif] )
  302.         elseif paraModif == "afkDeath" then
  303.             tfm.exec.disableAfkDeath ( not parametre[paraModif] )
  304.         elseif paraModif == "mapTime" then
  305.             ui.addPopup (3, 2, "enter default map time", playerName, 200, 200, 150, true)
  306.  
  307.  
  308.         elseif paraModif == "allVamp" and parametre[paraModif] then
  309.             for k, v in pairs ( joueur ) do
  310.                 tfm.exec.setVampirePlayer ( k )
  311.             end
  312.         elseif paraModif == "allMeep" and parametre[paraModif] then
  313.             for k, v in pairs ( joueur ) do
  314.                 tfm.exec.giveMeep ( k )
  315.             end
  316.         elseif paraModif == "allSham" and parametre[paraModif] then
  317.             for k, v in pairs ( joueur ) do
  318.                 tfm.exec.setShaman ( k )
  319.             end
  320.    
  321.    
  322.         elseif paraModif == "shamSkill" then
  323.             tfm.exec.disableAllShamanSkills ( not parametre[paraModif] )
  324.         end
  325.  
  326.    
  327.  
  328.  
  329.  
  330. end
  331.  
  332.  
  333. function paraJGestion ( playerName, action )
  334.         if action == "cheese" then
  335.             tfm.exec.giveCheese ( playerName )
  336.         elseif action == "sham" then
  337.             tfm.exec.setShaman ( playerName )
  338.         elseif action == "vampire" then
  339.             tfm.exec.setVampirePlayer ( playerName )
  340.         elseif action == "meep" then
  341.             tfm.exec.giveMeep ( playerName )
  342.         elseif action == "kill" then
  343.             tfm.exec.killPlayer ( playerName )
  344.         elseif action == "respawn" then
  345.             tfm.exec.respawnPlayer ( playerName )
  346.         elseif action == "win" then
  347.             tfm.exec.giveCheese ( playerName )
  348.             tfm.exec.playerVictory ( playerName )
  349.         elseif action == "fly" then
  350.             joueur[playerName]["fly"] = not joueur[playerName]["fly"]
  351.             tfm.exec.bindKeyboard (playerName, 32, true, joueur[playerName]["fly"])
  352.             if joueur[playerName]["fly"] then
  353.                 ui.addPopup (10, 3, "Tu peux voler, appuie sur espace :)", playerName, 400, 200, 220, true)
  354.             else
  355.                 ui.addPopup (10, 3, "Tu ne peux plus voler :(", playerName, 400, 200, 220, true)
  356.             end
  357.         elseif action == "tp" then
  358.             joueur[playerName]["tp"] = not joueur[playerName]["tp"]
  359.             system.bindMouse ( playerName, joueur[playerName]["tp"] )
  360.             if joueur[playerName]["tp"] then
  361.                 ui.addPopup (10, 3, "Tu peux te téléporter, cli clic :)", playerName, 400, 200, 200, true)
  362.             else
  363.                 ui.addPopup (10, 3, "Tu ne peux plus te téléporter :(", playerName, 400, 200, 200, true)
  364.             end
  365.  
  366.         end
  367.  
  368. end
  369.  
  370.  
  371.  
  372. function mapGestion (action)
  373.         if action == 'random' then
  374.             tfm.exec.newGame(mapList[math.random(#mapList)])
  375.  
  376.         elseif action == 'repeat' then
  377.             tfm.exec.newGame(tfm.get.room.currentMap)
  378.  
  379.         elseif action == '-1' and (nbMap + action) > 0 then
  380.             nbMap = nbMap + action
  381.             tfm.exec.newGame ( mapHistory[nbMap] )
  382.  
  383.         elseif action == '+1' and (nbMap + action) < #mapHistory then
  384.             nbMap = nbMap + action
  385.             tfm.exec.newGame ( mapHistory[nbMap] )
  386.  
  387.         end
  388. end
  389.  
  390.  
  391.  
  392.  
  393. function eventNewPlayer ( playerName )
  394.    
  395.         print ( playerName .. " vient d'entrer dans le salon \o/" )
  396.         joueur[playerName] = {}
  397.         joueur[playerName]["fly"] = all["fly"]
  398.         joueur[playerName]["tp"] = all["tp"]
  399.  
  400.         if parametre["autoRez"] then
  401.             tfm.exec.respawnPlayer ( playerName )
  402.         end
  403.  
  404. end
  405.  
  406. function eventPlayerLeft ( playerName )
  407.  
  408.         print ( playerName.. " vient de quitter le salon :(" )
  409.         joueur[playerName] = nil
  410.  
  411. end
  412.  
  413. function eventPlayerDied ( playerName )
  414.  
  415.  
  416.         if parametre["autoRez"] then
  417.             tfm.exec.respawnPlayer ( playerName )
  418.         end
  419.  
  420. end
  421.  
  422.  
  423. function eventPlayerWon ( playerName )
  424.  
  425.         if parametre["autoRez"] then
  426.    
  427.             tfm.exec.respawnPlayer ( playerName )
  428.         end
  429. end
  430.  
  431.  
  432.  
  433. function eventNewGame ()
  434.  
  435.         if tfm.get.room.currentMap ~= mapHistory[nbMap] then
  436.    
  437.             nbMap = nbMap+1
  438.             mapHistory[nbMap] = tfm.get.room.currentMap
  439.         end
  440.  
  441.         tfm.exec.setGameTime ( parametre["mapTime"] )  
  442.  
  443.         for k, v in pairs ( joueur ) do
  444.             eventPlayerRespawn ( k )
  445.         end
  446.  
  447. end
  448.  
  449.  
  450.  
  451. function eventPlayerRespawn ( playerName )
  452.  
  453.         if parametre["autoCheese"] then
  454.             tfm.exec.giveCheese ( playerName )
  455.         end
  456.         if parametre["allSham"] then
  457.             tfm.exec.setShaman ( playerName )
  458.         end
  459.         if parametre["allVamp"] then
  460.             tfm.exec.setVampirePlayer ( playerName )
  461.         end
  462.         if parametre["allMeep"] then
  463.             tfm.exec.giveMeep ( playerName )
  464.         end
  465. end
  466.  
  467.  
  468.  
  469. function eventKeyboard (playerName, keyCode, down, xPlayerPosition, yPlayerPosition)
  470.  
  471.         if keyCode == 32 then
  472.             tfm.exec.movePlayer(playerName,0,0,true,0,-50,false)
  473.         end
  474.  
  475. end
  476.  
  477. function eventMouse (playerName, xMousePosition, yMousePosition)
  478.  
  479.         tfm.exec.movePlayer(playerName,xMousePosition,yMousePosition,false,0,0,true)
  480.  
  481. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement