Detect Low Player Servers

A userscript that detects servers with a low amount of players in them, but also not 0 players.

Versione datata 21/02/2022. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name  Detect Low Player Servers
// @description  A userscript that detects servers with a low amount of players in them, but also not 0 players.
// @author TheThreeBowlingBulbs
// @match  *://arras.io/*
// @version 1.0.0
// @namespace https://greasyfork.org/users/812261
// ==/UserScript==

// Modify setBar for client limit
let setBar = 5;

async function detector() {
    let fetchN = await fetch('https://n15rqgeh01clbn7n.d.nsrv.cloud:2222/status');
    let fetchC = await fetch('https://n15rqgeh01clbn7n.d.nsrv.cloud:2222/clientCount');
    let server = await fetchN.json();
    let client = await fetchC.json();
    let clientCount = client.clients;
    let sum = 0;
    let servers = server.status;
    console.log(servers);
    let convertArray = [];
    for (let count in servers) {
        convertArray.push(servers[count]);
    }
    for (let c = 0; c < convertArray.length; c++) {
        if (convertArray[c].clients > setBar) {
            sum = sum + convertArray[c].clients;
        }
        if (convertArray[c].clients > 0 && convertArray[c].clients < setBar) {
            console.table(convertArray[c]);
        }

    }
    console.log(clientCount - sum);
}
detector();