Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Normally requires Peripherals Plus One, but can be heavily modified for console usage.
- --Made by bryceio
- local chat = peripheral.wrap("left")
- local playerdetector = peripheral.wrap("right")
- local commands = {}
- local newcommand = {}
- local blacklist = {}
- local admins = {"bryceio"}
- local responsetable = {}
- local event, player, input = os.pullEvent("chat")
- local i = 1
- local x = 1
- local y = 1
- local admin = false
- rednet.open("back")
- for i = 1,#blacklist do
- if blacklist[i] == player and player ~= "bryceio" then
- sleep(0.5)
- chat.say("Access Denied")
- console = fs.open("log", "a")
- console.writeLine(player.." tried to access Jarvis")
- console.close()
- shell.run("JarvOS")
- end
- end
- i = 1
- for i = 1,#input do
- temp = input:sub(i, i)
- if temp == " " then
- commands[x] = table.concat(newcommand)
- newcommand = {}
- x = x + 1
- y = 1
- else
- newcommand[y] = temp
- y = y + 1
- end
- end
- commands[x] = table.concat(newcommand)
- newcommand = {}
- i = 1
- x = 1
- y = 1
- sleep(0.5)
- if commands[1] == "Jarvis" or commands[1] == "jarvis" or commands[1] == "Jarvis," or commands[1] == "jarvis," then
- console = fs.open("log", "a")
- console.writeLine(player..": "..table.concat(commands, " "))
- console.close()
- admins[#admins+1] = "bryceio"
- if commands[2] == "Say" or commands[2] == "say" then
- x = 1
- for i = 3,#commands do
- responsetable[x] = commands[i]
- x = x + 1
- end
- response = table.concat(responsetable, " ")
- chat.say(response)
- elseif commands[2] == "Play" or commands[2] == "play" then
- if fs.exists("playdisc") then
- shell.run("playdisc "..commands[3])
- chat.say("Playing "..commands[3])
- end
- elseif commands[2] == "Stop" or commands[2] == "stop" then
- if commands[3] == "Music" or commands[3] == "music" then
- rednet.broadcast("cease", "JarvOS Music Stop")
- chat.say("Stopping music.")
- elseif commands[3] == "Shuffle" or commands[3] == "shuffle" then
- rednet.broadcast("cease", "JarvOS Shuffle Stop")
- chat.say("Stopping shuffle.")
- end
- elseif commands[2] == "Shuffle" or commands[2] == "shuffle" then
- rednet.broadcast("shuffle", "JarvOS Music Shuffle")
- chat.say("Shuffling music.")
- elseif commands[2] == "What" or commands[2] == "what" then
- if commands[3] == "Time" or commands[3] == "time" then
- if os.time() <= 12 then
- chat.say(tostring(os.time())..":00 AM")
- else
- chat.say(tostring(os.time()-12)..":00 PM")
- end
- end
- elseif commands[2] == "Who" or commands[2] == "who" then
- if commands[3] == "Is" or commands[3] == "is" then
- if commands[4] == "Nearby" or commands[4] == "nearby" or commands[4] == "Near" or commands[4] == "near" then
- players = playerdetector.getNearbyPlayers(64)
- for i = 1,#players do
- players[i] = players[i].player
- end
- chat.say(table.concat(players, ", "))
- end
- end
- elseif commands[2] == "Take" or commands[2] == "take" then
- if commands[3] == "A" or commands[3] == "a" then
- if commands[4] == "Note" or "note" then
- if fs.exists("takenotes") then
- shell.openTab("takenotes "..player)
- end
- end
- end
- elseif commands[2] == "Admin" or commands[2] == "admin" then
- for i = 1,#admins do
- if admins[i] == player then
- admin = true
- end
- end
- if admin == true then
- chat.say("Access granted.")
- if commands[3] == "Reboot" or commands[3] == "reboot" then
- sleep(1.5)
- chat.say("Rebooting")
- os.reboot()
- elseif commands[3] == "Terminate" or commands[3] == "terminate" then
- sleep(1.5)
- chat.say("Shutting down JarvOS.")
- error()
- elseif commands[3] == "Lockdown" or commands[3] == "lockdown" then
- sleep(1.5)
- chat.say('Are you sure? Type "Yes" to confirm or "No" to cancel.')
- admin = false
- repeat
- event, player, message = os.pullEvent("chat")
- if message == "Yes" or message == "yes" or message == "No" or message == "no" then
- for i = 1,#admins do
- if admins[i] == player then
- admin = true
- end
- end
- end
- until admin == true
- if message == "Yes" or message == "yes" then
- sleep(1)
- chat.say("Going into system lockdown.")
- if fs.exists("lockdown") then
- shell.run("lockdown")
- end
- elseif message == "No" or message == "no" then
- sleep(1)
- chat.say("Lockdown cancelled.")
- end
- end
- else
- chat.say("Access denied.")
- end
- end
- shell.run("JarvOS")
- else
- shell.run("JarvOS")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement