– Copyright Alexander Bolton © 2012-
print("Starting CraftOs Server Program By Alex_")
print("which side is the modem?")
modem=read()
print("Admin password for session")
apass=read()
fs.delete("users/admin")
fs.makeDir("users/admin")
fs.makeDir("users/admin/" .. apass)
fs.makeDir("users/admin/privalege")
fs.makeDir("users/admin/privalege/superuser")
print("password set with privalege superuser")
sleep(1)
rednet.open(modem)
term.clear()
term.setCursorPos(1,1)
print("Server Started")
print("Click CTRL For Console")
print("===============================================")
while true do
print("scanning")
from,rp1=rednet.receive(60)
sleep(1)
from,rp2=rednet.receive(60)
sleep(1)
from,rp3=rednet.receive(60)
sleep(1)
from,rp4=rednet.receive(60)
sleep(1)
if rp1=="login" then main() – start:30: attempt to call nil
end
end
function main()
if fs.exists("users/" .. rp2 .. "/" .. rp3) then
if fs.exists("users/" .. rp3 .. "/privalege/superuser") then
print(rp2, " found. sending admin login codes")
rednet.broadcast(rp1)
sleep(2)
rednet.broadcast(rp2)
sleep(2)
rednet.broadcast(rp4)
sleep(2)
rednet.broadcast("superuser")
print(rp2, ":", rp4, ":", "superuser:has logged in")
elseif fs.exists("users/" .. rp2 .. "/" .. rp3) then
print(rp2, " found. sending norm login codes")
rednet.broadcast(rp1)
sleep(2)
rednet.broadcast(rp2)
sleep(2)
rednet.broadcast(rp4)
sleep(2)
rednet.broadcast("norm")
print(rp2, ":", rp4, ":", "norm:has logged in")
end
end
function ashutdown()
print("shutting down")
sleep(2)
os.shutdown()
end
end
im getting a problem with the function but can't find it
it says attempt to call nil but the function "login()" exists!
edit:
I moved code to top and it didn't work at all it just broke the code
new code still not working
http://pastebin.com/2Ybdi3kg
Edit Fixed i left 2 ends at bottom
Thanks Lirall