Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = {...}
- rednet.open("back")
- sfile = fs.open("sfile","a")
- rfile = fs.open("sfile","r")
- bmh = 10
- --Format = amt,serial
- if rfile.readLine() == nil then
- sfile.writeLine("0")
- ser = "0"
- end
- function incrementSerial()
- ser = ser + 1
- end
- function checkMoney(account)
- rednet.send(bmh,"check")
- rednet.send(bmh,account)
- id,msg = rednet.receive()
- if id == bmh then
- return tonumber(msg)
- end
- end
- function checkornil(str,sera)
- if str==nil then
- return true
- fail=true
- end
- if str==sera then return true end
- return false
- end
- function checkSecurity(amt,serc,acc)
- rfile.close()
- rfile = fs.open("sfile","r")
- repeat
- until checkornil(rfile.readLine(),amt..","..serc)
- if fail == true then
- fail = false
- return false
- end
- if checkMoney(acc) > amt then
- return true
- else
- return false
- end
- end
- function createNote(amt)
- incrementSerial()
- sfile.writeLine(amt..","..ser)
- return ser
- end
- if tArgs[1] == "cn" then
- createNote(tArgs[2])
- elseif tArgs[1] == "cs" then
- checkSecurity(tArgs[2],tArgs[3],tArgs[4])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement