Advertisement
k_goos

RednetAPI

Apr 26th, 2013
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local messend = ""
  2. local idpc = 0
  3. local mesreceive = ""
  4.  
  5. function SendResponse()
  6. while true do
  7. rednet.send(idpc, messend)
  8. sleep(1)
  9. end
  10. end
  11. function ReceiveResponse()
  12. while true do
  13. id, mesreceive = rednet.receive()
  14. if id == idpc then
  15. return
  16. end
  17. end
  18. end
  19. function CheckServer(mess, id, checkmess)
  20. messend = mess
  21. idpc = id
  22.  
  23. while mesreceive ~= checkmess do
  24. parallel.waitForAny(SendResponse, ReceiveResponse)
  25. end
  26. end
  27. function ServerReturn(mess, id)
  28. messend = mess
  29. idpc = id
  30.  
  31. parallel.waitForAny(SendResponse, ReceiveResponse)
  32.  
  33. return mesreceive
  34. end
Advertisement
RAW Paste Data Copied
Advertisement