Advertisement
Guest User

Transformice - luaTroller

a guest
Jan 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 32.10 KB | None | 0 0
  1. -- luaTroller SCRIPT v.1.0.0
  2. -- Author: Boxofkrain#0000 | Last edit: 22.01.2019
  3.  
  4. -- WARTOŚCI DO EDYCJI
  5. rainbowColors = {"FF0000", "00FF00", "FFFF00", "2222FF", "FF00FF"} -- Kolory RGB użyte w funckji "Tęcza"
  6. blackScreenColor = "111111"  -- Dokładny kolor RGB czarnego ekranu w funkcji "Czarny ekran"
  7. whiteScreenColor = "FFFFFF"  -- Dokładny kolor RGB białego ekranu w funkcji "Biały ekran"
  8. snowTime = 60  -- Czas padania śniegu w sekundach w fukcji "Śnieg"
  9.  
  10. flyPower = 55  -- Moc wypchnięcia w górę w funkcji "Latanie"
  11. speedNmPower = 70  -- Siła wypchnięcia na boki w funckji "Prędkość NM"
  12. autoSpeedPower = 90  -- Siła wypchnięcia na boki w funkcji "AutoPrędkość"
  13. explosionsPower = 15  -- Siła eksplozji w funkcji "Eksplozje"
  14. explosionsRange = 60  -- Zasięg eksplozji w funkcji "Eksplozje"
  15. explosionsMarginX = 40  -- Margines losowości miejsca wybuchów w osi X w funkcji "Eksplozje"
  16. explosionsMarginY = 40  -- Margines losowości miejsca wybuchów w osi Y w funkcji "Eksplozje"
  17. minGravityPower = 50  -- Siła ujemnej grawitacji w funkcji "- Grawitacja"
  18.  
  19. defaultObjectAngle = 0  -- Domyślny kąt obiektów
  20. defaultObjectVX = 0  -- Domyślna prędkość obiektów w prawo
  21. defaultObjectVY = 0  -- Domyślna prędkość obiektów w dół
  22.  
  23. controlKeys = {85, 72, 74, 75}  -- ID klawiszy sterowania w funkcji "Sterowanie" (U, J, H, K)
  24. speedKeys = {77, 78}  -- ID klawiszy prędkości w fukcji "Prędkość NM" (M, N)
  25.  
  26. uiStartCom = "UI"  -- Komenda otwierająca menu
  27. uiMenuColor = "222222"  -- Kolor RGB menu
  28. uiMenuBorderColor = "222222"  -- Kolor RGB ramki menu
  29. uiFontColor = "DBDBDB"  -- Kolor RGB czcionki menu
  30. uiMenuTransparency = 0.7  -- Przezroczystość menu (alfa)
  31. messageWindowTime = 2200  -- Czas pokazywania okienka informacyjnego w milisekundach
  32. -----------
  33.  
  34. -- VARIABLES
  35. menuTextVisual = "<font color='#" .. uiFontColor .. "'><font size='14'>Wizualne:</font>\n\n<a href='event:nameColor'>Kolor nazwy</a>\n<a href='event:rainbow'>Tęcza</a>\n<a href='event:blackScreen'>Czarny ekran</a>\n<a href='event:whiteScreen'>Biały ekran</a>\n<a href='event:particles'>Cząsteczki</a>\n<a href='event:snow'>Śnieg</a>\n<a href='event:mapName'>Nazwa mapy</a>\n<a href='event:shamanName'>Nazwa szamana</a>\n\n<p align='center'><a href='event:hideVisualMenu'>↑ Schowaj ↑</a></p>"
  36. menuTextMovement = "<font color='#" .. uiFontColor .. "'><font size='14'>Ruch:</font>\n\n<a href='event:fly'>Latanie</a>\n<a href='event:teleport'>Teleport</a>\n<a href='event:speedNM'>Prędkość (NM)</a>\n<a href='event:autoSpeed'>AutoPrędkość</a>\n<a href='event:lockMove'>Blokada ruchu</a>\n<a href='event:control'>Sterowanie</a>\n<a href='event:autoExplosions'>Eksplozje</a>\n<a href='event:minGravity'>- Grawitacja</a>\n\n<p align='center'><a href='event:hideMovementMenu'>↑ Schowaj ↑</a></p>"
  37. menuTextPlayer = "<font color='#" .. uiFontColor .. "'><font size='14'>Gracz:</font>\n\n<a href='event:giveCheese'>Serek</a>\n<a href='event:autowin'>Wygrana</a>\n<a href='event:ice'>Zamrożenie</a>\n<a href='event:shaman'>Szaman</a>\n<a href='event:respawn'>Ożywienie</a>\n<a href='event:disappear'>Zniknięcie</a>\n<a href='event:playEmote'>Czynność</a>\n<a href='event:cage'>Klatka</a>\n\n<p align='center'><a href='event:hidePlayerMenu'>↑ Schowaj ↑</a></p>"
  38. menuTextObjects = "<font color='#" .. uiFontColor .. "'><font size='14'>Obiekty:</font>\n\n<a href='event:newObject'>Obiekt</a>\n<a href='event:newGround'>Grunt</a>\n<a href='event:autoSpawn'>AutoSpawn</a>\n<a href='event:newSpawn'>Spawn</a>\n<a href='event:removeObjects'>Usuń obiekty</a>\n<a href='event:removeGround'>Usuń grunty</a>\n\n\n\n<p align='center'><a href='event:hideObjectMenu'>↑ Schowaj ↑</a></p>"
  39.  
  40. scriptVersion = "1.0.0"
  41.  
  42. i = 1
  43. roomObjects = {}
  44. disappearPlayers = {}
  45. playerGrounds = {}
  46. groundParameters1 = {type=10, width=15, height=60}
  47. groundParameters2 = {type=10, width=60, height=15}
  48.  
  49. -- FUNCTIONS
  50. function showUi(menuNumber)
  51.   if (menuNumber==0) then ui.addTextArea(0, menuTextVisual, adm, 5, 25, 100, 170, "0x" .. uiMenuColor, "0x" .. uiMenuBorderColor, uiMenuTransparency, true)
  52.   elseif (menuNumber==1) then ui.addTextArea(1, menuTextMovement, adm, 120, 25, 100, 170, "0x" .. uiMenuColor, "0x" .. uiMenuBorderColor, uiMenuTransparency, true)
  53.   elseif (menuNumber==2) then ui.addTextArea(2, menuTextPlayer, adm, 235, 25, 100, 170, "0x" .. uiMenuColor, "0x" .. uiMenuBorderColor, uiMenuTransparency, true)
  54.   elseif (menuNumber==3) then ui.addTextArea(3, menuTextObjects, adm, 350, 25, 100, 170, "0x" .. uiMenuColor, "0x" .. uiMenuBorderColor, uiMenuTransparency, true)
  55.   elseif (menuNumber==nil) then
  56.     ui.addTextArea(0, menuTextVisual, adm, 5, 25, 100, 170, "0x" .. uiMenuColor, "0x" .. uiMenuBorderColor, uiMenuTransparency, true)
  57.     ui.addTextArea(1, menuTextMovement, adm, 120, 25, 100, 170, "0x" .. uiMenuColor, "0x" .. uiMenuBorderColor, uiMenuTransparency, true)
  58.     ui.addTextArea(2, menuTextPlayer, adm, 235, 25, 100, 170, "0x" .. uiMenuColor, "0x" .. uiMenuBorderColor, uiMenuTransparency, true)
  59.     ui.addTextArea(3, menuTextObjects, adm, 350, 25, 100, 170, "0x" .. uiMenuColor, "0x" .. uiMenuBorderColor, uiMenuTransparency, true)
  60.   end
  61. end
  62.  
  63. function showMessage(text, err)
  64.   if (err==true) then ui.addTextArea(5, "<R>" .. text .. "</R>", adm, 550, 365, 250, 35, 0x222222, 0x222222, 0.7, true)
  65.   else ui.addTextArea(5, "<font color='#00cc00'>" .. text .. "</font>", adm, 550, 365, 250, 35, 0x222222, 0x222222, 0.7, true) end
  66.   messageWindowActive = true
  67. end
  68.  
  69. function bindKeys(keysArr, player)
  70.   if (player=="*") then
  71.     for n in next, tfm.get.room.playerList do
  72.       for _,v in pairs(keysArr) do system.bindKeyboard(n, v, true) end
  73.     end
  74.   else for _,v in pairs(keysArr) do system.bindKeyboard(player, v, true) end end
  75. end
  76.  
  77. function playerExists(player, pSelect)
  78.   for n in next, tfm.get.room.playerList do
  79.     if (pSelect==true and player=="*" or pSelect==true and player=="") then return true
  80.     elseif (n==player) then
  81.       return true
  82.     end
  83.   end
  84.   return false
  85. end
  86. ------------
  87.  
  88. function eventChatCommand(n,c)
  89.   if (c:upper()==uiStartCom and adm==nil or c:upper()==uiStartCom and adm==n) then adm=n showUi() end  
  90. end
  91.  
  92. function eventTextAreaCallback(id, n, ev)
  93.   if (adm==n and id==0) then
  94.     if (ev=="nameColor") then ui.addPopup(1, 2, "[KOLOR NAZWY]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  95.     elseif (ev=="rainbow") then
  96.       if (actRainbow==nil) then ui.addPopup(2, 2, "[TĘCZA]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  97.       else actRainbow = nil ui.removeTextArea(4) showMessage("Tęcza wyłączona", true) end
  98.     elseif (ev=="blackScreen") then
  99.       if (blackScreen==nil) then ui.addPopup(3, 2, "[BLACKSCREEN]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  100.       else blackScreen = nil ui.removeTextArea(4) showMessage("Czarny ekran wyłączony", true) end
  101.     elseif (ev=="whiteScreen") then
  102.       if (whiteScreen==nil) then ui.addPopup(4, 2, "[WHITESCREEN]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  103.       else whiteScreen = nil ui.removeTextArea(4) showMessage("Biały ekran wyłączony", true) end
  104.     elseif (ev=="particles") then
  105.       if (actParticles==nil) then ui.addPopup(5, 2, "[CZĄSTECZKI]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  106.       else actParticles = nil showMessage("Cząsteczki wyłączone", true) end
  107.     elseif (ev=="snow") then tfm.exec.snow(snowTime) showMessage("Śnieg aktywowany")
  108.     elseif (ev=="mapName") then ui.addPopup(6, 2, "[NAZWA_MAPY]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  109.     elseif (ev=="shamanName") then ui.addPopup(7, 2, "[NAZWA_SZAMANA]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  110.     elseif (ev=="hideVisualMenu") then ui.addTextArea(0, "<p align='center'><a href='event:showVisualMenu'>↓ Wizualne ↓</a></p>", adm, 5, 25, 100, 20, 0x222222, 0x222222, 0.7, true)
  111.     elseif (ev=="showVisualMenu") then showUi(0) end
  112.   elseif (adm==n and id==1) then
  113.     if (ev=="autoSpeed") then
  114.       if (actAutoSpeed==nil) then ui.addPopup(8, 2, "[AUTO_PRĘDKOŚĆ]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  115.       else actAutoSpeed = nil showMessage("AutoPrędkość wyłączona", true) end
  116.     elseif (ev=="fly") then
  117.       if (actFly==nil) then ui.addPopup(9, 2, "[LATANIE]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  118.       else actFly = nil showMessage("Latanie wyłączone", true) end
  119.     elseif (ev=="teleport") then
  120.       if (actTp==nil) then ui.addPopup(10, 2, "[TELEPORT]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  121.       else actTp = nil showMessage("Teleport wyłączony", true) end
  122.     elseif (ev=="speedNM") then
  123.       if (actSpeedNM==nil) then ui.addPopup(11, 2, "[PRĘDKOŚĆ_NM]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  124.       else actSpeedNM = nil showMessage("Prędkość NM wyłączona", true) end
  125.     elseif (ev=="lockMove") then
  126.       if (actLockMove==nil) then ui.addPopup(12, 2, "[ZABLOKUJ_RUCH]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  127.       else actLockMove = nil showMessage("Blokada ruchu wyłączona", true) end
  128.     elseif (ev=="control") then
  129.       if (actControl==nil) then ui.addPopup(13, 2, "[ZDALNE_STEROWANIE]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  130.       else actControl = nil showMessage("Zdalne sterowanie wyłączone", true) end
  131.     elseif (ev=="autoExplosions") then
  132.       if (actAutoExplosions==nil) then ui.addPopup(15, 2, "[EKSPLOZJE]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  133.       else actAutoExplosions = nil showMessage("Eksplozje wyłączone", true) end
  134.     elseif (ev=="minGravity") then
  135.       if (actMinGravity==nil) then ui.addPopup(22, 2, "[-GRAWITACJA]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  136.       else actMinGravity = nil showMessage("- Grawitacja wyłączona", true) end   
  137.     elseif (ev=="hideMovementMenu") then ui.addTextArea(1, "<p align='center'><a href='event:showMovementMenu'>↓ Ruch ↓</a></p>", adm, 120, 25, 100, 20, 0x222222, 0x222222, 0.7, true)
  138.     elseif (ev=="showMovementMenu") then showUi(1) end
  139.   elseif (adm==n and id==2) then
  140.     if (ev=="giveCheese") then ui.addPopup(16, 2, "[SEREK]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  141.     elseif (ev=="autowin") then ui.addPopup(17, 2, "[WYGRANA]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  142.     elseif (ev=="ice") then ui.addPopup(18, 2, "[ZAMROŻENIE]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  143.     elseif (ev=="shaman") then ui.addPopup(19, 2, "[SZAMAN]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  144.     elseif (ev=="respawn") then ui.addPopup(20, 2, "[OŻYWIENIE]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)   
  145.     elseif (ev=="cage") then
  146.       if (actCage==nil) then ui.addPopup(21, 2, "[KLATKA]\nNazwa gracza", adm, 270, 150, 250, true)
  147.       else actCage=nil for i=0,3 do tfm.exec.removePhysicObject(i) end showMessage("Klatka wyłączona", true)
  148.       end
  149.     elseif (ev=="disappear") then
  150.       if (actDisappear==nil) then ui.addPopup(23, 2, "[ZNIKNIĘCIE]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  151.       else
  152.         actDisappear = nil
  153.         if (disappearTarget~="*") then tfm.exec.killPlayer(disappearTarget) tfm.exec.respawnPlayer(disappearTarget)
  154.         else for n in next, tfm.get.room.playerList do tfm.exec.killPlayer(n) tfm.exec.respawnPlayer(n) end end
  155.         showMessage("Zniknięcie wyłączone", true)
  156.       end
  157.     elseif (ev=="playEmote") then ui.addPopup(24, 2, "[CZYNNOŚĆ]\nNazwa gracza / Wszyscy = *", adm, 270, 150, 250, true)
  158.     elseif (ev=="hidePlayerMenu") then ui.addTextArea(2, "<p align='center'><a href='event:showPlayerMenu'>↓ Gracz ↓</a></p>", adm, 235, 25, 100, 20, 0x222222, 0x222222, 0.7, true)
  159.     elseif (ev=="showPlayerMenu") then showUi(2) end
  160.   elseif (adm==n and id==3) then
  161.     if (ev=="newObject") then
  162.       if (actObject==nil) then ui.addPopup(26, 2, "[OBIEKT]\nNumer obiektu", adm, 270, 150, 250, true)
  163.       else actObject = nil showMessage("Spawn obiektów wyłączony", true) end
  164.     elseif (ev=="removeObjects") then
  165.       for k in pairs(tfm.get.room.objectList) do table.insert(roomObjects, k) end
  166.       for _,v in pairs(roomObjects) do tfm.exec.removeObject(v) end
  167.       showMessage("Wszystkie obiekty usunięte", true)
  168.     elseif (ev=="newGround") then
  169.       if (actGround==nil) then ui.addPopup(27, 2, "[GRUNT]\nNumer gruntu", adm, 270, 150, 250, true)
  170.       else actGround = nil end
  171.     elseif (ev=="removeGround") then
  172.       for k in ipairs(playerGrounds) do tfm.exec.removePhysicObject(k) end
  173.       showMessage("Wszystkie grunty usunięte", true)
  174.     elseif (ev=="newSpawn") then
  175.       if (actSpawn==nil) then ui.addPopup(30, 2, "[SPAWN]\nNumer obiektu do spawnowania", adm, 270, 150, 250, true)
  176.       else actSpawn = nil showMessage("Spawn wyłączony", true) spawnX = nil spawnY = nil end
  177.     elseif (ev=="autoSpawn") then
  178.       if (actAutoSpawn==nil) then ui.addPopup(31, 2, "[AUTO_SPAWN]\nNumer obiektu do spawnowania", adm, 270, 150, 250, true)
  179.       else actAutoSpawn = nil showMessage("AutoSpawn wyłączony", true) end
  180.     elseif (ev=="hideObjectMenu") then ui.addTextArea(3, "<p align='center'><a href='event:showObjectMenu'>↓ Obiekty ↓</a></p>", adm, 350, 25, 100, 20, 0x222222, 0x222222, 0.7, true)
  181.     elseif (ev=="showObjectMenu") then showUi(3) end
  182.   end
  183. end
  184.  
  185. function eventPopupAnswer(id, n, reply)
  186.   if (adm==n) then
  187.     if (id==1) then
  188.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  189.       elseif (reply~="") then
  190.         nameColorTarget = reply
  191.         ui.showColorPicker(2, adm, nil, "Kolor nazwy")
  192.       end
  193.     elseif (id==2) then
  194.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  195.       elseif (reply~="") then
  196.         rainbowTarget = reply
  197.         actRainbow = true
  198.         if (reply=="*") then showMessage("Tęcza aktywowana dla wszystkich graczy")
  199.         else showMessage("Tęcza aktywowana dla gracza " .. reply) end
  200.       end
  201.     elseif (id==3) then
  202.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  203.       elseif (reply~="") then
  204.         blackScreen = true
  205.         if (reply=="*") then
  206.           for n in next, tfm.get.room.playerList do ui.addTextArea(4, "", n, -400, -200, 1600, 1200, "0x" .. blackScreenColor) end     
  207.         else ui.addTextArea(4, "", reply, -400, -200, 1600, 1200, "0x" .. blackScreenColor) end
  208.         if (reply=="*") then showMessage("Czarny ekran aktywowany dla wszystkich graczy")
  209.         else showMessage("Czarny ekran aktywowany dla gracza " .. reply) end
  210.       end
  211.     elseif (id==4) then
  212.       if (not(playerExists(reply, true))) then playerError(reply)
  213.       elseif (reply~="") then
  214.         whiteScreen = true
  215.         if (reply=="*") then
  216.           for n in next, tfm.get.room.playerList do ui.addTextArea(4, "", n, -400, -200, 1600, 1200, "0x" .. whiteScreenColor) end     
  217.         else ui.addTextArea(4, "", reply, -400, -200, 1600, 1200, "0x" .. whiteScreenColor) end
  218.         if (reply=="*") then showMessage("Biały ekran aktywowany dla wszystkich graczy")
  219.         else showMessage("Biały ekran aktywowany dla gracza " .. reply) end
  220.       end
  221.     elseif (id==5) then
  222.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  223.       elseif (reply~="") then
  224.         actParticles = true
  225.         particlesTarget = reply
  226.         if (reply=="*") then showMessage("Cząsteczki aktywowane dla wszystkich graczy")
  227.         else showMessage("Cząsteczki aktywowane dla gracza " .. reply) end
  228.       end
  229.     elseif (id==6) then
  230.       ui.setMapName(reply)
  231.       showMessage("Nazwa mapy zmieniona na " .. reply)
  232.     elseif (id==7) then
  233.       ui.setShamanName(reply)
  234.       showMessage("Nazwa szamana zmieniona na " .. reply)
  235.     elseif (id==8) then
  236.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  237.       elseif (reply~="") then
  238.         autoSpeedTarget = reply
  239.         actAutoSpeed = true
  240.         if (reply=="*") then showMessage("AutoPrędkość aktywowana dla wszystkich graczy")
  241.         else showMessage("AutoPrędkość aktywowana dla gracza " .. reply) end
  242.       end
  243.     elseif (id==9) then
  244.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  245.       elseif (reply~="") then
  246.         actFly = true
  247.         flyTarget = reply
  248.         if (reply=="*") then bindKeys({32}, "*") showMessage("Latanie aktywowane dla wszystkich graczy")
  249.         else bindKeys({32}, reply) showMessage("Latanie aktywowane dla gracza " .. reply) end
  250.       end
  251.     elseif (id==10) then
  252.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  253.       elseif (reply~="") then
  254.         actTp = true
  255.         tpTarget = reply
  256.         if (reply=="*") then
  257.           for n in next, tfm.get.room.playerList do system.bindMouse(n, true) end
  258.           showMessage("Teleport aktywowany dla wszystkich graczy")
  259.         else
  260.           system.bindMouse(reply, true)
  261.           showMessage("Teleport aktywowany dla gracza " .. reply)
  262.         end
  263.       end
  264.     elseif (id==11) then
  265.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  266.       elseif (reply~="") then
  267.         actSpeedNM = true
  268.         speedNMTarget = reply
  269.         bindKeys(speedKeys, speedNMTarget)
  270.         if (reply=="*") then showMessage("Prędkość NM aktywowana dla wszystkich graczy")
  271.         else showMessage("Prędkość NM aktywowana dla gracza " .. reply) end
  272.       end
  273.     elseif (id==12) then
  274.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  275.       elseif (reply~="") then
  276.         actLockMove = true
  277.         lockMoveTarget = reply
  278.         if (reply=="*") then showMessage("Blokada ruchu aktywowana dla wszystkich graczy")
  279.         else showMessage("Blokada ruchu aktywowana dla gracza " .. reply) end
  280.       end
  281.     elseif (id==13) then
  282.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  283.       elseif (reply~="") then
  284.         ui.addPopup(14, 2, "[ZDALNE_STEROWANIE]\nSiła", adm, 270, 150, 250, true)
  285.         actControl = true
  286.         controlTarget = reply
  287.       end
  288.     elseif (id==14) then
  289.       controlPower=reply
  290.       bindKeys(controlKeys, adm)
  291.       if (controlTagret=="*") then showMessage("Sterowanie aktywowane dla wszystkich graczy (siła: " .. reply .. ")")
  292.       else showMessage("Sterowanie aktywowane dla gracza " .. reply .. " (siła: " .. controlPower ..")") end
  293.     elseif (id==15) then
  294.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  295.       elseif (reply~="") then
  296.         autoExplosionsTarget = reply
  297.         actAutoExplosions = true
  298.         if (reply=="*") then showMessage("Eksplozje aktywowane dla wszystkich graczy")
  299.         else showMessage("Eksplozje aktywowane dla gracza " .. reply) end
  300.       end
  301.     elseif (id==16) then
  302.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  303.       elseif (reply~="") then
  304.         if (reply~="*") then
  305.           tfm.exec.giveCheese(reply)
  306.           showMessage("Serek wręczony graczowi " .. reply)
  307.         else
  308.           for n in next, tfm.get.room.playerList do tfm.exec.giveCheese(n) end
  309.           showMessage("Serek wręczony wszystkim graczom")
  310.         end
  311.       end
  312.     elseif (id==17) then
  313.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  314.       elseif (reply~="") then
  315.         if (reply~="*") then
  316.           tfm.exec.giveCheese(reply)
  317.           tfm.exec.playerVictory(reply)
  318.           showMessage("Wygrana wręczona graczowi " .. reply)
  319.         else
  320.           for n in next, tfm.get.room.playerList do
  321.             tfm.exec.giveCheese(n)
  322.             tfm.exec.playerVictory(n)
  323.           end
  324.           showMessage("Wygrana wręczona wszystkim graczom")
  325.         end
  326.       end
  327.     elseif (id==18) then
  328.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  329.       elseif (reply~="") then
  330.         if (reply~="*") then
  331.           currentFreezeX = tfm.get.room.playerList[reply].x
  332.           currentFreezeY = tfm.get.room.playerList[reply].y
  333.           tfm.exec.addShamanObject(54, currentFreezeX, currentFreezeY)
  334.           tfm.exec.killPlayer(reply)
  335.           showMessage("Zamrożono gracza " .. reply)
  336.         else
  337.           currentFreezeX = {}
  338.           currentFreezeY = {}
  339.           for n in next, tfm.get.room.playerList do
  340.             currentFreezeX[n] = tfm.get.room.playerList[n].x
  341.             currentFreezeY[n] = tfm.get.room.playerList[n].y
  342.             tfm.exec.addShamanObject(54, currentFreezeX[n], currentFreezeY[n])
  343.             tfm.exec.killPlayer(n)
  344.           end
  345.           showMessage("Zamrożono wszystkich graczy")
  346.         end
  347.       end
  348.     elseif (id==19) then
  349.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  350.       elseif (reply~="") then
  351.         if (reply~="*") then
  352.           tfm.exec.setShaman(reply)
  353.           showMessage("Szaman wręczony graczowi " .. reply)
  354.         else
  355.           for n in next, tfm.get.room.playerList do tfm.exec.setShaman(n) end
  356.           showMessage("Szaman wręczony wszystkim graczom")
  357.         end
  358.       end
  359.     elseif (id==20) then
  360.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  361.       elseif (reply~="") then
  362.         if (reply~="*") then
  363.           tfm.exec.respawnPlayer(reply)
  364.           showMessage("Ożywiono gracza " .. reply)
  365.         else
  366.           for n in next, tfm.get.room.playerList do tfm.exec.respawnPlayer(n) end
  367.           showMessage("Ożywiono wszystkich graczy")
  368.         end
  369.       end  
  370.     elseif (id==21) then
  371.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  372.       elseif (reply~="" and reply~="*") then
  373.         actCage = true
  374.         currentCageX = tfm.get.room.playerList[reply].x
  375.         currentCageY = tfm.get.room.playerList[reply].y
  376.         tfm.exec.addPhysicObject(0, currentCageX-25, currentCageY, groundParameters1)
  377.         tfm.exec.addPhysicObject(1, currentCageX, currentCageY-25, groundParameters2)
  378.         tfm.exec.addPhysicObject(2, currentCageX+25, currentCageY, groundParameters1)
  379.         tfm.exec.addPhysicObject(3, currentCageX, currentCageY+25, groundParameters2)
  380.         tfm.exec.movePlayer(reply, currentCageX, currentCageY, false, 1, 1)
  381.         showMessage("Klatka aktywowana dla gracza " .. reply)      
  382.       end
  383.     elseif (id==22) then
  384.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  385.       elseif (reply~="") then
  386.         actMinGravity = true
  387.         minGravityTarget = reply
  388.         if (reply=="*") then showMessage("- Grawitacja aktywowana dla wszystkich graczy")
  389.         else showMessage("- Grawitacja aktywowana dla gracza " .. reply) end
  390.       end
  391.     elseif (id==23) then
  392.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  393.       elseif (reply~="") then
  394.         actDisappear = true
  395.         disappearTarget = reply
  396.         if (reply=="*") then showMessage("Zniknięcie aktywowane dla wszystkich graczy")
  397.         else showMessage("Zniknięcie aktywowane dla gracza " .. reply) end
  398.       end
  399.     elseif (id==24) then
  400.       if (not(playerExists(reply, true))) then showMessage("Gracz " .. reply .. " nie istnieje", true)
  401.       elseif (reply~="") then
  402.         playEmoteTarget = reply
  403.         ui.addPopup(25, 2, "[CZYNNOŚĆ]\nNumer czynności (0-16)", adm, 270, 150, 250, true)      
  404.       end
  405.     elseif (id==25 and reply~="") then
  406.       if (tonumber(reply) > 0 and tonumber(reply) < 16) then
  407.         if (playEmoteTarget~="*") then
  408.           tfm.exec.playEmote(playEmoteTarget, reply)
  409.           showMessage("Emotka (" .. reply .. ") aktywowana dla gracza " .. playEmoteTarget)
  410.         else
  411.           for n in next, tfm.get.room.playerList do tfm.exec.playEmote(n, reply) end
  412.           showMessage("Emotka (" .. reply .. ") aktywowana dla wszystkich graczy")
  413.         end
  414.       else showMessage("Podany numer jest niepoprawny (0 - 16)", true) end
  415.     elseif (id==26 and reply~="") then
  416.       actObject = true
  417.       objectId = reply
  418.       system.bindMouse(adm, true)
  419.       showMessage("Obiekt (" .. reply .. ") gotowy do użycia (użyj myszki by zespawnować)")
  420.     elseif (id==27 and reply~="") then
  421.       groundId = reply
  422.       ui.addPopup(28, 2, "[GRUNT]\nSzerokość gruntu", adm, 270, 150, 250, true)
  423.     elseif (id==28 and reply~="") then
  424.       groundWidth = reply
  425.       ui.addPopup(29, 2, "[GRUNT]\nWysokość gruntu", adm, 270, 150, 250, true)
  426.     elseif (id==29 and reply~="") then
  427.       actGround = true
  428.       groundHeight = reply
  429.       system.bindMouse(adm, true)
  430.       showMessage("Kliknij gdzieś myszką, aby utworzyć w tym miejscu nowy grunt")
  431.     elseif (id==30 and reply~="") then
  432.       spawnObjectId = reply
  433.       actSpawn = true
  434.       system.bindMouse(adm, true)
  435.       showMessage("Kliknij gdzieś myszką, aby utworzyć w tym miejscu nowy spawn")
  436.     elseif (id==31 and reply~="") then
  437.       autoSpawnObjectId = reply
  438.       ui.addPopup(32, 2, "[AUTO_SPAWN]\nIlość obiektów", adm, 270, 150, 250, true)
  439.     elseif (id==32 and reply~="") then
  440.       if (tonumber(reply) > 0 and tonumber(reply) < 100) then
  441.         actAutoSpawn = true
  442.         autoSpawnObjectNumber = reply
  443.         system.bindMouse(adm, true)
  444.         showMessage("Kliknij gdzieś myszką, aby zespawnować w tym miejscu obiekty")
  445.       end
  446.     end
  447.   end
  448. end
  449.  
  450. function eventNewPlayer(n)
  451.   if (actFly==true and flyTarget=="*") then
  452.     for n in next, tfm.get.room.playerList do system.bindKeyboard(n, 32, true) end
  453.   end
  454.   if (disappearPlayers[n]) then tfm.exec.killPlayer(n) end
  455. end
  456.  
  457. function eventMouse(n, x, y)
  458.   if (n==tpTarget and actTp==true or tpTarget=="*" and actTp==true) then tfm.exec.movePlayer(n, x, y, false, 1, 1) end
  459.   if (n==adm and actObject==true) then tfm.exec.addShamanObject(objectId, x, y, defaultObjectAngle, defaultObjectVX, defaultObjectVY) end
  460.   if (n==adm and actGround==true) then
  461.     tfm.exec.addPhysicObject(#playerGrounds+1, x, y, {type=groundId,width=groundWidth,height=groundHeight})
  462.     table.insert(playerGrounds, #playerGrounds+1)
  463.   end
  464.   if (n==adm and actSpawn==true) then spawnX = x spawnY = y end
  465.   if (n==adm and actAutoSpawn==true) then
  466.     for _=0,autoSpawnObjectNumber do tfm.exec.addShamanObject(autoSpawnObjectId, x, y, defaultObjectAngle, defaultObjectVX, defaultObjectVY) end
  467.     showMessage("Obiekty zespawnowane")
  468.   end
  469. end
  470.  
  471. function eventKeyboard(n, key)
  472.   if (key==32 and n==flyTarget and actFly==true or key==32 and flyTarget=="*" and actFly==true) then tfm.exec.movePlayer(n, 0, 0, true, 0, -flyPower, true) end
  473.   if (key==speedKeys[1] and n==speedNMTarget and actSpeedNM==true or key==speedKeys[1] and speedNMTarget=="*" and actSpeedNM==true) then tfm.exec.movePlayer(n, 0, 0, true, speedNmPower, 0, true) end
  474.   if (key==speedKeys[2] and n==speedNMTarget and actSpeedNM==true or key==speedKeys[2] and speedNMTarget=="*" and actSpeedNM==true) then tfm.exec.movePlayer(n, 0, 0, true, -speedNmPower, 0, true) end
  475.  
  476.   if (n==adm) then
  477.     if (controlTarget~="*") then
  478.       if (key==controlKeys[1] and actControl==true) then tfm.exec.movePlayer(controlTarget, 0, 0, true, 0, -controlPower)
  479.       elseif (key==controlKeys[2] and actControl==true) then tfm.exec.movePlayer(controlTarget, 0, 0, true, -controlPower)
  480.       elseif (key==controlKeys[3] and actControl==true) then tfm.exec.movePlayer(controlTarget, 0, 0, true, 0, controlPower)
  481.       elseif (key==controlKeys[4] and actControl==true) then tfm.exec.movePlayer(controlTarget, 0, 0, true, controlPower, 0) end    
  482.     else
  483.       for n in next, tfm.get.room.playerList do
  484.         if (key==controlKeys[1] and actControl==true) then tfm.exec.movePlayer(n, 0, 0, true, 0, -controlPower)
  485.         elseif (key==controlKeys[2] and actControl==true) then tfm.exec.movePlayer(n, 0, 0, true, -controlPower)
  486.         elseif (key==controlKeys[3] and actControl==true) then tfm.exec.movePlayer(n, 0, 0, true, 0, controlPower)
  487.         elseif (key==controlKeys[4] and actControl==true) then tfm.exec.movePlayer(n, 0, 0, true, controlPower, 0) end
  488.       end
  489.     end
  490.   end
  491. end
  492.  
  493. function eventColorPicked(id, n, color)
  494.   if (id==2) then
  495.     if (nameColorTarget=="*") then
  496.       for n in next, tfm.get.room.playerList do tfm.exec.setNameColor(n, color) end
  497.     else tfm.exec.setNameColor(nameColorTarget, color) end
  498.     showMessage("Kolor nazwy zmienony pomyślnie")
  499.   end
  500. end
  501.  
  502. function eventLoop()
  503.   if (actRainbow==true) then
  504.     if (rainbowTarget=="*") then
  505.       for n in next, tfm.get.room.playerList do ui.addTextArea(4, "", n, -400, -200, 1600, 1200, "0x" .. rainbowColors[i]) end
  506.     else ui.addTextArea(4, "", rainbowTarget, -400, -200, 1600, 1200, "0x" .. rainbowColors[i])
  507.     end
  508.     i=i+1
  509.     if (i > #rainbowColors) then i=1 end
  510.   end
  511.   if (actParticles==true) then
  512.     if (particlesTarget=="*") then tfm.exec.displayParticle(math.random(0,42), math.random(50,750), math.random(50,350), nil, nil, nil, nil)
  513.     else tfm.exec.displayParticle(math.random(0,42), math.random(50,750), math.random(50,350), nil, nil, nil, nil, particlesTarget) end
  514.   end
  515.   if (actAutoSpeed==true) then
  516.     if (autoSpeedTarget=="*") then
  517.       for n in next, tfm.get.room.playerList do
  518.         if (tfm.get.room.playerList[n].movingRight==true) then
  519.           tfm.exec.movePlayer(n, 0, 0, true, autoSpeedPower)
  520.         elseif (tfm.get.room.playerList[n].movingLeft==true) then
  521.           tfm.exec.movePlayer(n, 0, 0, true, -autoSpeedPower)
  522.         end
  523.       end
  524.     else     
  525.       if (tfm.get.room.playerList[autoSpeedTarget].movingRight==true) then
  526.         tfm.exec.movePlayer(autoSpeedTarget, 0, 0, true, 100)
  527.       elseif (tfm.get.room.playerList[autoSpeedTarget].movingLeft==true) then
  528.         tfm.exec.movePlayer(autoSpeedTarget, 0, 0, true, -100)
  529.       end
  530.     end
  531.   end
  532.   if (actLockMove==true) then
  533.     if (lockMoveTarget~="*") then
  534.       if (currentLockMoveX==nil and currentLockMoveY==nil) then
  535.         currentLockMoveX = tfm.get.room.playerList[lockMoveTarget].x
  536.         currentLockMoveY = tfm.get.room.playerList[lockMoveTarget].y
  537.       end
  538.       tfm.exec.movePlayer(lockMoveTarget, currentLockMoveX, currentLockMoveY, false, 1, 1)
  539.     else
  540.       if (currentLockMoveX==nil and currentLockMoveY==nil) then
  541.         currentLockMoveX = {}
  542.         currentLockMoveY = {}
  543.         for n in next, tfm.get.room.playerList do
  544.           currentLockMoveX[n] = tfm.get.room.playerList[n].x
  545.           currentLockMoveY[n] = tfm.get.room.playerList[n].y
  546.         end
  547.       end
  548.       for n in next, tfm.get.room.playerList do tfm.exec.movePlayer(n, currentLockMoveX[n], currentLockMoveY[n], false, 1, 1) end
  549.     end
  550.   else currentLockMoveX=nil currentLockMoveY=nil end  
  551.   if (actAutoExplosions==true) then
  552.     if (autoExplosionsTarget~="*" and tfm.get.room.playerList[autoExplosionsTarget].isDead==false) then
  553.       currentAutoExplosionsX = tfm.get.room.playerList[autoExplosionsTarget].x
  554.       currentAutoExplosionsY = tfm.get.room.playerList[autoExplosionsTarget].y
  555.       randomMarginX = math.random(-explosionsMarginX, explosionsMarginX)
  556.       randomMarginY = math.random(-explosionsMarginY, explosionsMarginY)
  557.       tfm.exec.explosion(currentAutoExplosionsX + randomMarginX, currentAutoExplosionsY + randomMarginY, explosionsPower, explosionsRange, true)
  558.       tfm.exec.displayParticle(10, currentAutoExplosionsX + randomMarginX, currentAutoExplosionsY + randomMarginY)
  559.     else
  560.       currentAutoExplosionsX = {}
  561.       currentAutoExplosionsY = {}
  562.       randomMarginX = {}
  563.       randomMarginY = {}
  564.       for n in next, tfm.get.room.playerList do
  565.         if (tfm.get.room.playerList[n].isDead==false) then
  566.           currentAutoExplosionsX[n] = tfm.get.room.playerList[n].x
  567.           currentAutoExplosionsY[n] = tfm.get.room.playerList[n].y
  568.           randomMarginX[n] = math.random(-explosionsMarginX, explosionsMarginX)
  569.           randomMarginY[n] = math.random(-explosionsMarginY, explosionsMarginY)
  570.           tfm.exec.explosion(currentAutoExplosionsX[n] + randomMarginX[n], currentAutoExplosionsY[n] + randomMarginY[n], explosionsPower, explosionsRange, true)
  571.           tfm.exec.displayParticle(10, currentAutoExplosionsX[n] + randomMarginX[n], currentAutoExplosionsY[n] + randomMarginY[n])
  572.         end
  573.       end
  574.     end
  575.   end
  576.   if (actMinGravity==true) then
  577.     if (minGravityTarget~="*") then tfm.exec.movePlayer(minGravityTarget, 0, 0, true, 0, -minGravityPower)
  578.     else for n in next, tfm.get.room.playerList do tfm.exec.movePlayer(n, 0, 0, true, 0, -minGravityPower) end end
  579.   end
  580.   if (actDisappear==true) then
  581.     if (disappearTarget~="*") then tfm.exec.movePlayer(disappearTarget, 400, -600, nil, nil, 1)
  582.     else for n in next, tfm.get.room.playerList do tfm.exec.movePlayer(n, 400, -600, nil, nil, 1) end end
  583.   end
  584.   if (actSpawn==true and spawnX~=nil and spawnY~=nil) then
  585.     tfm.exec.addShamanObject(spawnObjectId, spawnX, spawnY, defaultObjectAngle, defaultObjectVX, defaultObjectVY)
  586.   end
  587.   if (messageWindowActive==true) then
  588.     if (messageWindowStart==nil) then messageWindowStart = os.time() end
  589.     if (os.time() > messageWindowStart + messageWindowTime) then
  590.       ui.removeTextArea(5)
  591.       messageWindowActive = nil
  592.       messageWindowStart = nil
  593.     end
  594.   end
  595. end
  596. system.disableChatCommandDisplay()
  597. showMessage("Witaj w luaTroller!\nAktualna wersja: " .. scriptVersion)
  598. print("<font color='#00bb00'>Skrypt został wczytany poprawnie!\nUżyj komendy !ui aby pokazać menu</font>")
  599.  
  600. -- by Boxofkrain#0000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement