Advertisement
Uhevela

Untitled

Mar 13th, 2024
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. local monitor = peripheral.find("monitor") -- Trouver le moniteur connecté
  2.  
  3. if not monitor then
  4. print("Aucun moniteur trouvé.")
  5. return
  6. end
  7.  
  8. function getTPS()
  9. local response = shell.run("tps") -- Exécute la commande tps dans le shell
  10. if response then
  11. return response
  12. else
  13. print("Erreur: Impossible de récupérer les TPS du serveur.")
  14. return nil
  15. end
  16. end
  17.  
  18. function displayTPS()
  19. local tps = getTPS()
  20. if tps then
  21. monitor.clear()
  22. monitor.setCursorPos(1, 1)
  23. monitor.write("TPS du serveur:")
  24. monitor.setCursorPos(1, 3)
  25. monitor.write("TPS: " .. tps)
  26. end
  27. end
  28.  
  29. while true do
  30. displayTPS()
  31. sleep(5) -- Mettre à jour toutes les 5 secondes
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement