Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. ////// here is the code for the servers active connected players.
  2. function updateArma() {
  3. $.each({ chernarus: 1447962 }, function (index, id) {
  4. fetch("https://api.battlemetrics.com/servers/" + id).then(res => res.json()).then(function (json) {
  5. el = $('span#' + index); if (json.data.attributes.status == 'offline') {
  6. el.text('OFFLINE'); el.css({ "color": "red", "font-weight": 900 })
  7. return
  8. }
  9. el.text(json.data.attributes.players + "/" + json.data.attributes.maxPlayers)
  10. });
  11. });
  12. }
  13. $(document).ready(function () {
  14. updateArma()
  15.  
  16. });
  17.  
  18.  
  19. ////// here is the code for the server restart timer
  20.  
  21. function timeLeft() {
  22. var curDate = new Date();
  23. var adjustTime = curDate.getTimezoneOffset() / 60;
  24. var hoursLeft = 2 - (curDate.getUTCHours() + 6) % 3;
  25. var minutesLeft = 59 - curDate.getMinutes();
  26. var secondsLeft = 59 - curDate.getSeconds();
  27. return (hoursLeft > 9 ? hoursLeft : ("0" + hoursLeft)) + ":" + (minutesLeft > 9 ? minutesLeft : ("0" + minutesLeft)) + ":" + (secondsLeft > 9 ? secondsLeft : ("0" + secondsLeft));
  28. }
  29. $(function () {
  30. setInterval(function () {
  31. $("#exilerestarttimer").html(timeLeft());
  32. }, 1000);
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement