Last active
August 7, 2018 10:48
-
-
Save ajohnsen/21f7a649221694df47d0b05e519d96bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Little code to update every players VAC status on headshotbox | |
function getData(offset) { | |
console.log("Fetching new data, offset: " + offset); | |
$.ajax("http://" + window.location.host + "/api/players?limit=100&offset=" + offset).done( | |
function(data) { | |
if (data.player_count > offset) { | |
var players = data.players.map( | |
function(p) { | |
return p.steamid; | |
}); | |
var url = getPlayerSummaries(players); | |
getBan(url, offset); | |
} else { | |
alert("Update done"); | |
} | |
}) | |
} | |
function getBan(url, offset) { | |
$.ajax(url).done(function(data,textStatus) { | |
getData(offset + 100) | |
}).fail(function(data) { | |
getBan(url, offset); | |
}) | |
} | |
getData(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment