Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- rednet.open('top')
- if not args[1] then
- error('Input a bill UUID!')
- end
- local uuid = args[1]
- local dataSend={}
- for len = 1,#uuid do
- local char = string.byte(string.sub(uuid,len,len))*3
- table.insert(dataSend,char)
- end
- rednet.send(9,dataSend)
- local waitCount=0
- local isValid=nil
- repeat
- local id,data = rednet.receive(3)
- if id==9 then
- isValid=data
- end
- until waitCount > 10 or isValid~=nil
- if waitCount>10 then
- error('Connection Timed Out!')
- end
- if tonumber(isValid) > 0 then
- term.setTextColor(colors.green)
- print('Bill is currently valid!')
- term.setTextColor(colors.cyan)
- print('Value: '..isValid)
- print('')
- sleep(2)
- term.setTextColor(colors.orange)
- print('Press any key to continue . . .')
- os.pullEvent('key_up')
- term.clear()
- else
- term.setTextColor(colors.red)
- print('Invalid bill!')
- end
Advertisement
Add Comment
Please, Sign In to add comment