Username:    Password:        Click Here To Signup     Forgotten Password
Main Menu
Online
Members: 0

Guests: 24

216.244.x.x user
36.248.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x dilbertplus
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.229.x.x dilbertplus
46.229.x.x dilbertplus
46.229.x.x forum
46.229.x.x forum
46.229.x.x forum
46.4.x.x forum
5.9.x.x forum
54.234.x.x forum
78.46.x.x forum

Last Seen

mrstipfan Wed 19:48
Gagi2 Mon 16:30
EFiNST0RM Sun 15:39
85filip58 Sun 12:14
brlight Tue 04:18

Newest Members

Forums
Wussie
Sun Dec 02 2012, 02:45PM

Posts: 437
Joined: Sun Mar 22 2009, 06:53AM
Registered Member #4938
Well, I finally figured out what I was doing wrong so now it works for me too, nice find there EpicFail!
I did find a few bugs though:
  • passworded servers are shown as "online" instead of "online with password".
  • one extra ghost player gets displayed on all servers: it's called "Unknown from x.y.z.w:port" and it gives away our LGSL website's IP it should not be there.
  • the "\n" character does not get correctly removed from server names and welcome messages (minor bug).

I took the liberty of correcting all these bugs by rewriting the whole code as a native LGSL5.8 function and eliminating the need for any external library. My version of this function is designed to work with both TS and TS3 servers. So this is how I did it: I started out with the original, unmodified lgsl_protocol.php; after
"tribesv" => "Tribes Vengeance",
I inserted
"ts" => "Teamspeak",
"ts3" => "Teamspeak 3",

then, after
"tribesv" => "09",
I inserted
"ts" => "97",
"ts3" => "97",

after
"tribesv" => "qtracker://{IP}:{S_PORT}?game=TribesVengeance&action=show",
I inserted
"ts" => "http://www.teamspeak.com",
"ts3" => "http://www.teamspeak.com",

after
case "tribesv" : $c_to_q = 1; $c_def = 7777; $q_def = 7778; $c_to_s = 0; break;
I inserted
case "ts" : $c_to_q = 0; $c_def = 8767; $q_def = 51234; $c_to_s = 0; break;
case "ts3" : $c_to_q = 0; $c_def = 9987; $q_def = 10011; $c_to_s = 0; break;

Then I edited the line
elseif ($lgsl_function == "lgsl_query_30")
and replaced it with
elseif ($lgsl_function == "lgsl_query_30" || $lgsl_function == "lgsl_query_97")

