J
J
jujndw2020-06-14 16:41:26
PHP
jujndw, 2020-06-14 16:41:26

How to add Rage:MP game to LGSL engine?

Hello, I'm trying to add a game to track players / number of slots, players on the server. I want to add exactly RageMP, but on the open spaces of Google I found only the FiveM protocol.

function lgsl_query_41(&$server, &$lgsl_need, &$lgsl_fp)
    {
        fwrite($lgsl_fp, "\xFF\xFF\xFF\xFFgetinfo xxx");
        $buffer = fread($lgsl_fp, 4096);

        if (!$buffer) {
            return false;
        }

        lgsl_cut_byte($buffer, 18);

        $data = explode('\\', $buffer);

        for ($i = 0; $i < count($data); $i += 2) {
            if ($data[$i] == 'sv_maxclients') {
                $server['s']['playersmax'] = $data[$i + 1];
            }

            if ($data[$i] == 'clients') {
                $server['s']['players'] = $data[$i + 1];
            }

            if ($data[$i] == 'challenge') {
                $server['e']['challenge'] = $data[$i + 1];
            }

            if ($data[$i] == 'gamename') {
                $server['e']['gamename'] = $data[$i + 1];
            }

            if ($data[$i] == 'protocol') {
                $server['e']['protocol'] = $data[$i + 1];
            }

            if ($data[$i] == 'hostname') {
                $server['s']['name'] = $data[$i + 1];
            }

            if ($data[$i] == 'gametype') {
                $server['s']['game'] = $data[$i + 1];
            }

            if ($data[$i] == 'mapname') {
                $server['s']['map'] = $data[$i + 1];
            }

            if ($data[$i] == 'iv') {
                $server['e']['iv'] = $data[$i + 1];
            }

        }

        return true;
    }


There were attempts to pull something out of the FiveM protocol, but unfortunately could not. Please help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artemy Karkusha, 2020-06-14
@artemiy_karkusha

Api Rage:MP does not provide for the receipt of a list of players by third parties. There is only support for getting a list of active players on the server side using the GetAllPlayer C# function. If you want to implement a list of servers with the number of possible slots and active players, you can parse this data from the Rage:MP masterlist page. If you want to implement the display of this data for your server, there are two ways. The one I described earlier. Just add get parameters to the request on masterlist with your server data. The second one is more complex but more reliable. You know the number of slots from the configuration file. The number of active users can also be obtained in two ways. First, use the built-in GetAllPlayer function. The second is to keep track of active users in the database. When entering the server after successful authorization, register the player as active. When this player exits, remove the flag.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question