Posted 31 March 2012 - 11:04 PM
I'm trying to make a program that checks if you legally bought my OS (in the server). It checks the id of the pc.
Server:
Client:
(Server's id is 744 and i made sure i created a file with the id of the client)
It keeps printing n
Server:
fs.makeDir("disk/ids")
rednet.open("top")
while true do
local correct = false;
id, message = rednet.receive()
files = fs.list("disk/ids")
for n=1,#files do
if not fs.isDir("disk/ids/"..files[n]) then
if(id == "disk/ids/" ..files[n])then
print("yes")
correct = true
end
end
end
if message == "IDcheck" then
if correct == true then
rednet.send(id, "yes")
elseif correct == false then
print("no")
rednet.send(id, "no")
end
end
end
Client:
rednet.open("top")
rednet.send(744, "IDcheck")
id, message, timesent = rednet.receive()
if id == 744 then
if message == "yes" then
print("y")
elseif message == "no" then
print("n")
end
end
(Server's id is 744 and i made sure i created a file with the id of the client)
It keeps printing n