Advertisement
gpgautier

xtreamtech - rules

Dec 22nd, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. local title = "XtreamTech Official Rules"
  2.  
  3. local footers = {
  4.   "If caught breaking any of these rules you will face"
  5.   , "a Temp-Mute, Mute, Temp-Ban, Ban, or Jail"
  6. }
  7.  
  8. local rules = {
  9.   "No griefing"
  10.   , "No PVP"
  11.   , "No Spamming Chat"
  12.   , "No Excessive Swearing"
  13.   , "Don't build within 300 blocks of Spawn"
  14.   , "No overflowing or leaking machines/pipes"
  15.   , "Don't ask Staff for items/teleports/commands"
  16.   , "X-ray and other Hacks are strictly BANNED"
  17.   , "No Ugly Buildings or 1x1 Towers"
  18.   , "Max Quarry size is 20x20"
  19. }
  20.  
  21. function main()
  22.   term.clear()
  23.  
  24.   local monitor, _, side, width, height, i, padding, rule, firstLine, x, y, footer
  25.  
  26.   firstLine = 2
  27.  
  28.   for _, side in pairs(rs.getSides()) do
  29.     if peripheral.isPresent(side) then
  30.       if peripheral.getType(side) == "monitor" then
  31.         monitor = peripheral.wrap(side)
  32.       end
  33.     end
  34.   end
  35.  
  36.   if monitor == nil then
  37.     print("Please attach a monitor to any side")
  38.     return
  39.   end
  40.  
  41.   width, height = monitor.getSize()
  42.  
  43.   monitor.clear()
  44.   monitor.setCursorPos(1, firstLine)
  45.  
  46.   for i = 1, width do
  47.     monitor.write("=")
  48.   end
  49.  
  50.   padding = (width / 2) - (#title / 2)
  51.  
  52.   monitor.setCursorPos(1, firstLine + 2)  
  53.   for i = 1, padding do
  54.     monitor.write(" ")
  55.   end
  56.  
  57.   monitor.write(title)
  58.  
  59.   monitor.setCursorPos(1, firstLine + 4)
  60.   for i = 1, width do
  61.     monitor.write("=")
  62.   end
  63.  
  64.   for _, rule in pairs(rules) do
  65.     monitor.setCursorPos(1, firstLine + 6 + _)
  66.     monitor.write("   " .. rule)
  67.   end
  68.  
  69.   x, y = monitor.getCursorPos()
  70.  
  71.   for _, footer in pairs(footers) do
  72.     monitor.setCursorPos(1, y + 3 + _)
  73.  
  74.     padding = (width / 2) - (#footer / 2)
  75.  
  76.     for i = 1, padding do
  77.       monitor.write(" ")
  78.     end
  79.    
  80.     monitor.write(footer)
  81.   end
  82. end
  83.  
  84. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement