Posted 26 August 2012 - 12:14 PM
Hello,
I made an email sistem that uses a server. I made a code for the server but I would like to know if there's any way to make it shorter.
Server Code:
Thanks in advance! :D/>/>
I made an email sistem that uses a server. I made a code for the server but I would like to know if there's any way to make it shorter.
Server Code:
rednet.open("back")
os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
serverID = os.computerID()
print "You can't use this computer because its a server!"
print ""
print("Server ID: " ..serverID)
print "-------------"
print "Logs:"
print ""
while true do
from, msg, distance = rednet.receive()
from2, to, distance2 = rednet.receive()
print("Message recived from: " ..from)
print("Sending message to: " ..to)
if (to == "10") then
elseif (to == "9") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
elseif (to == "8") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
elseif (to == "7") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
elseif (to == "6") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
elseif (to == "5") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
elseif (to == "4") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
elseif (to == "3") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
elseif (to == "2") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
elseif (to == "1") then
rednet.send(to, msg)
print ""
print "Message Sent"
print "---------------"
-- This part will be changed, now it just says error for testing.
else
print ""
print "Error"
print "---------------"
end
end
Thanks in advance! :D/>/>