1. Hello everyone,

    Does anybody know how can I display a list of online players live in the browser, with PHP or any other language.
    It's not for my own server, it's for any mta server that is online, so I just change the IP and PORT, and it displays the data from another server.

    Something like the game-state.com displays: https://www.game-state.com/

    I tried something like this, and it does work, but sometimes it just doesn't display anything, I don't know why. Most of the time it does work, but when it doesn't, game-state still works.

    PHP Code:
    $sec "10";
        <meta http-equiv="refresh" content="<?php echo $sec?>;URL='<?php echo $page?>'">
    $port '22003'
    $socket fsockopen 'udp://' $ip$port+123$errno$errstr ); 
    socket_set_timeout $socket1); 
            if ( 
    $socket ) { 
    fwrite $socket's' ); 
    $data fread $socket16384 ); 
    fclose $socket ); 
    I can't use game-state, because I need the data, so I can do something else with it later, and I know it's not the best option to refresh the whole page every 10 seconds, but for what I need, it's ok.

    If anyone has any solution, please let me know, and thanks in advance!

  2. Re: [HELP] Server online stats 06-09-2019, 13:53 • #2
    Yeah I took a xan, I hope u understand

  3. Re: [HELP] Server online stats 06-09-2019, 14:03 • #3
    Not exactly what I need, that's for displaying whether the server is online or not. I need to display the player list on the server, but thank you!

  4. Re: [HELP] Server online stats 06-09-2019, 14:39 • #4
    You can use javascript, for example,

    PHP Code:
    <script type="text/javascript">
    showPlayers0() {
    document.getElementById("players0").style.display == "none") {
            if ($(
    "#players0").attr("shown") == "false") {
    document.getElementById("players0").style.display "block";
    get"js/ajax.php?t=players", function( data ) {
    pData JSON.parse(data)[0];
    document.getElementById("playersSpinner").style.display "none";
                    for (var 
    i in pData["players"]) {
    "#players0").append("<li><a href=\"?pg=viewprofile&login=" pData["players"][i]["acc"] + "\">" pData["players"][i]["nick"] + "</a></li>");
            } else {
    document.getElementById("players0").style.display "block";
        } else {
    document.getElementById("players0").style.display "none";
    If u know php then it ll be easy for u.
    Yeah I took a xan, I hope u understand
    1 Like

1 Users reading this thread (0 Members and 1 Guests)