Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- canRun=false
- local modem=peripheral.find("modem")
- if modem~=nil and modem.isWireless() then
- canRun=true
- modem.open(662)
- else
- print("No wireledd modem")
- return;
- end
- people={["THEMAULER431"]=0,["Iban1223"]=0,["milianlou"]=0}
- pNames={"THEMAULER431","Iban1223","milianlou"}
- pins={["THEMAULER431"]=5280,["Iban1223"]=3221,["milianlou"]=0107}
- r=fs.open("moneys","r")
- line=r.readLine()
- m=1
- for m=1,#people do
- people[pNames[m]]=tonumber(line)
- end
- r.close()
- while canRun do
- e={os.pullEvent()}
- if e[1]=="key" and e[2]==keys.q then
- r=fs.open("moneys","w")
- for t,y in pairs(people) do
- r.writeLine(y)
- end
- r.close()
- return
- elseif e[1]=="modem_message" then
- msg=textutils.unserialize(e[5])
- if msg.pin==pins[msg.from] and tonumber(e[5]) and (people[msg.from]-tonumber(msg.amount))>=0 then
- people[msg.from]=people[msg.from]-tonumber(msg.amount)
- people[msg.to]=people[mmsg.to]+tonumber(msg.amount)
- modem.transmit(8816,1,"GOOD_PURCHASE")
- else
- modem.transmit(8816,1,"BAD_PURCHASE")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement