Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if fs.exists("password") then
- f = fs.open("password", "r")
- password = f.readAll()
- else
- error("Please create a file named 'password' and put your password in it.", 0)
- end
- energyEnabled = true
- local version = 0.6
- local send = 121
- local receive = 119
- os.pullEvent = os.pullEventRaw
- bannedPlayers = {
- osmarks = true,
- Keanu73 = true,
- }
- cmd = {}
- modem = peripheral.find("modem")
- modem.open(receive)
- file = fs.open("chatlog", fs.exists("chatlog") and "a" or "w")
- function say(text)
- modem.transmit(send, receive, text)
- end
- function pass()
- local event, p1 = os.pullEvent("key")
- if p1 == 25 then
- sleep(0.1)
- print("Please Enter Password:")
- input = read("*")
- if password == input then
- error("Correct Password", 0)
- else
- os.reboot()
- end
- end
- end
- cmds = { "help", "update", "games", "changelog", "download", "energy" }
- cmdFunc = {
- help = function()
- say("Here is all of our commands currently:")
- say("+ update - Updates all of our systems to the latest pastebin")
- say("+ games - Shows a list of all the current games on the DLA network and how to install them")
- say("+ changelog - shows the changelog and current version of DLA")
- say("+ download - downloads the programs you want")
- say("+ energy - If enabled, tells you the current level of energy in your energy cells")
- end,
- update = function()
- say("updated")
- say("update")
- os.reboot()
- end,
- games = function()
- say("Here is our current list of games:")
- say("")
- say("Minesweeper by GopherAtl")
- say("Stacker by KingofGamesYami")
- say("BBTetris by BombBloke")
- say("CCOthello by KingofGamesYami")
- say("KnightsTour by RoD")
- say("SnakeMaze by nitrogenfingers")
- say("MiniatureCraft by Detective_Smith")
- say("BingoCraft by theTanco")
- say("BBCards by BombBloke")
- say("")
- say("To download any of these games simply run the program: pastebin run Vu6niFSr. To get DLA to send you this file just type the command: + download games [name of the program you want to download] and make sure you have the receive program running.")
- end,
- changelog = function()
- say("Current version: "..version)
- say("Changelog:")
- say("")
- say("v0.5:")
- say("Added changelog")
- say("Added games command")
- say("Now supports arguments")
- say("Added downloading feature")
- end,
- download = function()
- if cmd[2] == "game" then
- if cmd[3] == "Minesweeper" then
- say("pastebin get nsKrHTbN minesweeper")
- say("Sent")
- elseif cmd[3] == "Stacker" then
- say("pastebin get HC1MjHVq stacker")
- say("Sent")
- elseif cmd[3] == "BBTetris" then
- say("pastebin get nKQZwgtv bbtetris")
- say("Sent")
- elseif cmd[3] == "CCOthello" then
- say("pastebin get rMeh1Kag ccothello")
- say("Sent")
- elseif cmd[3] == "KnightsTour" then
- say("pastebin get G5FqHanB knightstour")
- say("Sent")
- elseif cmd[3] == "SnakeMaze" then
- say("pastebin run 9cdEwcZB")
- say("Sent")
- elseif cmd[3] == "MiniatureCraft" then
- say("pastebin run FgAggvy1|pastebin run Q2TsPJfh")
- say("Sent")
- elseif cmd[3] == "BingoCraft" then
- say("pastebin get 3v130WkD game|pastebin get ngA8d9PQ restartgame")
- say("Sent")
- elseif cmd[3] == "BBCards" then
- say("pastebin get T7a1Yp7S bbcards|pastebin get 0TC3qyGV card")
- say("Sent")
- end
- end
- end,
- energy = function()
- if energyEnabled == true then
- if fs.exists("cells") then
- totalStored = 0
- totalCapacity = 0
- file = fs.open("cells", "r")
- table = textutils.unserialize(file.readAll())
- file.close()
- for i = table[1], #table + (table[1] - 1) do
- cellNum = table[i]
- cell = peripheral.wrap("minecraft:thermalexpansion_storage_cell_"..i)
- energy = cell.getMetadata()
- stored = energy.energy.stored
- capacity = energy.energy.capacity
- totalStored = totalStored + stored
- totalCapacity = totalCapacity + capacity
- powerPercentage = totalStored / totalCapacity * 100
- modem.transmit(send, receive, powerPercentage.."%")
- end
- else
- say("Please create a file named 'cells' and write a table of the numbers of your energy cells in it.")
- end
- else
- say("The energy command is not enabled, please contact the person who is hosting the DLA to turn it on.")
- end
- end,
- }
- function mainLoop()
- while true do
- local _, _, _, _, info = os.pullEvent("modem_message")
- if info ~= nil then
- text = info[2]
- usr = info[1]
- if usr ~= nil and text ~= nil then
- file.writeLine(usr..": "..text)
- file.flush()
- end
- chat_string = string.sub(text, 1, (-string.len(text)) + 1)
- s = string.sub(text, 3)
- for chat in s:gmatch("%w+") do
- table.insert(cmd, chat)
- end
- if not bannedPlayers[usr] and chat_string == "+ " then
- for k, v in pairs(cmds) do
- if v == cmd[1] then
- cmdFunc[cmd[1]]()
- end
- end
- elseif bannedPlayers[usr] and chat_string == "+ " then
- say("Your request shall not be processed "..usr)
- end
- for i = 1, #cmd do
- cmd[i] = nil
- end
- end
- end
- end
- parallel.waitForAll(mainLoop, pass)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement