Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local currentKey = "none"
- local selectedClient = 0
- local modemLocation = "back"
- function Home_Screen()
- print("------------------------------")
- print("Welcome To Farmers Server v0.1")
- print("------------------------------")
- print("Options:")
- print("0) Activate Farm")
- print("1) Redstone Listener")
- print("2) View Client Status")
- print("3) Action Log")
- print("4) Set Modem Location")
- print("5) Set Client Key")
- print("Enter a number to select a option above!")
- local input = read()
- if input == "0" then
- activateFarm()
- elseif input == "1" then
- redstoneListener()
- elseif input == "2" then
- viewClient()
- elseif input == "3" then
- actionLog()
- elseif input == "4" then
- setModemLocation()
- elseif input == "5" then
- setClientKey()
- end
- end
- function activateFarm()
- print("--------------------------------")
- print("Select a Client to activate v0.1")
- print("--------------------------------")
- print("1) Client 1")
- print("2) Client 2")
- print("3) Client 3")
- print("4) Client 4")
- print("5) Client 5")
- print("6) Client 6")
- print("7) Client 7")
- print("8) Client 8")
- print("9) Client 9")
- print("Enter a number to select a option above!")
- local input = read()
- if input == "1" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(1, 10, generateCode(getKey("1")))
- Home_Screen()
- elseif input == "2" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(2, 10, generateCode(getKey("2")))
- Home_Screen()
- elseif input == "3" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(3, 10, generateCode(getKey("3")))
- Home_Screen()
- elseif input == "4" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(4, 10, generateCode(getKey("4")))
- Home_Screen()
- elseif input == "5" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(5, 10, generateCode(getKey("5")))
- Home_Screen()
- elseif input == "6" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(6, 10, generateCode(getKey("6")))
- Home_Screen()
- elseif input == "7" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(7, 10, generateCode(getKey("7")))
- Home_Screen()
- elseif input == "8" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(8, 10, generateCode(getKey("8")))
- Home_Screen()
- elseif input == "9" then
- local modem = peripheral.wrap(modemLocation)
- modem.transmit(9, 10, generateCode(getKey("9")))
- Home_Screen()
- end
- end
- function getKey(num)
- local file = io.open("client" .. num, "r")
- local out = file:read()
- file:close()
- return out
- end
- function setClientKey()
- print("-----------------------------------------")
- print("Select a Client to set a new key for v0.1")
- print("-----------------------------------------")
- print("1) Client 1")
- print("2) Client 2")
- print("3) Client 3")
- print("4) Client 4")
- print("5) Client 5")
- print("6) Client 6")
- print("7) Client 7")
- print("8) Client 8")
- print("9) Client 9")
- print("Enter a number to select a option above!")
- local input = read()
- print("Enter a small string that you would like to set Client " .. input .. "'s key to.")
- local input1 = read()
- if input == "1" then
- local file = io.open("client1", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- elseif input == "2" then
- local file = io.open("client2", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- elseif input == "3" then
- local file = io.open("client3", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- elseif input == "4" then
- local file = io.open("client4", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- elseif input == "5" then
- local file = io.open("client5", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- elseif input == "6" then
- local file = io.open("client6", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- elseif input == "7" then
- local file = io.open("client7", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- elseif input == "8" then
- local file = io.open("client8", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- elseif input == "9" then
- local file = io.open("client9", "w")
- file:write(input1)
- file:close()
- Home_Screen()
- end
- end
- function generateCode(client)
- if 4 < 1 then return nil end
- local s = ""
- for i = 1, 4 do
- s = s .. string.char(math.random(48, 57))
- end
- s = s .. "-"
- for i = 1, 4 do
- s = s .. string.char(math.random(48, 57))
- end
- s = s .. "-"
- for i = 1, 4 do
- s = s .. string.char(math.random(48, 57))
- end
- s = s .. "-"
- for i = 1, 4 do
- s = s .. string.char(math.random(48, 57))
- end
- return client .. "-" .. s
- end
- function redstoneListener()
- end
- function viewClient()
- end
- function actionLog()
- end
- Home_Screen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement