Detect Low Player Servers

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

Verze ze dne 21. 02. 2022. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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();