tltneon / lgsl

LGSL v6.2.1/v7.0.0 for PHP 5.4-8.3+ (Live Game Server List): online status for CS2 (Source Query), Discord, FiveM, Rust, SA:MP, GMOD, Minecraft, Teamspeak and 200+ more games!
GNU General Public License v3.0
153 stars 48 forks source link

TS3 error when using custom query port. #197

Open wohahobg opened 6 months ago

wohahobg commented 6 months ago

Hello again,

for some reason when using custom query port for TS3 it give Call to a member function cutString() on int

now that's due this code

while ($val = $buffer->cutString(7 + 7 * $ver, $param[$ver][2])) {
    $key = Helper::lgslCutString($val, 0, '=');
    $items[$key] = $val;
}

so I did var_dump for $buffer above the while loop and it return 2 (int)

Example server:

        $server = new \tltneon\LGSL\Server([
            "ip" => "37.114.35.5", // server ip or hostname
            "c_port" => 9051, // for players
            "q_port" => 9152, // for querying
            "type" => "ts3" // protocol name
        ]);
        $server->lgsl_live_query("se"); // s - server info, e - extra data, p - players info
        echo '<pre>';
        print_r($server->toArray());
        echo '</pre>';

But if we do like that:

        $server = new \tltneon\LGSL\Server([
            "ip" => "37.114.35.5", // server ip or hostname
            "c_port" => 9152, // for players
            "q_port" => 9152, // for querying
            "type" => "ts3" // protocol name
        ]);
        $server->lgsl_live_query("se"); // s - server info, e - extra data, p - players info
        echo '<pre>';
        var_dump($server->isOnline());
        echo '</pre>';

setting the query port as c port is showing that the server is online, but does not return the players.

tltneon commented 5 months ago

Hi @wohahobg As I understand Teamspeak 3.12+ needs API key to get the server info

wohahobg commented 5 months ago

Hey thanks for the response @tltneon

Well i am not sure about that ?

Because when default port is used is taking information. But when is like different port than default is not working.

tltneon commented 5 months ago

I looked closer to TS3 and found that @wohahobg you're right, this is not a version problem. Privilege settings: https://www.tsviewer.com/index.php?page=faq&id=6 I added some error messages in last commit and also tried it by myself on port 10010 - everything works. Try it