Posted 26 June 2017 - 12:44 AM
Hey guys
Im working on a project where i want to sync a server to a client but as a secure feature i want to use a Sync code generated by the server that the client then has to input, from here it is sent to the server ID and compair however never seams to work
never really used the math.random so i have no clue :lol:/>
the code i have set up atm is for testing purposes, could someone tell me where im going wrong?
Thanks, MrProgrammer
What i think is happening is when im calling the randomCodeGen its Gening one number then when i call it the second time its Gening a new number but how do i stop this?
Im working on a project where i want to sync a server to a client but as a secure feature i want to use a Sync code generated by the server that the client then has to input, from here it is sent to the server ID and compair however never seams to work
never really used the math.random so i have no clue :lol:/>
the code i have set up atm is for testing purposes, could someone tell me where im going wrong?
Thanks, MrProgrammer
randomCodeGen = math.random(100000000,999999999)
print(randomCodeGen)
syncLoop = true
while syncLoop == true do
local event, syncCode, ID = os.pullEventRaw()
if event == "rednet_message" then
if syncCode == randomCodeGen then
os.reboot()
else
os.shutdown()
end
end
end
What i think is happening is when im calling the randomCodeGen its Gening one number then when i call it the second time its Gening a new number but how do i stop this?
Edited on 25 June 2017 - 11:24 PM