Then, BEFORE
function lgsl_query_feed(&$server, $request, $lgsl_feed_method, $lgsl_feed_url)
I inserted
function lgsl_query_97(&$server, &$lgsl_need, &$lgsl_fp)
{
if (strpos(fread($lgsl_fp, 4096), 'TS') === FALSE) { return FALSE; }
$ver = $server['b']['type'] == 'ts3' ? 1 : 0;
$param[0] = array('sel ','si',"\r\n",'pl');
$param[1] = array('use port=','serverinfo',' ','clientlist -country');
if ($ver) { fread($lgsl_fp, 4096); }
fwrite($lgsl_fp, $param[$ver][0].$server['b']['c_port']."\n"); // select virtualserver
if (strtoupper(substr(fread($lgsl_fp, 4096), -4, -2)) != 'OK') { return FALSE; }

fwrite($lgsl_fp, $param[$ver][1]."\n"); // request serverinfo
$buffer = fread($lgsl_fp, 4096);
if (!$buffer || substr($buffer, 0, 5) == 'error') { return FALSE; }
while (strtoupper(substr($buffer, -4, -2)) != 'OK') { $part = fread($lgsl_fp, 4096);
if ($part && substr($part, 0, 5) != 'error') { $buffer .= $part; } else { break; }
}

while ($val = lgsl_cut_string($buffer, 7+7*$ver, $param[$ver][2])) {
$key = lgsl_cut_string($val, 0, '='); $items[$key] = $val;
}
if (!isset($items['name'])) { return FALSE; }
$server['s']['name'] = $ver ? lgsl_unescape($items['name']) : $items['name'];
$server['s']['map'] = "Teamspeak";
$server['s']['players'] = intval($items[$ver ? 'clientsonline' : 'currentusers']) - $ver;
$server['s']['playersmax'] = intval($items[$ver ? 'maxclients' : 'maxusers']);
$server['s']['password'] = intval($items[$ver ? 'flag_password' : 'password']);
$server['e']['platform'] = $items['platform'];
$server['e']['motd'] = $ver ? lgsl_unescape($items['welcomemessage']) : $items['welcomemessage'];
$server['e']['uptime'] = lgsl_time($items['uptime']);
$server['e']['channels'] = $items[$ver ? 'channelsonline' : 'currentchannels'];
if ($ver) { $server['e']['version'] = lgsl_unescape($items['version']); }
if (!$lgsl_need['p'] || $server['s']['players'] < 1) { return TRUE; }

fwrite($lgsl_fp, $param[$ver][3]."\n"); // request playerlist
$buffer = fread($lgsl_fp, 4096);
while (substr($buffer, -4) != "OK\r\n" && substr($buffer, -2) != "\n\r") { $part = fread($lgsl_fp, 4096);
if ($part && substr($part, 0, 5) != 'error') { $buffer .= $part; } else { break; }
}

$i = 0;
if ($ver) {
while ($items = lgsl_cut_string($buffer, 0, '|')) {
lgsl_cut_string($items, 0, 'e='); $name = lgsl_cut_string($items, 0, ' ');
if (substr($name, 0, 15) == 'Unknown\sfrom\s') { continue; }
$server['p'][$i]['name'] = lgsl_unescape($name); lgsl_cut_string($items, 0, 'ry');
$server['p'][$i]['country'] = substr($items, 0, 1) == '=' ? substr($items, 1, 2) : ''; $i++;
}
}
else { $buffer = substr($buffer, 89, -4);
while ($items = lgsl_cut_string($buffer, 0, "\r\n")) { $items = explode("\t", $items);
$server['p'][$i]['name'] = substr($items[14], 1, -1);
$server['p'][$i]['ping'] = $items[7];
$server['p'][$i]['time'] = lgsl_time($items[8]); $i++;
}
}
return TRUE;
}
//------------------------------------------------------------------------------------------------------------+
//------------------------------------------------------------------------------------------------------------+
function lgsl_unescape($text) {
$escaped = array('\t', '\v', '\r', '\n', '\f', '\s', '\p', '\/');
$unescaped = array(' ', ' ', ' ', ' ', ' ', ' ', '|', '/');
$text = str_replace($escaped, $unescaped, $text);
return $text;
}

//------------------------------------------------------------------------------------------------------------+
//------------------------------------------------------------------------------------------------------------+

The servers now also report uptime and channels, as well as ping for TS clients and country for TS3 clients. Enjoy!


Not working for you?
Don't forget to share the IP/ports of the offending server so that people can do tests and help you.
Oh, and if you're using a modified lgsl_protocol.php, make sure you disable the feed or it may NOT work!
Website
Teo
Mon Jan 27 2014, 03:46AM

Posts: 30
Joined: Fri Oct 26 2012, 04:37AM
Registered Member #7435
yes this works properly thank you! but there is another issue i think, why in Bright Game Pannel net_status is offline when server is online?

SOF2.ORG
SoF2 Community
B2KilL.com
CoD4 Clan
Website
arman
Sun Oct 04 2015, 08:40AM
Posts: 5
Joined: Fri Oct 02 2015, 07:25PM
Registered Member #8374
This cod Not Work

Please Cheak my file :

http://s1.freeupload.ir/files/1/kd1ygymtlss115/lgsl.rar
 

Jump:     Back to top


You are not logged in - Click Here To Signup

Username:    Password:   

Mini Buttons

.... © GreyCube.com - Richard Perry - Powered by e107.org