Advertisement
Skillkiller

Online/Offline Checker

Jul 19th, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. --Online Ofline Player Checker
  2. wModul = "top"
  3. OnlinePlayer = "left"
  4. Protokoll = "1900Info"
  5.  
  6. --Code
  7. shell.run("clear")
  8. print("Online / Offline Checker")
  9. print("")
  10. print("In Betrieb")
  11.  
  12. function check()
  13. local event = os.pullEvent("redstone")
  14. if redstone.getInput(OnlinePlayer) == true then
  15.   rednet.broadcast("Benutzer ging Online", Protokoll)
  16. else
  17.   rednet.broadcast("Benutzer ging Offline", Protokoll)
  18. end
  19. end
  20.  
  21. function status()
  22. senderId, message, protocol = rednet.receive("1900Player")
  23. if message == "status?" then
  24.   if redstone.getInput(OnlinePlayer) == true then
  25.     rednet.send(senderId, "Online", "1900Player")
  26.   else
  27.     rednet.send(senderId, "Offline", "1900Player")
  28.   end
  29. end
  30. end
  31.  
  32. rednet.open(wModul)
  33.  
  34. while true do -- Endloschleife
  35.   parallel.waitForAny(status, check)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement