Guest User

Broadcast server messages part 1

a guest
Oct 10th, 2013
55
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Call this program 'Broadcast'
  2. -- it needs a second program to be called 'startup'
  3. -- This program will ask for messages to send as the server console and needs a command block (enabled in CC and server.properties)
  4. local function Variables()
  5.   print("Command block will be on which side of the computer?")
  6.   print("left, right, front, back, top or bottom?")
  7.   Side = read()
  8.   print("How many different messages do you want to alternate?")
  9.   Amount = read()
  10.   Message = {}
  11.   for i = 1, Amount do
  12.     print("Message("..i..") to be broadcast?")
  13.     Message[i] = read()
  14.   end
  15.   print("Repeat in minutes?")
  16.   Repeat = read()
  17.   print()
  18.   print("I will broadcast the following messages:")
  19.   for i = 1, Amount do
  20.     print(Message[i])
  21.   end
  22.   print("Interval will be "..Repeat.." minutes.")
  23. end
  24.  
  25. local function StoreData()
  26.   writeData = fs.open("Variables", "w")
  27.   writeData.writeLine(Side)
  28.   writeData.writeLine(Amount)
  29.   writeData.writeLine(Repeat)
  30.   for i = 1, Amount do
  31.     writeData.writeLine(Message[i])
  32.   end
  33.   writeData.close()
  34.   term.setTextColor(colors.red)
  35.   print("Data stored!")
  36.   sleep(5)
  37. end
  38.  
  39. local function Broadcast()
  40.   shell.run("startup")
  41. end
  42.  
  43. term.clear()
  44. term.setCursorPos(1,1)
  45. term.setTextColor(colors.white)
  46. Variables()
  47. StoreData()
  48. Broadcast()
RAW Paste Data