FeodorKekovich

Debug 4.1

Jun 21st, 2017
1,278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 48.24 KB | None | 0 0
  1. -- быдлокод с кучей условных операторов и логических блоков для юзания карты отладки + чатбокс + карта эффектов частиц + радар --> pastebin get 8zapX0En /bin/.d.lua
  2.  
  3. local c = require('component')
  4. local ser = require('serialization')
  5. local fs = require('filesystem')
  6. local comp = require('computer')
  7. local ev = require('event')
  8. local term = require('term')
  9. local av = c.isAvailable
  10. local g = c.gpu
  11. local xOld, yOld = g.getResolution()
  12. local w, h = 30, 15
  13. local int = 1
  14. local xPart = 0
  15. local yPart = 0
  16. local zPart = 0
  17. local radarSleep = 2
  18. local timer = 1
  19. local genJoke = {  }
  20. local jokeLen = 5
  21. local textColor = '§f'
  22. local screen = 'main'
  23. local configPath = '/.deb_conf.cfg'
  24. local autorunPath = '/.autorun.lua'
  25. local work = true
  26. local colors = {green = 0x00ff45, darkGreen = 0x006600, red = 0xff0000, gray = 0x454545, white = 0xffffff, black = 0x000000}
  27. local frases = {  } -- фразы для шутника. { 'фраза1', 'фраза2' ... }
  28.  
  29. function main()
  30.     screen = 'main'
  31.     press()
  32.     g.setResolution(w,h)
  33.     g.setBackground(colors.black)
  34.     finalMenu(9,'DEBUG > MAIN')
  35.     g.fill(4,3,1,10,'│')
  36.     g.fill(17,3,1,8,'│')
  37.     g.set(4,3,  '┌─ WORLD')
  38.     g.set(4,5,  '├─ PLAYER')
  39.     g.set(4,7,  '├─ GM 1')
  40.     g.set(4,9,  '├─ GM 0')
  41.     g.set(4,11, '├─ CHAT')
  42.     g.set(4,13, '└─ CONSOLE COMMAND >>')
  43.     g.set(17,3, '┌─ WARPS')
  44.     g.set(17,5, '├─ PEX ADD')
  45.     g.set(17,7, '├─ PEX REM')
  46.     g.set(17,9, '├─ NOCLIP')
  47.     g.set(17,11,'└─ PARTS')
  48.     if not chatAccess then
  49.         g.setForeground(colors.gray)
  50.         g.set(7,11,'CHAT')
  51.     end
  52.     if not particleAccess then
  53.         g.setForeground(colors.gray)
  54.         g.set(20,11,'PARTS')
  55.     end
  56. end
  57.  
  58. function world()
  59.     screen = 'world'
  60.     finalMenu(9,'DEBUG > WORLD')
  61.     g.fill(4,3,1,10,'│')
  62.     g.fill(17,3,1,8,'│')
  63.     g.set(4,3,  '┌─ SETBLOCK')
  64.     g.set(4,5,  '├─ SETBLOCKS')
  65.     g.set(4,7,  '├─ REMITEM')
  66.     g.set(4,9,  '├─ INSITEM')
  67.     g.set(4,11, '├─ DAYRAIN')
  68.     g.set(4,13, '└─ SUMMON')
  69.     g.set(17,3, '┌─ INSITEMS')
  70.     g.set(17,5, '├─ NBTS')
  71.     g.set(17,7, '├─ SIGNS')
  72.     g.set(17,9, '├─ IMBPOTION')
  73.     g.set(17,11,'└─ SOUNDS')
  74. end
  75.  
  76. function signsMenu()
  77.     screen = 'signs'
  78.     finalMenu(9,'DEBUG > SIGNS')
  79.     g.fill(4,3,1,9, '│')
  80.     g.fill(17,3,1,3,'│')
  81.     g.set(4,3, '┌─ FREE')
  82.     g.set(4,5, '├─ BUY')
  83.     g.set(4,7, '├─ SELL')
  84.     g.set(4,9, '├─ DISPENSER')
  85.     g.set(4,11,'└─ CREATIVE')
  86.     g.set(17,3,'┌─ EDIT')
  87.     g.set(17,5,'└─ CLEAR')
  88. end
  89.  
  90. function player()
  91.     screen = 'playr'
  92.     finalMenu(9,'DEBUG > PLAYER')
  93.     g.fill(4,3,1,9, '│')
  94.     g.fill(17,3,1,9,'│')
  95.     g.set(4,3,  '┌─ INFO')
  96.     g.set(4,5,  '├─ TPA')
  97.     g.set(4,7,  '├─ TPAME')
  98.     g.set(4,9,  '├─ TPAMETO')
  99.     g.set(4,11, '└─ FREEZE')
  100.     g.set(17,3, '┌─ TPAHERE')
  101.     g.set(17,5, '├─ TPAPTOP')
  102.     g.set(17,7, '├─ SETHP')
  103.     g.set(17,9, '├─ TELLRAW')
  104.     g.set(17,11,'└─ KICK')
  105. end
  106.  
  107. function finalMenu(center,menu)
  108.     term.clear()
  109.     g.setForeground(colors.white)
  110.     g.set(27,1,'[*]')
  111.     g.set(center,1,menu)
  112.     g.set(30,1,'|||||HIDE||||||',true)
  113.     g.set(26,15,'EXIT')
  114.     g.set(14,15,'ADMS')
  115.     g.set(2,15,'MAIN')
  116.     g.setForeground(colors.green)
  117. end
  118.  
  119. function finalInputMenu(center,menu)
  120.     term.clear()
  121.     g.setForeground(colors.white)
  122.     g.set(center,1,menu)
  123.     g.setForeground(colors.green)
  124.     g.fill(1,2,30,1,'─')
  125.     term.setCursor(1,3)
  126. end
  127.  
  128. function warps()
  129.     screen = 'warps'
  130.     finalMenu(9,'DEBUG > WARPS')
  131.     if #config.warps == 0 then
  132.         g.set(1,3,'Press [+] to add the warp...')
  133.     end
  134.     g.fill(1,2,29,1,'─')
  135.     g.set(27,2,'[+]')
  136.     local startY = 2
  137.     for i = 1, #config.warps do
  138.         local warpName = config.warps[i].name
  139.         g.setForeground(colors.white)
  140.         g.set(3,i+startY,warpName)
  141.         g.setForeground(colors.green)
  142.         g.set(1,i+startY,'>')
  143.         g.setForeground(colors.gray)
  144.         g.set(28,i+startY,'x')
  145.     end
  146. end
  147.  
  148. function addWarp()
  149.     finalInputMenu(9,'WARPS > ADD')
  150.     io.write('WarpName >> ')
  151.     local newWarpName = io.read():sub(1,20)
  152.     local x,y,z = getMyCoords()
  153.     table.insert(config.warps,{ name = newWarpName, x = x, y = y, z = z })
  154.     conf_S()
  155. end
  156.  
  157. function teleportToWarp(warpId)
  158.     local x = config.warps[warpId].x
  159.     local y = config.warps[warpId].y
  160.     local z = config.warps[warpId].z
  161.     dbg.getPlayer(config.admin).setPosition(x,y,z)
  162. end
  163.  
  164. function admins()
  165.     screen = 'admns'
  166.     finalMenu(5,'DEBUG > ADMINS')
  167.     g.set(20,1,'[SCAN]')
  168.     g.setForeground(colors.white)
  169.     g.fill(1,2,29,1,'─')
  170.     g.set(14,15,'EDIT')
  171.     g.setForeground(colors.red)
  172.     term.setCursor(1,3)
  173.     local online = dbg.getPlayers()
  174.     for i = 1, #online do
  175.         local onePl = online[i]
  176.         for c = 1, #config.admins do
  177.             local oneAdm = config.admins[c]
  178.             if onePl == oneAdm then
  179.                 local x1,y1,z1 = getMyCoords()
  180.                 local x2,y2,z2 = dbg.getPlayer(oneAdm).getPosition()
  181.                 local dim = dbg.getPlayer(oneAdm).getWorld().getDimensionId()
  182.                 local dist = math.sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)
  183.                 print(oneAdm..' ('..dim..' dim, '..math.floor(dist)..'m)')
  184.             end
  185.         end
  186.     end
  187.     g.setForeground(colors.white)
  188.     print('Press "A" for refresh...')
  189. end
  190.  
  191. function editAdmins()
  192.     screen = 'edadm'
  193.     finalMenu(9,'EDIT ADMINS')
  194.     if #config.admins == 0 then
  195.         g.set(1,3,'Press [+] to add the admin...')
  196.     end
  197.     g.fill(1,2,29,1,'─')
  198.     g.set(27,2,'[+]')
  199.     local startY = 2
  200.     for i = 1, #config.admins do
  201.         g.setForeground(colors.green)
  202.         g.set(1,i+startY,'>')
  203.         g.setForeground(colors.gray)
  204.         g.set(28,i+startY,'x')
  205.         g.setForeground(colors.white)
  206.         g.set(3,i+startY,config.admins[i])
  207.     end
  208.     g.setForeground(colors.white)
  209.     g.set(1,h,' MAIN        ADMS        EXIT|')
  210. end
  211.  
  212. function addAdmin()
  213.     local newAdm = playersGet('ADMIN')
  214.     if newAdm ~= 'main' then
  215.         if testDuplet(config.admins,newAdm) then
  216.             table.insert(config.admins,newAdm)
  217.             conf_S()
  218.         end
  219.     end
  220.     g.setResolution(w,h)
  221. end
  222.  
  223. function adminScan()
  224.     local online = dbg.getPlayers()
  225.     for i = 1, #online do
  226.         local cPl = online[i]
  227.         local gm = dbg.getPlayer(cPl).getGameType()
  228.         if gm == 'creative' then
  229.             if testDuplet(config.admins,cPl) then
  230.                 table.insert(config.admins,cPl)
  231.                 conf_S()
  232.             end
  233.         end
  234.     end
  235. end
  236.  
  237. function testDuplet(mass,toTest)
  238.     for i = 1, #mass do
  239.         if toTest == mass[i] then
  240.             return false
  241.         end
  242.     end
  243.     return true
  244. end
  245.  
  246. function pexAdd()
  247.     finalInputMenu(10,'PEX > ADD')
  248.     io.write('PEX to add, or "main"\n >> ')
  249.     PEX = io.read()
  250.     if PEX ~= 'main' then
  251.         local comand = '/pex user '..config.admin..' add '..PEX
  252.         runComand(comand)
  253.     end
  254. end
  255.  
  256. function pexRem()
  257.     finalInputMenu(10,'PEX > REM')
  258.     io.write('PEX to remove, or "main"\n >> ')
  259.     PEX = io.read()
  260.     if PEX ~= 'main' then
  261.         local comand = '/pex user '..config.admin..' remove '..PEX
  262.         runComand(comand)
  263.     end
  264. end
  265.  
  266. function enterCommand()
  267.     finalInputMenu(5,'DEBUG > ENTER COMMAND')
  268.     io.write('Console Command or "main"\n >> ')
  269.     local comand = io.read()
  270.     if comand ~= 'main' then
  271.         runComand(comand)
  272.     end
  273. end
  274.  
  275. function resetChatBox()
  276.     chat.setName(config.defaultChatBoxName)
  277.     textColor = '§f'
  278. end
  279.  
  280. function chatBox()
  281.     term.clear()
  282.     g.setResolution(80,2)
  283.     g.setForeground(colors.green)
  284.     resetChatBox()
  285.     while true do
  286.         term.clear()
  287.         g.set(1,1,'CHATBOX : rename cons nick cr kk kk2 spam joke main')
  288.         io.write('\n >> ')
  289.         menuChat = io.read()
  290.         if menuChat == 'cons' then
  291.             chat.setName('§r§dSERVER§7§o')
  292.             textColor = '§d'
  293.         elseif menuChat == 'nick' then
  294.             resetChatBox()
  295.         elseif menuChat == 'rename' then
  296.             term.clear()
  297.             io.write('NEW CHATBOX NAME\n >> ')
  298.             newName = io.read()
  299.             chat.setName('§r'..newName..'§7§o')
  300.             textColor = '§f'
  301.         elseif menuChat == 'spam' then
  302.             spam()
  303.         elseif menuChat == 'kk' then
  304.             kick()
  305.         elseif menuChat == 'kk2' then
  306.             kick2()
  307.         elseif menuChat == 'cr' and particleAccess then
  308.             crash()
  309.         elseif menuChat == 'joke' then
  310.             pcall(joker)
  311.         elseif menuChat == 'main' then
  312.             break
  313.         else
  314.             chat.say(textColor..menuChat)
  315.         end
  316.     end
  317. end
  318.  
  319. function particles()
  320.     finalInputMenu(9,'PARTICLE NAME')
  321.     io.write('Particle, "wiki" or "main"\n >> ')
  322.     menuParticle = io.read()
  323.     if menuParticle ~= 'main' then
  324.         if menuParticle == 'wiki' then
  325.             printLink('http://minecraft-ru.gamepedia.com/Частицы')
  326.         else
  327.             spawn()
  328.         end
  329.     end
  330. end
  331.  
  332. function spawn()
  333.     screen = 'spawn'
  334.     press('clicks')
  335.     term.clear()
  336.     g.setResolution(80,2)
  337.     g.setForeground(colors.green)
  338.     g.set(1,1,'Particle: '..menuParticle)
  339.     g.set(33,1,'  [ STOP!! ]  ')
  340.     g.set(1,2,'[-][+]          [-][+]           [-][+]           [circle] [default]')
  341.     g.setForeground(colors.gray)
  342.     g.set(8,2,'-- power')
  343.     g.set(24,2,'-- radius')
  344.     g.set(41,2,'-- height')
  345.     spawnDefault()
  346. end
  347.  
  348. function spawnDefault()
  349.     height = 0
  350.     while screen == 'spawn' do
  351.         p.spawn(menuParticle, math.random(-xPart,xPart)-0.5, math.random(-yPart,yPart)+height, math.random(-zPart,zPart)-0.5, 0, 0, 0)
  352.         os.sleep(int)
  353.     end
  354. end
  355.  
  356. function spawn360()
  357.     height = 0
  358.     while screen == 'spawn' do
  359.         for i=0, 360 do
  360.             p.spawn(menuParticle, math.sin(math.rad(i)) * xPart-0.5, height, math.cos(math.rad(i)) * xPart-0.5)
  361.         end
  362.         os.sleep(0.00001)
  363.     end
  364. end
  365.  
  366. function spam()
  367.     chat.setName('§kqwerty')
  368.     term.clear()
  369.     g.set(35,1,'[ STOP!! ]')
  370.     while true do
  371.         local br = ev.pull(0.00001)
  372.         chat.say('§k'..math.random(100)..'qwertyqwertyqwertyqwertyqwerty')
  373.         if br == 'touch' then
  374.             link(35,1,'[ STOP!! ]')
  375.             break
  376.         end
  377.     end
  378.     resetChatBox()
  379. end
  380.  
  381. function crash()
  382.     term.clear()
  383.     g.set(35,1,'[ STOP!! ]')
  384.     while true do
  385.         local br = ev.pull(0.00001)
  386.         p.spawn('smoke',0,0,0,math.huge,math.huge,math.huge)
  387.         if br == 'touch' then
  388.             link(35,1,'[ STOP!! ]')
  389.             break
  390.         end
  391.     end
  392. end
  393.  
  394. function freeze()
  395.     while true do
  396.         local freezePlayer = playersGet('FREEZE')
  397.         fx,fy,fz = dbg.getPlayer(freezePlayer).getPosition()
  398.         if freezePlayer == 'main' then
  399.             break
  400.         else
  401.             g.set(35,1,'[ STOP freezing '..freezePlayer..'! ]')
  402.             while true do
  403.                 local br = ev.pull(0.00001)
  404.                 pcall(function() dbg.getPlayer(freezePlayer).setPosition(fx,fy,fz) end)
  405.                 if br == 'touch' then
  406.                     link(35,1,'[ STOP freezing '..freezePlayer..'! ]')
  407.                     break
  408.                 end
  409.             end
  410.         end
  411.     end
  412. end
  413.  
  414. function longStr()
  415.     local str1 = ''
  416.     local str2 = 'лолкекчебурек'
  417.     for i = 1, 2500 do
  418.         str1 = str1..str2
  419.     end
  420.     return str1
  421. end
  422.  
  423. function kick2()
  424.     term.clear()
  425.     chat.setName(' ')
  426.     g.set(35,1,'[ STOP!! ]')
  427.     local str = longStr()
  428.     while true do
  429.         local br = ev.pull(0.00001)
  430.         chat.say(str)
  431.         if br == 'touch' then
  432.             link(35,1,'[ STOP!! ]')
  433.             break
  434.         end
  435.     end
  436.     local str1 = ''
  437.     resetChatBox()
  438. end
  439.  
  440. function kick()
  441.     chat.setName(' ')
  442.     local str = longStr()
  443.     chat.say(str)
  444.     resetChatBox()
  445. end
  446.  
  447. function tellrawKick(player)
  448.     local str = longStr()
  449.     dbg.runCommand('/tellraw '..player..' '..str)
  450. end
  451.  
  452. function tellrawKickInput()
  453.     while true do
  454.         local kickPlayer = playersGet('KICK')
  455.         if kickPlayer == 'main' then
  456.             break
  457.         else
  458.             tellrawKick(kickPlayer)
  459.         end
  460.     end
  461. end
  462.  
  463. function onTimer()
  464.     local pls = r.getPlayers()
  465.     chat.setName('§r§eАнтиВаниш§7§o')
  466.     for a = 1,#pls do
  467.         if pls[a].name ~= config.admin then chat.say('§4'..pls[a].name..' §e('..math.floor(pls[a].distance)..' m.)') end
  468.     end
  469.     resetChatBox()
  470. end
  471.  
  472. function joker()
  473.     chat.setName('§r§4Шутник§63000§7§o')
  474.     if #frases ~= 0 then
  475.         for i = 1, jokeLen do
  476.             table.insert(genJoke,frases[math.random(#frases)])
  477.         end
  478.         local joke = ' --> '..table.concat(genJoke,' ')..'))0'
  479.         chat.say(joke)
  480.         genJoke = {  }
  481.     else
  482.         chat.say(' --> Чтобы сгенерировать шутку, добавьте набор фраз через запятую в массив frases = { "фраза1", "фраза2" }')
  483.     end
  484.     resetChatBox()
  485. end
  486.  
  487. function dialog(_,_,who,message)
  488.     if string.match(message,'сервер') ~= nil then
  489.         chat.setName('§r§dSERVER§7§o')
  490.         os.sleep(1)
  491.         chat.say('§dЧего тебе, '..who..'?')
  492.         resetChatBox()
  493.     elseif string.match(message,'сасай') ~= nil then
  494.         chat.setName('§r§dSERVER§7§o')
  495.         os.sleep(1)
  496.         chat.say('§dокай...')
  497.         resetChatBox()
  498.     elseif message == 'who' and who == config.admin and radarAccess then
  499.         chat.setName('§r§eАнтиВаниш§7§o')
  500.         local pl = r.getPlayers()
  501.         for p = 1, #pl do
  502.             if pl[p].name ~= config.admin then
  503.                 chat.say('§4'..pl[p].name..' §e('..math.floor(pl[p].distance)..' m.)')
  504.             end
  505.         end
  506.         resetChatBox()
  507.     elseif message == 'whereON' and who == config.admin and radarAccess then
  508.         chat.setName('§r§eАнтиВаниш§7§o')
  509.         chat.say('радар включён...')
  510.         timer = ev.timer(radarSleep,onTimer,math.huge)
  511.     elseif message == 'whereOFF' and who == config.admin and radarAccess then
  512.         chat.setName('§r§eАнтиВаниш§7§o')
  513.         chat.say('радар выключен...')
  514.         resetChatBox()
  515.         ev.cancel(timer)
  516.     end
  517. end
  518.  
  519. function autoCompletePlayer(line)
  520.     rs = {  }
  521.     for i = 1, #players do
  522.         s = players[i]:find(line)
  523.         if s == 1 then
  524.             table.insert(rs, players[i])
  525.         end
  526.     end
  527.     return rs
  528. end
  529.  
  530. function playersGet(playerAction)
  531.     term.clear()
  532.     g.setResolution(80,25)
  533.     os.sleep(0.00001)
  534.     g.setForeground(colors.green)
  535.     g.fill(1,4,80,1,'─')
  536.     g.fill(1,4,80,1,'─')
  537.     g.set(2,3,'* enter "main" for back...')
  538.     g.setForeground(colors.white)
  539.     players = dbg.getPlayers()
  540.     local startX = 1
  541.     local startY = 4
  542.     for i=1, #players do g.set(startX,startY+i,i..'. '..players[i])
  543.         if i == 20 then startX = 22 startY = -16
  544.         elseif i == 40 then startX = 44 startY = -36
  545.         elseif i == 60 then startX = 64 startY = -56
  546.         end
  547.     end
  548.     g.setForeground(colors.green)
  549.     print('NICK FOR '..playerAction..' (can use TAB)\n >> ')
  550.     term.setCursor(5,2)
  551.     local targetPlayer = term.read({}, false, autoCompletePlayer):gsub("\n", "")
  552.     return targetPlayer
  553. end
  554.  
  555. function playerInfo()  
  556.     plInf = playersGet('INFO')
  557.     if plInf ~= 'main' then
  558.         term.clear()
  559.         g.setResolution(w,h)
  560.         hp = dbg.getPlayer(plInf).getHealth()
  561.         if hp == nil then
  562.             print('Player "'..plInf..'" is offline')
  563.             os.sleep(2)
  564.         else
  565.             while true do
  566.                 local dim = dbg.getPlayer(plInf).getWorld().getDimensionName()
  567.                 local dimId = dbg.getPlayer(plInf).getWorld().getDimensionId()
  568.                 local gm = dbg.getPlayer(plInf).getGameType()
  569.                 local maxHp = dbg.getPlayer(plInf).getMaxHealth()
  570.                 local x,y,z = dbg.getPlayer(plInf).getPosition()
  571.                 local xM,yM,zM = getMyCoords()
  572.                 local dist = math.sqrt((x-xM)^2+(y-yM)^2+(z-zM)^2)
  573.                 term.clear()
  574.                 g.fill(1,2,30,1,'─')
  575.                 print(' >> Info about '..plInf..':\n\nHealth: '..math.floor(hp)..'/'..maxHp..'\nDIM: '..dim..' ('..dimId..')\nGM: '..gm..'\nX >> '..math.floor(x)..'\nY >> '..math.floor(y)..'\nZ >> '..math.floor(z)..'\ndist >> '..math.floor(dist)..'\n\nPress "R" for refresh,\nor any key to exit...')
  576.                 local _,_,_,key = ev.pull('key_down')
  577.                 if key ~= 19 then
  578.                     break
  579.                 end
  580.             end
  581.         end
  582.     end
  583. end
  584.  
  585. function tpa()
  586.     local plTpa = playersGet('TPA')
  587.     if plTpa ~= 'main' then
  588.         term.setCursor(1,2)
  589.         term.clearLine()
  590.         io.write('X >> ')
  591.         local x = io.read()
  592.         term.setCursor(12,2)
  593.         io.write('Y >> ')
  594.         local y = io.read()
  595.         term.setCursor(24,2)
  596.         io.write('Z >> ')
  597.         local z = io.read()
  598.         pcall(function() dbg.getPlayer(plTpa).setPosition(tonumber(x),tonumber(y),tonumber(z)) end)
  599.     end
  600. end
  601.  
  602. function tpaMe()
  603.     finalInputMenu(7,'COORDS FOR TPAME')
  604.     io.write('X or "main" >> ')
  605.     local x = io.read()
  606.     if x ~= 'main' then
  607.         io.write('Y >> ')
  608.         local y = io.read()
  609.         io.write('Z >> ')
  610.         local z = io.read()
  611.         pcall(function() dbg.getPlayer(config.admin).setPosition(tonumber(x),tonumber(y),tonumber(z)) end)
  612.     end
  613. end
  614.  
  615. function tpaMeTo()
  616.     while true do
  617.         local plTpaMe = playersGet('TPAMETO')
  618.         if plTpaMe == 'main' then
  619.             break
  620.         else
  621.             pcall(function() local x,y,z = dbg.getPlayer(plTpaMe).getPosition() if config.yCorrector then yCor = 100 else yCor = 0 end dbg.getPlayer(config.admin).setPosition(x,y+yCor,z) end)
  622.         end
  623.     end
  624. end
  625.  
  626. function tpaHere()
  627.     local plTpaHere = playersGet('TPAHERE')
  628.     if plTpaHere ~= 'main' then
  629.         pcall(function() local x,y,z = dbg.getPlayer(config.admin).getPosition() dbg.getPlayer(plTpaHere).setPosition(x,y,z) end)
  630.     end
  631. end
  632.  
  633. function tpaPtoP()
  634.     local plForTp = playersGet('TP')
  635.     if plForTp ~= 'main' then
  636.         local plForTpAccept = playersGet('TPACCEPT')
  637.         pcall(function() local x,y,z = dbg.getPlayer(plForTpAccept).getPosition() if config.yCorrector then yCor = 100 else yCor = 0 end dbg.getPlayer(plForTp).setPosition(x,y+yCor,z) end)
  638.     end
  639. end
  640.  
  641. function setHp()
  642.     local plSetHp = playersGet('SETHP')
  643.     if plSetHp ~= 'main' then
  644.         term.clearLine()
  645.         io.write('HEALTH >> ')
  646.         local hp = io.read()
  647.         pcall(function() dbg.getPlayer(plSetHp).setHealth(tonumber(hp)) end)
  648.     end
  649. end
  650.  
  651. function targetting(action,x,y,z)
  652.     local key = 0
  653.     term.clear()
  654.     g.setResolution(w,4)
  655.     g.setForeground(colors.gray)
  656.     g.set(15,1,'(+x) to East')
  657.     g.set(8,2,'(-z)')
  658.     g.set(15,2,'(-x)')
  659.     g.set(22,2,'(+z)')
  660.     g.set(7,3,'(-y)')
  661.     g.set(18,3,'(+y)')
  662.     g.set(1,4,'X:        Y:        Z:')
  663.     g.setForeground(colors.green)
  664.     g.set(13,1,'W') -- + x (17)
  665.     g.set(6,2,'A') -- - z (30)
  666.     g.set(13,2,'S') -- - x (31)
  667.     g.set(20,2,'D') -- + z (32)
  668.     g.set(1,3,'SHIFT') -- - y (42)
  669.     g.set(12,3,'SPACE') -- + y (57)
  670.     g.set(23,3,'ENTER-->') -- exit (28)
  671.     while true do
  672.         if action then
  673.             x, y, z = getMyCoords()
  674.         end
  675.         if key == 28 then
  676.             if action then
  677.                 term.clear()
  678.                 g.setResolution(w,h)
  679.                 break
  680.             else
  681.                 term.clear()
  682.                 g.setResolution(w,h)
  683.                 return x,y,z
  684.             end
  685.         elseif key == 17 then
  686.             x = x + 1
  687.             if action then
  688.                 dbg.getPlayer(config.admin).setPosition(x,y,z)
  689.             end
  690.         elseif key == 30 then
  691.             z = z - 1
  692.             if action then
  693.                 dbg.getPlayer(config.admin).setPosition(x,y,z)
  694.             end
  695.         elseif key == 31 then
  696.             x = x - 1
  697.             if action then
  698.                 dbg.getPlayer(config.admin).setPosition(x,y,z)
  699.             end
  700.         elseif key == 32 then
  701.             z = z + 1
  702.             if action then
  703.                 dbg.getPlayer(config.admin).setPosition(x,y,z)
  704.             end
  705.         elseif key == 42 then
  706.             y = y - 1
  707.             if action then
  708.                 dbg.getPlayer(config.admin).setPosition(x,y,z)
  709.             end
  710.         elseif key == 57 then
  711.             y = y + 1
  712.             if action then
  713.                 dbg.getPlayer(config.admin).setPosition(x,y,z)
  714.             end
  715.         end
  716.         g.set(3,4,tostring(math.floor(x)))
  717.         g.set(13,4,tostring(math.floor(y)))
  718.         g.set(23,4,tostring(math.floor(z)))
  719.         _,_,_,key = ev.pull('key_down')
  720.     end
  721. end
  722.  
  723. function getCoords(coordsAction)
  724.     io.write('X or "m", "p" >> ')
  725.     Gx = io.read()
  726.     if Gx == 'm' then
  727.         return targetting(false,getMyCoords())
  728.     elseif Gx == 'p' then
  729.         local plC = playersGet(coordsAction)
  730.         local Px, Py, Pz = dbg.getPlayer(plC).getPosition()
  731.         if Px == nil then
  732.             term.clearLine()
  733.             print(' >> Player "'..plC..'" is offline')
  734.             os.sleep(2)
  735.             term.clear()
  736.             g.setResolution(w,h)
  737.         else
  738.             term.clear()
  739.             g.setResolution(w,h)
  740.             return targetting(false,Px,Py,Pz)
  741.         end
  742.     else
  743.         Gx = tonumber(Gx)
  744.         io.write('Y >> ')
  745.         Gy = tonumber(io.read())
  746.         io.write('Z >> ')
  747.         Gz = tonumber(io.read())
  748.         if not Gx or not Gy or not Gz then
  749.             print('Uncorrect Input!')
  750.             os.sleep(2)
  751.             return nil, nil, nil
  752.         else
  753.             return targetting(false,Gx,Gy,Gz)
  754.         end
  755.     end
  756. end
  757.  
  758. function getMyCoords()
  759.     local Mx, My, Mz = dbg.getPlayer(config.admin).getPosition()
  760.     return math.floor(Mx), math.floor(My), math.floor(Mz)
  761. end
  762.  
  763. function yn()
  764.     local _,_,_,key = ev.pull('key_down')
  765.     if key == 21 then
  766.         return true
  767.     else
  768.         return false
  769.     end
  770. end
  771.  
  772. function setBlock()
  773.     finalInputMenu(7,'WORLD > SETBLOCK')
  774.     io.write('ID or "main" >> ')
  775.     id = io.read()
  776.     if id ~= 'main' then
  777.         io.write('META >> ')
  778.         meta = io.read()
  779.         x, y, z = getCoords('SETBLOCK ID:'..id..', META:'..meta)
  780.     end
  781.     local result = pcall(function() dbg.getWorld().setBlock(math.floor(tonumber(x)),math.floor(tonumber(y)),math.floor(tonumber(z)),tonumber(id),tonumber(meta)) end)
  782.     if result then
  783.         print('Clear? y/n')
  784.         if yn() then
  785.             dbg.getWorld().setBlock(math.floor(tonumber(x)),math.floor(tonumber(y)),math.floor(tonumber(z)),0,0)
  786.         end
  787.     end
  788. end
  789.  
  790. function setBlocks()
  791.     finalInputMenu(6,'WORLD > SETBLOCKS')
  792.     io.write('ID or "main" >> ')
  793.     id = io.read()
  794.     if id ~= 'main' then
  795.         io.write('META >> ')
  796.         meta = io.read()
  797.         print('1st POINT:')
  798.         xMin, yMin, zMin = getCoords('1st POINT FOR SETBLOCKS ID:'..id..', META:'..meta)
  799.         print('2nd POINT:')
  800.         xMax, yMax, zMax = getCoords('2nd POINT FOR SETBLOCKS ID:'..id..', META:'..meta)
  801.         local result = pcall(function() dbg.getPlayer(config.admin).getWorld().setBlocks(math.floor(tonumber(xMin)),math.floor(tonumber(yMin)),math.floor(tonumber(zMin)),math.floor(tonumber(xMax)),math.floor(tonumber(yMax)),math.floor(tonumber(zMax)),tonumber(id),tonumber(meta)) end)
  802.         if result then
  803.             print('Clear? y/n')
  804.             if yn() then
  805.                 dbg.getWorld().setBlocks(math.floor(tonumber(xMin)),math.floor(tonumber(yMin)),math.floor(tonumber(zMin)),math.floor(tonumber(xMax)),math.floor(tonumber(yMax)),math.floor(tonumber(zMax)),0,0)
  806.             end
  807.         end
  808.     end
  809. end
  810.  
  811. function remItem()
  812.     finalInputMenu(8,'WORLD > REMITEM')
  813.     io.write('SLOT or "main" >> ')
  814.     slot = io.read()
  815.     if slot ~= 'main' then
  816.         io.write('COUNT >> ')
  817.         count = io.read()
  818.         x, y, z = getCoords('REMITEM')
  819.         pcall(function() dbg.getWorld().removeItem(math.floor(tonumber(x)),math.floor(tonumber(y)),math.floor(tonumber(z)),tonumber(slot),tonumber(count)) end)
  820.     end
  821. end
  822.  
  823. function insItem()
  824.     finalInputMenu(8,'WORLD > INSITEM')
  825.     io.write('ID (String) or "main"\n >> ')
  826.     id = io.read()
  827.     if id ~= 'main' then
  828.         io.write('DAMAGE >> ')
  829.         dmg = io.read()
  830.         io.write('NBT (JSON) >> ')
  831.         tags = io.read()
  832.         io.write('COUNT >> ')
  833.         count = io.read()
  834.         x, y, z = getCoords('INSITEM')
  835.         pcall(function() dbg.getWorld().insertItem(id,tonumber(count),tonumber(dmg),tags,math.floor(tonumber(x)),math.floor(tonumber(y)),math.floor(tonumber(z)),1) end)
  836.     end
  837. end
  838.  
  839. function insItems()
  840.     finalInputMenu(7,'WORLD > INSITEMS')
  841.     io.write('ID (String) or "main"\n >> ')
  842.     id = io.read()
  843.     if id ~= 'main' then
  844.         io.write('DAMAGE >> ')
  845.         dmg = io.read()
  846.         io.write('SLOTS FOR INS >> ')
  847.         slots = io.read()
  848.         x, y, z = getCoords('INSITEMS')
  849.         pcall(function() for i = 1, tonumber(slots) do dbg.getWorld().insertItem(id,64,tonumber(dmg),'',math.floor(tonumber(x)),math.floor(tonumber(y)),math.floor(tonumber(z)),1) end end)
  850.     end
  851. end
  852.  
  853. function nbts()
  854.     finalInputMenu(9,'WORLD > GETNBT')
  855.     io.write('FILENAME or "main"\n >> ')
  856.     fn = io.read()
  857.     if fn ~= 'main' then
  858.         x, y, z = getCoords('NBT')
  859.         print('"1" - getNbt, "2" - setNbt')
  860.         local _,_,_,key = ev.pull('key_down')
  861.         if key == 2 then
  862.             local result = pcall(function() nbt = dbg.getWorld().getTileNBT(math.floor(tonumber(x)),math.floor(tonumber(y)),math.floor(tonumber(z))) file = io.open('/'..fn,'w'):write(ser.serialize(nbt,false)):flush():close() end)
  863.             if result then
  864.                 print('Saved in "/'..fn..'"\n\n"1" - edit, "2" - pastebin\nor press any key for exit...')
  865.                 local _,_,_,key = ev.pull('key_down')
  866.                 if key == 2 then
  867.                     g.setResolution(xOld,yOld)
  868.                     os.sleep(0.00001)
  869.                     os.execute('edit /'..fn)
  870.                     print('Set nbt at current pos? y/n')
  871.                     if yn() then
  872.                         local result = pcall(function() file = io.open('/'..fn,'r') local cr = ser.unserialize(file:read(fs.size('/'..fn))) file:close() dbg.getWorld().setTileNBT(math.floor(tonumber(x)),math.floor(tonumber(y)),math.floor(tonumber(z)),cr) end)
  873.                         if result then
  874.                             print('\nNBT setted from "/'..fn..'"')
  875.                             os.sleep(2)
  876.                         end
  877.                     end
  878.                 elseif key == 3 then
  879.                     if av('internet') then
  880.                         term.clear()
  881.                         g.setResolution(xOld,yOld)
  882.                         os.sleep(0.00001)
  883.                         g.setForeground(colors.white)
  884.                         os.execute('pastebin put /'..fn)
  885.                         g.setForeground(colors.green)
  886.                         print('\n\npress any key...')
  887.                         ev.pull('key_down')
  888.                     else
  889.                         print('\nNot found internet card!')
  890.                         os.sleep(2)
  891.                     end
  892.                 end
  893.             end
  894.         elseif key == 3 then
  895.             print('"/'..fn..'": "1" - edit,\nor any key for load...')
  896.             local _,_,_,key = ev.pull('key_down')
  897.             if key == 2 then
  898.                 g.setResolution(xOld,yOld)
  899.                 os.sleep(0.00001)
  900.                 os.execute('edit /'..fn)
  901.                 g.setResolution(w,h)
  902.                 os.sleep(0.00001)
  903.             end
  904.             local result = pcall(function() file = io.open('/'..fn,'r') local cr = ser.unserialize(file:read(fs.size('/'..fn))) file:close() dbg.getWorld().setTileNBT(math.floor(tonumber(x)),math.floor(tonumber(y)),math.floor(tonumber(z)),cr) end)
  905.             if result then
  906.                print('NBT setted from "/'..fn..'"')
  907.                os.sleep(2)
  908.             end
  909.         end
  910.     end
  911. end
  912.  
  913. function signsSet(toDo)
  914.     term.clear()
  915.     if toDo == 1 then
  916.         io.write('FREE ID > ')
  917.         id = io.read()
  918.         text1 = '§1[free]'
  919.         text2 = id
  920.         text3 = ''
  921.         text4 = ''
  922.     elseif toDo == 2 then
  923.         io.write('BUY ID > ')
  924.         id = io.read()
  925.         text1 = '§1[buy]'
  926.         text2 = '64'
  927.         text3 = id
  928.         text4 = '$1'
  929.     elseif toDo == 3 then
  930.         io.write('TEXT1 > ')
  931.         text1 = io.read()
  932.         io.write('TEXT2 > ')
  933.         text2 = io.read()
  934.         io.write('TEXT3 > ')
  935.         text3 = io.read()
  936.         io.write('TEXT4 > ')
  937.         text4 = io.read()
  938.     end
  939.     pcall(setSignText)
  940. end
  941.  
  942. function setSignText()
  943.     local x,y,z = getMyCoords()
  944.     local signNbt = dbg.getWorld().getTileNBT(x,y,z)
  945.     signNbt.value.Text1.value = text1
  946.     signNbt.value.Text2.value = text2
  947.     signNbt.value.Text3.value = text3
  948.     signNbt.value.Text4.value = text4
  949.     dbg.getWorld().setTileNBT(x,y,z,signNbt)
  950. end
  951.  
  952. function runComand(comand)
  953.     local d = dbg.getPlayer(config.admin).getWorld()
  954.     local CBName = 'Console'
  955.     local posX,posY,posZ = dbg.getPlayer(config.admin).getPosition()
  956.     d.setBlock(posX,1,posZ,137,0)
  957.     local nbtCB = d.getTileNBT(posX,1,posZ)
  958.     nbtCB.value.Command.value = comand
  959.     nbtCB.value.CustomName.value = CBName
  960.     d.setTileNBT(posX,1,posZ,nbtCB)
  961.     d.setBlock(posX,2,posZ,152,0)
  962.     os.sleep(0.5)
  963.     d.setBlocks(posX,1,posZ,posX,2,posZ,7,0)
  964. end
  965.  
  966. function keyController(_,_,_,code)
  967.     if code == 18 then
  968.         hide()
  969.     elseif code == 30 then
  970.         admins()
  971.     elseif code == 16 then
  972.         main()
  973.     elseif code == 17 then
  974.         warps()
  975.     end
  976. end
  977.  
  978. function install()
  979.     term.clear()
  980.     g.setResolution(w,h)
  981.     g.setForeground(colors.green)
  982.     g.fill(1,1,30,15,'░')
  983.     g.set(11,6,'//TOUCH//')
  984.     local _,_,_,_,_,ownerNick = ev.pull('touch')
  985.     config = { admin = ownerNick, defaultChatBoxName = '§r§k|:|§r§2'..ownerNick..'§r§k|:|§r§7§o', admins = {}, warps = {}, activeAutorun = false, activeProtection = true, yCorrector = true }
  986.     conf_S()
  987.     g.set(5,9,'Welcome, '..config.admin..'!')
  988.     os.sleep(2)
  989. end
  990.  
  991. function conf_S()
  992.     local file = io.open(configPath,'w')
  993.     file:write(ser.serialize(config,false)):flush():close()
  994. end
  995.  
  996. function conf_R()
  997.     local file = io.open(configPath,'r')
  998.     config = ser.unserialize(file:read(fs.size(configPath)))
  999.     file:close()
  1000. end
  1001.  
  1002. function lockPress()
  1003.     ev.ignore('touch',clicker)
  1004.     ev.ignore('key_down',keyController)
  1005. end
  1006.  
  1007. function press(act)
  1008.     if act == 'keys' then
  1009.         lockPress()
  1010.         ev.listen('key_down',keyController)
  1011.     elseif act == 'clicks' then
  1012.         lockPress()
  1013.         ev.listen('touch',clicker)
  1014.     elseif act == 'lock' then
  1015.         lockPress()
  1016.     else
  1017.         lockPress()
  1018.         ev.listen('touch',clicker)
  1019.         ev.listen('key_down',keyController)
  1020.     end
  1021. end
  1022.  
  1023. function link(bX,bY,button)
  1024.     g.setForeground(colors.red)
  1025.     g.set(bX,bY,button)
  1026.     os.sleep(0.3)
  1027.     g.setForeground(colors.green)
  1028.     g.set(bX,bY,button)
  1029. end
  1030.  
  1031. function hide()
  1032.     screen = 'hide'
  1033.     press('clicks')
  1034.     g.setForeground(colors.gray)
  1035.     g.set(30,1,'|||||HIDE||||||',true)
  1036.     os.sleep(0.2)
  1037.     term.clear()
  1038.     g.fill(1,1,30,15,'░')
  1039. end
  1040.  
  1041. function accessDenied(checkNick)
  1042.     if config.activeProtection then
  1043.         press('lock')
  1044.         term.clear()
  1045.         g.setResolution(w,h)
  1046.         g.setForeground(colors.red)
  1047.         g.fill(1,1,30,15,'░')
  1048.         g.set(7,6,'ACCESS DENIED!!!')
  1049.         g.set(10,9,'GOODBYE...')
  1050.         dbg.getPlayer(checkNick).setHealth(0)
  1051.         os.sleep(1)
  1052.         if particleAccess then
  1053.             p.spawn('smoke',0,0,0,math.huge,math.huge,math.huge)
  1054.         end
  1055.         tellrawKick(checkNick)
  1056.         comp.shutdown()
  1057.     end
  1058. end
  1059.  
  1060. function keysProtector(_,_,_,_,onKey)
  1061.     if onKey ~= config.admin then
  1062.         accessDenied(onKey)
  1063.     end
  1064. end
  1065.  
  1066. function touchProtector(_,_,_,_,_,onTouch)
  1067.     if onTouch ~= config.admin then
  1068.         accessDenied(onTouch)
  1069.     end
  1070. end
  1071.  
  1072. function settings()
  1073.     screen = 'setts'
  1074.     finalMenu(7,'DEBUG > SETTINGS       ')
  1075.     g.set(3,3,'AUTORUN')
  1076.     g.set(3,5,'USER PROTECT')
  1077.     g.set(3,7,'Y + 100 (TPA)')
  1078.     g.set(3,9,'[KEYBINDS]')
  1079.     g.setForeground(colors.gray)
  1080.     g.set(23,3,'▒▒▒▒')
  1081.     g.set(23,5,'▒▒▒▒')
  1082.     g.set(23,7,'▒▒▒▒')
  1083.     if config.activeAutorun then
  1084.         g.setForeground(colors.green)
  1085.         g.set(25,3,'██')
  1086.     else
  1087.         g.setForeground(colors.gray)
  1088.         g.set(23,3,'██')
  1089.     end
  1090.     if config.activeProtection then
  1091.         g.setForeground(colors.green)
  1092.         g.set(25,5,'██')
  1093.     else
  1094.         g.setForeground(colors.gray)
  1095.         g.set(23,5,'██')
  1096.     end
  1097.     if config.yCorrector then
  1098.         g.setForeground(colors.green)
  1099.         g.set(25,7,'██')
  1100.     else
  1101.         g.setForeground(colors.gray)
  1102.         g.set(23,7,'██')
  1103.     end
  1104. end
  1105.  
  1106. function saveAutorun()
  1107.     local scriptPath = debug.getinfo(2,'S').short_src
  1108.     local file = io.open(autorunPath,'w')
  1109.     file:write('os.sleep(1) os.execute("'..scriptPath..'")'):flush():close()
  1110. end
  1111.  
  1112. function swich(toSwich)
  1113.     if toSwich == 'autorun' then
  1114.         if config.activeAutorun then
  1115.             config.activeAutorun = false
  1116.             fs.remove(autorunPath)
  1117.         else
  1118.             config.activeAutorun = true
  1119.             saveAutorun()
  1120.         end
  1121.     elseif toSwich == 'protection' then
  1122.         if config.activeProtection then
  1123.             config.activeProtection = false
  1124.         else
  1125.             config.activeProtection = true
  1126.         end
  1127.     elseif toSwich == 'yCorrector' then
  1128.         if config.yCorrector then
  1129.             config.yCorrector = false
  1130.         else
  1131.             config.yCorrector = true
  1132.         end
  1133.     end
  1134.     conf_S()
  1135. end
  1136.  
  1137. function swichGamemode(gmm)
  1138.     g.setForeground(colors.red)
  1139.     if gmm == 1 then
  1140.         g.set(7,7, 'Y/N?')
  1141.     else
  1142.         g.set(7,9, 'Y/N?')
  1143.     end
  1144.     if yn() then
  1145.         runComand('/gamemode '..gmm..' '..config.admin)
  1146.     end
  1147. end
  1148.  
  1149. function imbPotion()
  1150.     local potionJson = '{CustomPotionEffects:[{Id:1,Amplifier:2.5,Duration:100000000},{Id:5,Amplifier:5500,Duration:100000000},{Id:6,Amplifier:5500,Duration:100000000},{Id:11,Amplifier:5500,Duration:100000000},{Id:12,Amplifier:5500,Duration:100000000},{Id:13,Amplifier:5500,Duration:100000000},{Id:14,Amplifier:5500,Duration:100000000},{Id:23,Amplifier:5500,Duration:100000000}],display:{Name:§r§l§aТо что доктор прописал}}'
  1151.     local x,y,z = getMyCoords()
  1152.     dbg.getPlayer(config.admin).getWorld().insertItem('minecraft:potion',1,16,potionJson,x,y,z,1)
  1153. end
  1154.  
  1155. function dayrain()
  1156.     if dbg.getWorld().isRaining() then
  1157.         dbg.getWorld().setRaining(false)
  1158.     else
  1159.         dbg.getWorld().setTime(dbg.getWorld().getTime()+12000)
  1160.     end
  1161. end
  1162.  
  1163. function printLink(link)
  1164.     local result = pcall(function() dbg.sendToClipboard(config.admin,link) end)
  1165.     if result then
  1166.         print('\n'..link..'\n(copied in ClipBoard)\n\nPress any key...')
  1167.     else
  1168.         print('\n'..link..'\n\nPress any key...')
  1169.     end
  1170.     ev.pull('key_down')
  1171. end
  1172.  
  1173. function summon()
  1174.     while true do
  1175.         finalInputMenu(8,'WORLD > SUMMON')
  1176.         io.write('MobName, "wiki" or "main"\n >> ')
  1177.         local mob = io.read()
  1178.         if mob == 'main' then
  1179.             break
  1180.         elseif mob == 'wiki' then
  1181.             printLink('http://minecraft-ru.gamepedia.com/Участник:DrakD/Summon')
  1182.         else
  1183.             io.write('Count >> ')
  1184.             local count = tonumber(io.read())
  1185.             if count == nil then
  1186.                 count = 1
  1187.             end
  1188.             io.write('JSON for '..mob..' >> ')
  1189.             local mobJson = io.read()
  1190.             local x, y, z = getCoords('SUMMON '..mob)
  1191.             local online = dbg.getPlayers()
  1192.             local checkAdm = true
  1193.             for i = 1, #online do
  1194.                 local onePl = online[i]
  1195.                 for c = 1, #config.admins do
  1196.                     local oneAdm = config.admins[c]
  1197.                     if onePl == oneAdm then
  1198.                         checkAdm = false
  1199.                         break
  1200.                     end
  1201.                 end
  1202.                 if not checkAdm then
  1203.                     break
  1204.                 end
  1205.             end
  1206.             if checkAdm then
  1207.                 for i = 1, count do
  1208.                     res1 = pcall(function() _,res2 = dbg.runCommand('/summon '..mob..' '..x..' '..y..' '..z..' '..mobJson) end)
  1209.                 end
  1210.                 if res1 then
  1211.                     print(res2)
  1212.                     os.sleep(2)
  1213.                 end
  1214.             else
  1215.                 print('Break! Admin online...')
  1216.                 os.sleep(2)
  1217.             end
  1218.         end
  1219.     end
  1220. end
  1221.  
  1222. function menuSounds()
  1223.     while true do
  1224.         finalInputMenu(8,'WORLD > SOUND')
  1225.         io.write('SoundName, "wiki" or "main"\n >> ')
  1226.         local sound = io.read()
  1227.         if sound == 'main' then
  1228.             break
  1229.         elseif sound == 'wiki' then
  1230.             printLink('http://www.gkrond.ru/Articles/Read/2/Imena_zvukov_i_rabota_komandy_playsound.html')
  1231.         else
  1232.             local x,y,z = getCoords('PLAY SOUND')
  1233.             pcall(function() dbg.getWorld().playSoundAt(x,y,z,sound,500) end)
  1234.         end
  1235.     end
  1236. end
  1237.  
  1238. function meow()
  1239.     g.setForeground(colors.green)
  1240.     g.set(17,1,'MEOW')
  1241.     local x,y,z = getMyCoords()
  1242.     dbg.getWorld().playSoundAt(x,y,z,'mob.cat.meow',100)
  1243.     g.setForeground(colors.white)
  1244.     g.set(17,1,'MAIN')
  1245. end
  1246.  
  1247. function tellraw()
  1248.     tellToPlayer = ''
  1249.     while true do
  1250.         finalInputMenu(6,'PLAYER > TELLRAW')
  1251.         io.write('JsonMessage, "pl" or "main"\n >> ')
  1252.         local message = io.read()
  1253.         if message == 'main' then
  1254.             break
  1255.         elseif message == 'pl' then
  1256.             tellToPlayer = playersGet('TELLRAW')
  1257.             g.setResolution(w,h)
  1258.         else
  1259.             dbg.runCommand('/tellraw '..tellToPlayer..' '..message)
  1260.         end
  1261.     end
  1262. end
  1263.  
  1264. function keybinds()
  1265.     screen = 'keyb'
  1266.     finalMenu(6,'SETTINGS > KEYBINDS')
  1267.     g.set(10,4, 'MAIN   [Q]')
  1268.     g.set(10,6, 'ADMINS [A]')
  1269.     g.set(10,8, 'HIDE   [E]')
  1270.     g.set(10,10,'WARPS  [W]')
  1271. end
  1272.  
  1273. function clicker(_,_,xC,yC)
  1274.     if xC >= 1  and yC >= 1  and screen == 'hide' then main()
  1275.     elseif xC == 30 and yC <= 15 and screen ~= 'spawn' then hide()
  1276.     elseif xC >= 26 and xC <= 30 and yC == 15 then link(26,yC,'EXIT') work = false
  1277.     elseif xC >= 1  and xC <= 6  and yC == 15 then link(2,yC,'MAIN') main()
  1278.     elseif xC >= 27 and xC <= 29 and yC == 1  and screen ~= 'setts' and screen ~= 'spawn' then link(27,yC,'[*]') settings()
  1279.     elseif xC >= 7  and xC <= 12 and yC == 3  and screen == 'main'  then link(7,yC,'WORLD') world()
  1280.     elseif xC >= 17 and xC <= 20 and yC == 1  and screen == 'main'  then meow()
  1281.     elseif xC >= 7  and xC <= 12 and yC == 5  and screen == 'main'  then link(7,yC,'PLAYER') player()
  1282.     elseif xC >= 7  and xC <= 10 and yC == 7  and screen == 'main'  then link(7,yC,'GM 1') press('lock') swichGamemode(1) main()
  1283.     elseif xC >= 7  and xC <= 10 and yC == 9  and screen == 'main'  then link(7,yC,'GM 0') press('lock') swichGamemode(0) main()
  1284.     elseif xC >= 7  and xC <= 11 and yC == 11 and screen == 'main'  and chatAccess then link(7,yC,'CHAT') press('lock') chatBox() main()
  1285.     elseif xC >= 20 and xC <= 24 and yC == 3  and screen == 'main'  then link(20,yC,'WARPS') warps()
  1286.     elseif xC >= 14 and xC <= 17 and yC == 15 and screen ~= 'admns' then link(14,yC,'ADMS') admins()
  1287.     elseif xC >= 20 and xC <= 25 and yC == 1  and screen == 'admns' then link(20,yC,'[SCAN]') adminScan() admins()
  1288.     elseif xC >= 14 and xC <= 17 and yC == 15 and screen == 'admns' then link(14,yC,'EDIT') editAdmins()
  1289.     elseif xC >= 20 and xC <= 26 and yC == 5  and screen == 'main'  then link(20,yC,'PEX ADD') press('lock') pexAdd() main()
  1290.     elseif xC >= 20 and xC <= 26 and yC == 7  and screen == 'main'  then link(20,yC,'PEX REM') press('lock') pexRem() main()
  1291.     elseif xC >= 20 and xC <= 25 and yC == 9  and screen == 'main'  then link(20,yC,'NOCLIP') press('lock') targetting(true) main()
  1292.     elseif xC >= 20 and xC <= 24 and yC == 11 and screen == 'main'  and particleAccess then link(20,11,'PARTS') press('lock') particles() main()
  1293.     elseif xC >= 7  and xC <= 24 and yC == 13 and screen == 'main'  then link(7,yC,'CONSOLE COMMAND >>') press('lock') enterCommand() main()
  1294.     elseif xC >= 7  and xC <= 10 and yC == 3  and screen == 'playr' then link(7,yC,'INFO') press('lock') playerInfo() main()
  1295.     elseif xC >= 7  and xC <= 10 and yC == 5  and screen == 'playr' then link(7,yC,'TPA') press('lock') tpa() main()
  1296.     elseif xC >= 7  and xC <= 11 and yC == 7  and screen == 'playr' then link(7,yC,'TPAME') press('lock') tpaMe() main()
  1297.     elseif xC >= 7  and xC <= 13 and yC == 9  and screen == 'playr' then link(7,yC,'TPAMETO') press('lock') tpaMeTo() main()
  1298.     elseif xC >= 7  and xC <= 12 and yC == 11 and screen == 'playr' then link(7,yC,'FREEZE') press('lock') freeze() main()
  1299.     elseif xC >= 20 and xC <= 26 and yC == 3  and screen == 'playr' then link(20,yC,'TPAHERE') press('lock') tpaHere() main()
  1300.     elseif xC >= 20 and xC <= 26 and yC == 5  and screen == 'playr' then link(20,yC,'TPAPTOP') press('lock') tpaPtoP() main()
  1301.     elseif xC >= 20 and xC <= 24 and yC == 7  and screen == 'playr' then link(20,yC,'SETHP') press('lock') setHp() main()
  1302.     elseif xC >= 20 and xC <= 26 and yC == 9  and screen == 'playr' then link(20,yC,'TELLRAW') press('lock') tellraw() main()
  1303.     elseif xC >= 20 and xC <= 26 and yC == 11 and screen == 'playr' then link(20,yC,'KICK') press('lock') tellrawKickInput() main()
  1304.     elseif xC >= 7  and xC <= 14 and yC == 3  and screen == 'world' then link(7,yC,'SETBLOCK') press('lock') setBlock() main()
  1305.     elseif xC >= 7  and xC <= 15 and yC == 5  and screen == 'world' then link(7,yC,'SETBLOCKS') press('lock') setBlocks() main()
  1306.     elseif xC >= 7  and xC <= 13 and yC == 7  and screen == 'world' then link(7,yC,'REMITEM') press('lock') remItem() main()
  1307.     elseif xC >= 7  and xC <= 13 and yC == 9  and screen == 'world' then link(7,yC,'INSITEM') press('lock') insItem() main()
  1308.     elseif xC >= 7  and xC <= 13 and yC == 11 and screen == 'world' then link(7,yC,'DAYRAIN') dayrain()
  1309.     elseif xC >= 7  and xC <= 12 and yC == 13 and screen == 'world' then link(7,yC,'SUMMON') press('lock') summon() main()
  1310.     elseif xC >= 20 and xC <= 27 and yC == 3  and screen == 'world' then link(20,yC,'INSITEMS') press('lock') insItems() main()
  1311.     elseif xC >= 20 and xC <= 23 and yC == 5  and screen == 'world' then link(20,yC,'NBTS') press('lock') nbts() main()
  1312.     elseif xC >= 20 and xC <= 24 and yC == 7  and screen == 'world' then link(20,yC,'SIGNS') signsMenu()
  1313.     elseif xC >= 20 and xC <= 28 and yC == 9  and screen == 'world' then link(20,yC,'IMBPOTION') imbPotion()
  1314.     elseif xC >= 20 and xC <= 25 and yC == 11 and screen == 'world' then link(20,yC,'SOUNDS') press('lock') menuSounds() main()
  1315.     elseif xC >= 7  and xC <= 10 and yC == 3  and screen == 'signs' then link(7,yC,'FREE') press('lock') signsSet(1) press() signsMenu()
  1316.     elseif xC >= 7  and xC <= 9  and yC == 5  and screen == 'signs' then link(7,yC,'BUY') press('lock') signsSet(2) press() signsMenu()
  1317.     elseif xC >= 7  and xC <= 10 and yC == 7  and screen == 'signs' then link(7,yC,'SELL') text1 = '§1[sell]' text2 = '1' text3 = '4' text4 = '$50' pcall(setSignText) signsMenu()
  1318.     elseif xC >= 7  and xC <= 15 and yC == 9  and screen == 'signs' then link(7,yC,'DISPENSER') text1 = '§3[dispenser]' text2 = '' text3 = '' text4 = '' pcall(setSignText) signsMenu()
  1319.     elseif xC >= 7  and xC <= 14 and yC == 11 and screen == 'signs' then link(7,yC,'CREATIVE') text1 = '§1[gamemode]' text2 = 'creative' text3 = '' text4 = '' pcall(setSignText) signsMenu()
  1320.     elseif xC >= 20 and xC <= 23 and yC == 3  and screen == 'signs' then link(20,yC,'EDIT') press('lock') signsSet(3) press() signsMenu()
  1321.     elseif xC >= 20 and xC <= 24 and yC == 5  and screen == 'signs' then link(20,yC,'CLEAR') text1 = '' text2 = '' text3 = '' text4 = '' pcall(setSignText) signsMenu()
  1322.     elseif xC >= 23 and xC <= 26 and yC == 3  and screen == 'setts' then swich('autorun') settings()
  1323.     elseif xC >= 23 and xC <= 26 and yC == 5  and screen == 'setts' then swich('protection') settings()
  1324.     elseif xC >= 23 and xC <= 26 and yC == 7  and screen == 'setts' then swich('yCorrector') settings()
  1325.     elseif xC >= 3  and xC <= 12 and yC == 9  and screen == 'setts' then link(3,yC,'[KEYBINDS]') keybinds()
  1326.     elseif xC >= 27 and xC <= 29 and yC == 2  and screen == 'warps' and #config.warps < 12 then link(27,yC,'[+]') press('lock') addWarp() press() warps()
  1327.     elseif xC >= 27 and xC <= 29 and yC == 2  and screen == 'edadm' then link(27,yC,'[+]') press('lock') addAdmin() press() editAdmins()
  1328.     elseif xC >= 1  and xC <= 25 and screen == 'warps' and yC >= 3 and (yC - 2) <= #config.warps then link(1,yC,'>') local warpId = yC - 2 teleportToWarp(warpId) warps()
  1329.     elseif xC == 28              and screen == 'warps' and yC >= 3 and (yC - 2) <= #config.warps then link(28,yC,'x') local warpId = yC - 2 table.remove(config.warps,warpId) conf_S() warps()
  1330.     elseif xC == 28              and screen == 'edadm' and yC >= 3 and (yC - 2) <= #config.admins then link(28,yC,'x') local admId = yC - 2 table.remove(config.admins,admId) conf_S() editAdmins()
  1331.     elseif xC >= 35 and xC <= 44 and yC == 1  and screen == 'spawn' then link(35,yC,'[ STOP!! ]') screen = 'stop'
  1332.     elseif xC >= 1  and xC <= 3  and yC == 2  and screen == 'spawn' then link(1,yC,'[-]') int = int + 0.05
  1333.     elseif xC >= 4  and xC <= 6  and yC == 2  and screen == 'spawn' then link(4,yC,'[+]') int = int * 0.1
  1334.     elseif xC >= 17 and xC <= 19 and yC == 2  and screen == 'spawn' then link(17,yC,'[-]') xPart = xPart - 1 yPart = yPart - 1 zPart = zPart - 1 if xPart <= 0 then xPart = 0 yPart = 0 zPart = 0 end
  1335.     elseif xC >= 20 and xC <= 22 and yC == 2  and screen == 'spawn' then link(20,yC,'[+]') xPart = xPart + 1 yPart = yPart + 1 zPart = zPart + 1
  1336.     elseif xC >= 34 and xC <= 36 and yC == 2  and screen == 'spawn' then link(34,yC,'[-]') height = height - 1
  1337.     elseif xC >= 37 and xC <= 39 and yC == 2  and screen == 'spawn' then link(37,yC,'[+]') height = height + 1
  1338.     elseif xC >= 51 and xC <= 58 and yC == 2  and screen == 'spawn' then link(51,yC,'[circle]') spawn360()
  1339.     elseif xC >= 60 and xC <= 68 and yC == 2  and screen == 'spawn' then link(60,yC,'[default]') spawnDefault()
  1340.     end
  1341. end
  1342.  
  1343. function run()
  1344.     if fs.exists(configPath) then
  1345.         conf_R()
  1346.     else
  1347.         install()
  1348.     end
  1349.     ev.listen('touch',touchProtector)
  1350.     ev.listen('key_down',keysProtector)
  1351.     main()
  1352.     while work do
  1353.         os.sleep(0.1)
  1354.     end
  1355.     exit()
  1356. end
  1357.  
  1358. function start()
  1359.     if not av('debug') then
  1360.         print('ERROR! Карта отладки не найдена!')
  1361.     elseif c.debug.test() == nil then
  1362.         print('ERROR! Карта отладки выключена в конфиге!')
  1363.     elseif g.getDepth() == 1 then
  1364.         print('ERROR! Монитор и видеокарта 1 тира не поддерживаются!')
  1365.     else
  1366.         dbg = c.debug
  1367.         if av('tablet') then
  1368.             if av('chat') then
  1369.                 chat = c.chat
  1370.                 chatAccess = true
  1371.                 ev.listen('chat_message',dialog)
  1372.             else
  1373.                 chatAccess = false
  1374.             end
  1375.         else
  1376.             if av('chat_box') then
  1377.                 chat = c.chat_box
  1378.                 chatAccess = true
  1379.                 ev.listen('chat_message',dialog)
  1380.             else
  1381.                 chatAccess = false
  1382.             end
  1383.         end
  1384.         if av('radar') then
  1385.             r = c.radar
  1386.             radarAccess = true
  1387.         else
  1388.             radarAccess = false
  1389.         end
  1390.         if av('particle') then
  1391.             p = c.particle
  1392.             particleAccess = true
  1393.         else
  1394.             particleAccess = false
  1395.         end
  1396.         run()
  1397.     end
  1398. end
  1399.  
  1400. function exit()
  1401.     term.clear()
  1402.     press('lock')
  1403.     ev.ignore('touch',touchProtector)
  1404.     ev.ignore('key_down',keysProtector)
  1405.     ev.ignore('chat_message',dialog)
  1406.     ev.cancel(timer)
  1407.     g.setForeground(colors.white)
  1408.     g.setResolution(xOld,yOld)
  1409.     os.sleep(0.00001)
  1410. end
  1411.  
  1412. function ev.shouldInterrupt()
  1413.     return false
  1414. end
  1415.  
  1416. start()
Add Comment
Please, Sign In to add comment