Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr=peripheral.wrap("back")
- local mod=peripheral.find("modem")
- local addrs=dofile("addrs.lua")
- local function dial(addr)
- --plr.tell(addr)
- mod.open(1337)
- mod.transmit(555,1337,addrs[addr] or addr)
- local tid=os.startTimer(1)
- repeat
- name,evid,port,_,msg=os.pullEvent()
- until (name=="timer" and evid==tid) or (name=="modem_message" and port==1337)
- if msg then plr.tell(msg) end
- mod.close(1337)
- end
- local function main()
- while true do
- local _,msg=os.pullEvent("chat_capture")
- print(msg)
- plr.tell(msg)
- if string.find(msg,"%.dial") then
- _,cend=string.find(msg,"%.dial")
- dial(string.sub(msg,cend+2,-1))
- elseif string.find(msg,"%.auth")
- _,cend=string.find(msg,"%.dial")
- mod.transmit(555,1337,{"auth",string.sub(msg,cend+2,-1)
- end
- end
- end
- plr.capture("^%.")
- local _,err=pcall(main)
- plr.uncapture("^%.")
- error(err)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement