English Get player count JSON

41 replies
Goto Page
To the start Previous 1 2 3 Next To the start
09.05.20 07:36:14 pm
Up
Mami Tomoe
User
Offline Off
Okay, but how do I start?
Do I compile PHP? Do I need a website host or just a VPS to run it?
How to run whatever he just sent and then how to use it?
02.06.20 12:12:29 pm
Up
BuhaloStrikalo
User
Offline Off
Im using XMLHttpRequest for my discord server.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var xhr = new XMLHttpRequest();
//     80.211.225.24:36963

    //(`http://www.unrealsoftware.de/inc_pub/serverinfo.php?i=80.211.225.24&p=36963&g=0&123`)

function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min)) + min;
    }

let gotPlayers = (() => {
    let rand = getRandomInt(1,100)
    xhr.open("GET", "http://www.unrealsoftware.de/inc_pub/serverinfo.php?i=80.211.225.24&p=36963&g=0&" + rand, true);
    xhr.onload = function (){
        let text = xhr.responseText
        var fPlayer = text.lastIndexOf('Player');
        text = text.substr(fPlayer,23)
        text = text.substr(17)
        let newname = 'Online: ' + text
        return text 
    }
    xhr.send(null)
});
To the start Previous 1 2 3 Next To the start