Detect Low Player Servers

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

Tính đến 21-02-2022. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

(I already have a user style manager, let me install it!)

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