Skip to content

Instantly share code, notes, and snippets.

@ajohnsen
Last active August 7, 2018 10:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajohnsen/21f7a649221694df47d0b05e519d96bc to your computer and use it in GitHub Desktop.
Save ajohnsen/21f7a649221694df47d0b05e519d96bc to your computer and use it in GitHub Desktop.
// 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