Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- users = {
- [1] = {user = "Trey", pass = "test", priv = 5, id = 22, ign = "Trey2k"},
- [2] = {user = "shoe", pass = "abc", priv = 1, id = 25, ign = "i_am_a_shoe"},
- }
- umsg = {}
- --for k,v in pairs(users) do print(k.." : "..v.user) end
- function login(u, p)
- stk = {" ", false}
- for k,v in pairs(users) do
- if v.user == u and v.pass == p then
- stk = {k, true}
- end
- end
- print(stk[2])
- if stk[2] == true then
- return true
- else
- return false
- end
- end
- function rnet()
- umsg = {}
- id, content = rednet.receive()
- if textutils.unserialise(content) then
- umsg = textutils.unserialise(content)
- end
- end
- function encrypt(string)
- local out = ""
- for i = 1, #string do
- local char = string:sub(i,i)
- local sNum = char:byte()
- local oNum = sNum + 47
- if oNum > 127 then
- oNum = oNum - 94
- end
- out = out .. string.char(oNum)
- end
- return out
- end
- function decrypt(string)
- local out = string.gsub(encrypt(string),"~"," ")
- return out
- end
- function comm()
- local asd = stk[1]
- if umsg.cat == "exec" then
- commands.exec(umsg.cmd)
- elseif umsg.cat == "heal" then
- print(users[asd].ign)
- commands.exec("heal "..users[asd].ign)
- end
- end
- --login("i_am_a_shoe", "abc")
- while true do
- rnet()
- if login(umsg.user, umsg.pass) then
- print("Successful Login: "..umsg.user)
- print(umsg.user.." Attempted to run "..umsg.cmd)
- comm()
- else
- print("Invalid Packet: "..content)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement