Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////// here is the code for the servers active connected players.
- function updateArma() {
- $.each({ chernarus: 1447962 }, function (index, id) {
- fetch("https://api.battlemetrics.com/servers/" + id).then(res => res.json()).then(function (json) {
- el = $('span#' + index); if (json.data.attributes.status == 'offline') {
- el.text('OFFLINE'); el.css({ "color": "red", "font-weight": 900 })
- return
- }
- el.text(json.data.attributes.players + "/" + json.data.attributes.maxPlayers)
- });
- });
- }
- $(document).ready(function () {
- updateArma()
- });
- ////// here is the code for the server restart timer
- function timeLeft() {
- var curDate = new Date();
- var adjustTime = curDate.getTimezoneOffset() / 60;
- var hoursLeft = 2 - (curDate.getUTCHours() + 6) % 3;
- var minutesLeft = 59 - curDate.getMinutes();
- var secondsLeft = 59 - curDate.getSeconds();
- return (hoursLeft > 9 ? hoursLeft : ("0" + hoursLeft)) + ":" + (minutesLeft > 9 ? minutesLeft : ("0" + minutesLeft)) + ":" + (secondsLeft > 9 ? secondsLeft : ("0" + secondsLeft));
- }
- $(function () {
- setInterval(function () {
- $("#exilerestarttimer").html(timeLeft());
- }, 1000);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement