Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------- CONFFIG ---------------------
- --this lines you can edit
- ID = "MAIN" -- tablet ID
- os.loadAPI("AF") -- crypting/decrypting API by Zer0Galaxy
- key = AF.getkey("HsGT4*523GuH") --key
- --------------------------------------------------
- pr = false
- ex = true
- m = peripheral.wrap("back")
- lsms = {}
- m.open(50)
- term.clear()
- term.setCursorPos(1,1)
- --crypt message and send
- function sendC(ms)
- pms = AF.crypt(ms,key)
- m.transmit(50,50,pms)
- end
- -- gmatch universal
- function Gmatch(text,form)
- for h,k,v in string.gmatch(text,form) do
- return h,k,v
- end
- end
- --recive and decrypt
- function RDEC()
- e,p1,p2,p3,p4,p5 = os.pullEvent()
- if e == "modem_message" then
- Oms = AF.decrypt(p4,key)
- return tostring(Oms)
- end
- end
- function os.pullEvent()
- e,p1,p2,p3,p4,p5 = os.pullEventRaw()
- if e == "modem_message" then
- ms = AF.decrypt(p4,key)
- end
- return e,p1,p2,p3,p4,p5
- end
- st = 0
- while ex do
- st = st + 1
- if st == 1 then
- print("welcome to console")
- print('type "help" to help')
- end
- write("sys>")
- inp = read(_,lsms)
- table.insert(lsms,inp)
- if inp == "add" then
- print("write player to add:")
- inp = read()
- m.transmit(50,50,AF.crypt("add="..inp,key))
- elseif inp == "rm" then
- print("write player to remove:")
- inp = read()
- m.transmit(50,50,AF.crypt("rm="..inp,key))
- elseif inp == "rOpen" then
- write("write door ID:")
- inp = read()
- m.transmit(50,50,AF.crypt("rOpen="..inp,key))
- elseif inp == "getEU" then
- m.transmit(50,50,AF.crypt("getEU=sys",key))
- ms = RDEC()
- print(ms)
- elseif inp == "trm" then
- ex = false
- elseif inp == "clear" then
- term.clear()
- term.setCursorPos(1,1)
- elseif inp == "getRCS" then
- m.transmit(50,50,AF.crypt("getRCS=sys",key))
- ms = RDEC()
- H,AC,EU = Gmatch(ms,"%w+=(%w+);(%w+);(%w+)")
- if AC == "true" then
- print("now reactor Enabled")
- print("Heat is "..H..", now Output is "..EU)
- else
- print("now reactor Disabled")
- end
- elseif inp == "getDS" then
- m.transmit(50,50,AF.crypt("getDS=server1",key))
- ms = RDEC()
- print(ms)
- ---------------------------------------------------------
- --there you can add you function "inp" is player input. A[1] is command , [2] is args
- ---------------------------------------------------------
- elseif inp == "help" then
- m.transmit(50,50,AF.crypt("getHelp",key))
- mg = RDEC()
- ms = {"in this system were this commands:",
- "-add , takes this: <player> to add in system",
- "-rm , takes this: <player> to remove from system",
- "-rOpen , takes this: <Door ID> to open",
- "-getEU , returns energy in system storage",
- "-getDS , returns distance to server",
- "-getRCS , return status of reactor",
- "this programs not require access to server",
- "-trm , terminate program",
- "-clear , clear screen"}
- term.clear()
- term.setCursorPos(1,1)
- for i=1,#ms do
- if i > 22 then
- os.pullEvent("key")
- end
- print(ms[i])
- sleep(0)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement