Advertisement
Makcu73

Инфопанель от Шивы(spawn)

Nov 20th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Max K. 03.07.2017 mcskill.ru
  2. local component = require("component")
  3. local computer = require("computer")
  4. local term = require("term")
  5. local event = require("event")
  6. local gpu = component.gpu
  7. local os = require("os")
  8. local serialization = require("serialization")
  9. local unicode = require("unicode")
  10. gpu.setResolution(86,23) -- 86,23 = 7*4 screen
  11. local width, height = gpu.getResolution()
  12.  
  13. local helpStrings = {
  14.   "<c>|ffffffПривет, ты на спавне сервера |cc00ffGalaxyCraft",
  15.   "",
  16.   "  |cc00ff/warp world |ffffff- |66ccffстроительный мир|ffffff. Строить дома можно только тут",
  17.   " |cc00ff/warp mining |ffffff- |cc9900копательный мир|ffffff, состоит только из ресурсов и камня",
  18.   " |cc00ff/warp nether |ffffff- |ff6666нижний мир |ffffff(ад)",
  19.   "    |cc00ff/warp end |ffffff- |9999ffмир края |ffffff(эндер)",
  20.   "         |cc00ff/rtp |ffffff- переместиться в случайное место на карте (сперва перейди в другой мир)",
  21.   "        |cc00ff/zone |ffffff- выделить территорию для привата - автоматически выделяются 9 чанков",
  22.   "                |ffffffвокруг тебя - |cc00ff589000 |ffffffкубов. Топоры, //wand и прочее - не нужны",
  23.   "|cc00ff/rg claim имя |ffffff- заприватить выделенную территорию",
  24.   "        |cc00ff-mods |ffffff- список модераторов онлайн",
  25.   "            |cc00ff! |ffffff- писать в глобальный чат. Можно задавать свои вопросы",
  26.   "",
  27.   "",
  28.   "",
  29.   "",
  30.   "<c>Миры:",
  31.   "",
  32.   "     |66ccffГлавный мир |ffffff- |cc00ff6000 |ffffffх |cc00ff6000|ffffff. Последний вайп сервера - |cc00ff14 января 2018",
  33.   "|cc9900Копательный мир |ffffff- |cc00ff6000 |ffffffх |cc00ff6000",
  34.   "              |ff6666Ад |ffffff- |cc00ff2000 |ffffffх |cc00ff2000",
  35.   "            |9999ffКрай |ffffff- |cc00ff2000 |ffffffх |cc00ff2000",
  36. }
  37. function drawWindow(x,y,w,h)
  38.   gpu.set(x,y,string.rep("─",w))
  39.   gpu.set(x,y+h-1,string.rep("─",w))
  40.   gpu.set(x,y,string.rep("│",h),true)
  41.   gpu.set(x+w-1,y,string.rep("│",h),true)
  42.  
  43.   gpu.set(x,y,"┌")
  44.   gpu.set(x+w-1,y,"┐")
  45.   gpu.set(x,y+h-1,"└")
  46.   gpu.set(x+w-1,y+h-1,"┘")
  47. end
  48. function drawText(x,y,array)
  49.   function printLine(string)
  50.     if string ~= "" then
  51.       local a,b = string.find(string,"|........")
  52.       if a == nil then
  53.         io.write(string)
  54.         gpu.setForeground(0xffffff)
  55.       elseif a > 1 then
  56.         io.write(string:sub(0,a-1))
  57.         printLine(string:sub(a))
  58.       elseif a == 1 then
  59.         gpu.setForeground(tonumber("0x" .. string:sub(2,7)))
  60.         string = string:sub(7+1)
  61.         printLine(string)
  62.       end
  63.     else
  64.       gpu.setForeground(0xffffff)
  65.       return true
  66.     end
  67.   end
  68.  
  69.   local i = 0
  70.   for k,v in pairs(array) do -- <c> in the beginning to draw centered
  71.     if string.find(v,"<c>") == 1 then
  72.       local newstring = string.gsub(v,"|......","")
  73.       local newstring = string.gsub(newstring,"<c>","")
  74.       term.setCursor(math.floor(width/2) - math.floor(unicode.len(newstring)/2),y+i)
  75.     else
  76.       term.setCursor(x,y+i)
  77.     end
  78.     printLine(v:gsub("<c>",""))
  79.     i = i+1
  80.   end
  81. end
  82. term.clear()
  83. drawText(1,1,helpStrings)
  84. os.sleep(math.huge)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement