Posts: 4 Joined: Sat Jan 28 2012, 03:06PM Registered Member #7094
Fatal error: Cannot redeclare writedata() in /var/www/u2310197/public_html/into-game.ru/components/com_lgsl/lgsl_files/lgsl_protocol.php on line 4092 What to do with this? Using joomla 1.5 web site.
Posts: 1 Joined: Sat Feb 25 2012, 11:30AM Registered Member #7133
So I did all by this tutorial but still all Minecraft servers are showing off. For other games it's working but I can't figure out why it doesn't get response from MC servers. I'd appreciate any help.
Posts: 1 Joined: Wed Jun 27 2012, 03:35PM Registered Member #7267
Some servers do not work wrote monitored, although they are included because they cost option enable-query = false, if you will be enable-query = true, it will display the server's normal! How do I fix this? I apologize for my English, used a translator
Sorry guys but i have bad connection, internet throught my smartphone, can't check any server right now... I'll arrive home in 5-6 hours...
That data is returned like that 'cause is an array. You are so lazy and you cannot search on google for a mc icon? ) And about maps, every server use custom maps, i mean is not like cstrike or other games... Use a minecraft logo or something right there )
I'm a little confused. Has this been fixed? I cannot find that in your query.
Posts: 166 Joined: Sun Mar 22 2009, 06:53AM Registered Member #4938
I used EpicFail's updated functions, exactly like they now appear in his first post, and they seem to work.... but...
The number of player names in the player list is smaller than $server['s']['players'], one of the names is missing because the function fails to read the first name which has pid=0. The "for" cycle should be written like this:
for ($i=0; $i<sizeof($data['players']); $i++) {
Also, the settings shown by $server['e'] look all wrong, they all get displayed together on 1 or 2 lines instead of being separated each on their own lines. This is because the "explode()" function below uses the "," character when it should be using ";", like this:
and it still needs a little work to display settings nicely by key=>value.
I can see the players list with all the names but no "time". I know minecraft servers can provide connection times for each player if queried correctly, I've seen it work on gametracker.com, so our functions need some more fixing. Maybe the query is not right, or maybe the $players array is not correctly defined inorder to include the 'time' parameter, EpicFail should know better.
These are my observations from testing multiple Bukkit 1.2.5 and 1.3.2 servers, and I am sharing them with you not as criticism, but with the hope they might lead to faster debugging. Take care!
UPDATE: Hey, I did some research today and it turns out Minecraft uses Gamespy 4 protocol for queries, which works much like gamespy3, a wellknown protocol within LGSL. This means we can use the unmodified lgsl_protocol.php, set our gametype as crysis or gamespy3 and we can get most of the server details right, including the player names. The only things that need some work are the map name and the server plugins, but that's easy to do. These days I will do the necessary modifications to one existing function for Minecraft support, then come back here and share the solution.
Posts: 166 Joined: Sun Mar 22 2009, 06:53AM Registered Member #4938
I came back as promised with the complete solution for Minecraft, which I believe to be better because it doesn't need a whole new protocol or extra functions, it uses fewer lines of code and it still displays correctly the map name, settings and players. You can start off with the original, unmodified lgsl_protocol.php and find
if ($server['b']['type'] == "bf2" || $server['b']['type'] == "bf2142") { $server['s']['map'] = ucwords(str_replace("_", " ", $server['s']['map'])); } // MAP NAME CONSISTENCY elseif ($server['b']['type'] == "minecraft") { if (isset($server['e']['gametype'])) { $server['s']['game'] = $server['e']['gametype']; } foreach ($server['e'] as $key=>$val) { if (($key != 'version') && ($key != 'plugins')) { unset($server['e'][$key]); } }
$plugins = explode(": ",$server['e']['plugins'], 2); if ($plugins[0]) { $server['e']['plugins'] = $plugins[0]; } else { $server['e']['plugins'] = 'none (Vanilla)'; } if (count($plugins) == 2) { while ($key = lgsl_cut_string($plugins[1],0," ")) { $server['e'][$key] = lgsl_cut_string($plugins[1],0,"; "); } } $buffer = $buffer."\x00"; // Needed to correctly terminate the players list }
That's it! Testing the script on lots of different servers can be tricky though... Some servers may appear offline untill you get the query port right. In Minecraft there is no clear relation between the connection port and the query port, it's all up to the server admins. Regardless of what $c_port is set, while most server admins use $q_port=$c_port, I found that some of them use $q_port=$c_port+1 and others even use $q_port=25565. Try these different $q_port values before declaring a MC server "offline". Let me know if you find any issues with this modified protocol.