This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ComputerCraftFan11's profile picture

ID Check

Started by ComputerCraftFan11, 31 March 2012 - 09:04 PM
ComputerCraftFan11 #1
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:



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
ComputerCraftFan11 #2
Posted 31 March 2012 - 11:07 PM
*solved

i changed it to if fs.exists("disk/ids/" ..id) then
blablabla