Michael_Roy

Untitled

Apr 19th, 2026
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | Gaming | 0 0
  1. rednet.open("top")
  2. while true do
  3.     message=0
  4.     os.queueEvent("randomEvent")
  5.     os.pullEvent()
  6.     print("do you want to receive or send a message?")
  7.     print("1 for send and 2 for receive")
  8.     a=read()
  9.     a=tonumber(a)
  10.  
  11.     if a==1 then
  12.         print("type your message")
  13.         msg=read()
  14.         rednet.broadcast(msg)
  15.     end
  16. end
  17. rednet.open("top")
  18. while true do
  19.     message=0
  20.     os.queueEvent("randomEvent")
  21.     os.pullEvent()
  22.     print("do you want to receive or send a message?")
  23.     print("1 for send and 2 for receive")
  24.     a=read()
  25.     a=tonumber(a)
  26.  
  27.     if a==1 then
  28.         print("type your message")
  29.         msg=read()
  30.         rednet.broadcast(msg)
  31.     end
  32.  
  33.     if a==2 then
  34.         print("waiting for the message")
  35.         while message == 0 do
  36.             id, message=rednet.receive()
  37.             print("here is your message")
  38.             print(message)
  39.         end
  40.     end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment