Advertisement
Guest User

playercount

a guest
Jan 22nd, 2020
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. //Based on a pen done on codepen by @robinselmer
  2.  
  3. //Change there the server IP. Set the IP and the port here.
  4. //E.g.:
  5. //note: use: var url = "https://api.minetools.eu/ping/<server ip>/<server port>";
  6. //E.g.:
  7. //var url = "https://api.minetools.eu/ping/104.13.120.110/25565";
  8.  
  9.  
  10. function servername() {
  11. document.title = prompt('Modify the title', document.title);
  12. }
  13.  
  14.  
  15. var url = "https://api.minetools.eu/ping/104.13.120.110/25565";
  16. //https://mcapi.us/server/status?ip=104.13.120.110&port=25565
  17. $.getJSON(url, function(r) {
  18. //data is the JSON string
  19. if(r.error){
  20. $('#rest').html('0');
  21. return false;
  22. }
  23. var pl = '';
  24. if(r.players.sample.length > 0 ) { pl = r.players.sample[players].name}
  25. $('#rest').html(r.players.online+pl);
  26.  
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement