Legends Calendar

Go Back   Legends Forums > Official Submissions
Register Bug Tracker FAQ Members List Calendar Search Today's Posts Mark Forums Read

Official Submissions If you have something you'd like officially added to Legends, post it here. Make sure it is good quality.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 2006-03-19, 02:45 PM
Plasma Plasma is offline
Inactive
 
Posts: 14
Reputation: 0 Plasma is a bit of a newbie
Default PHP Server Query Script

Hey,

Attached is a server query script written in php using sockets by myself which will return information about a given Legends server.

This script will return an array with key->value mappings (hostname, player count, mission name, game type, etc) as well as a list of players and their team/score/ping.

Currently the script retrieves all available info I could find, but could not figure out how to retrieve the version number returned by the server (if one even exists).

If you can figure out or know (if it exists) to find the version number of the server, feel free to reply to this thread with the appropriate code

Usage:

Code:
<?php // Include the legends query class require("legendsquery.class.php"); // Instance a new query object $q =& new LegendsQuery(); // Request server information $status = $q->query('202.0.155.69', 42000); // If $status is false, an error occured if ($status === false) die("Server did not respond or another error occured\n"); echo "Server: " . $status['hostname'] . " has " . $status['playercount'] . " players\n"; echo "Status Output:<pre>\n"; print_r($status); echo "</pre>"; ?>
Output:

Code:
Server: bittah.com || Legends has 0 players Status Output: Array ( [hostname] => bittah.com || Legends [address] => 202.0.155.69:42000 [game] => Legends [gametype] => CTF [map] => Roughland [flags] => Array ( [raw] => 5 [dedicated] => 1 [passworded] => 0 [os] => Linux ) [playercount] => 0 [maxplayers] => 16 [cpu] => 2800 [info] => Legends server hosted by www.bittah.com [players] => Array ( ) [teams] => Array ( [0] => Array ( [name] => Observer [score] => 0 [players] => 0 ) [1] => Array ( [name] => Alpha [score] => 0 [players] => 0 ) [2] => Array ( [name] => Omega [score] => 0 [players] => 0 ) ) )
Attached Files
File Type: zip legendsquery.zip (2.3 KB, 141 views)
Reply With Quote
  #2  
Old 2006-03-20, 12:56 AM
TerroX's Avatar
TerroX TerroX is offline
Developer - Admin
 
Posts: 1,661
Reputation: 4 TerroX is cool
Team: DEV
Default

good work man.
Reply With Quote
  #3  
Old 2006-03-20, 01:58 AM
RazorJack RazorJack is offline
Website Developer
 
Posts: 26
Reputation: 1 RazorJack is a bit of a newbie
Default Version Info

This will help you with the build information.

function translateVersion($version) {
if ($version == 1100) {
$version = "0.0.0";
} else {
$Major = $version >> 16;
$Inter = ($version - ($Major << 16)) >> 8;
$Minor = ($version - ($Major << 16) - ($Inter << 8));
}
return "$Major.$Inter.$Minor";
}

Send me a email at razorjack At gmail dot com sometime.

Last edited by RazorJack : 2006-03-20 at 02:01 AM.
Reply With Quote
  #4  
Old 2006-03-20, 03:09 AM
Soulhunter Soulhunter is offline
Inactive
 
Posts: 11
Reputation: 0 Soulhunter is a bit of a newbie
Default

all you need is for to drop a link that the game picks up and drops you in the server
Reply With Quote
  #5  
Old 2006-03-20, 09:39 AM
Plasma Plasma is offline
Inactive
 
Posts: 14
Reputation: 0 Plasma is a bit of a newbie
Default

Ive added master server support (Request a list of server addresses from master) in an array which you can then query if desired (otherwise its just an array of addresses).

Also added version information.
Attached Files
File Type: zip legendsquery.zip (3.0 KB, 131 views)
Reply With Quote
  #6  
Old 2006-03-20, 09:54 AM
TerroX's Avatar
TerroX TerroX is offline
Developer - Admin
 
Posts: 1,661
Reputation: 4 TerroX is cool
Team: DEV
Default

Quote:
Originally Posted by Plasma
Ive added master server support (Request a list of server addresses from master) in an array which you can then query if desired (otherwise its just an array of addresses).

Also added version information.
Might have to put a time limit on the queries too incase it was on a popular site that caused lots of refreshes - the server would ignore them if they were too frequent.
Reply With Quote
  #7  
Old 2006-03-20, 10:55 AM
Plasma Plasma is offline
Inactive
 
Posts: 14
Reputation: 0 Plasma is a bit of a newbie
Default

It takes ages to query each server anyway, anyone with a clue would cache it
Reply With Quote
  #8  
Old 2006-06-28, 08:31 AM
Gravis Gravis is offline
Inactive
 
Posts: 20
Reputation: 0 Gravis is a bit of a newbie
Question script broken?

i just found this nice php script here but upon uploading it to my server, it only output this (source):

Quote:
Status Output:<pre>
</pre>
feel free to check for yourself: http://adaptivetime.com/legends/example.php

so... has the protocol been changed? am i missing a php module? any help would be great.
Reply With Quote
  #9  
Old 2006-06-28, 08:42 AM
Plasma Plasma is offline
Inactive
 
Posts: 14
Reputation: 0 Plasma is a bit of a newbie
Default

yeh pretty sure protocol has changed - Im not updating it again though.
Reply With Quote
  #10  
Old 2006-06-28, 09:49 AM
Gravis Gravis is offline
Inactive
 
Posts: 20
Reputation: 0 Gravis is a bit of a newbie
Default

umm... are you saying you are not updating the protocol again xor that you are not updating the php script? im hoping you are willing to update the php script. if you are not going to update the php script, a chunk source code provided would also be helpful.

thanks
Reply With Quote
  #11  
Old 2006-06-28, 04:45 PM
ilys's Avatar
ilys ilys is offline
Bug Fixer / Troll
 
Posts: 2,258
Reputation: 5 ilys is cool
Team: [DEV]
Default

Legends and GG MasterServer protocol have not changed.
Reply With Quote
  #12  
Old 2006-08-06, 11:30 PM
Threatcon's Avatar
Threatcon Threatcon is offline
Inactive
 
Posts: 4
Reputation: 0 Threatcon is a bit of a newbie
Default

Is it possible for somebody to post the code that you are using here...
http://www.legendsthegame.net/index.php?m=masterserver
For both the master and individual servers?
Reply With Quote
  #13  
Old 2006-10-31, 03:07 PM
Ephialtes Ephialtes is offline
Inactive
 
Posts: 1
Reputation: 0 Ephialtes is a bit of a newbie
Default

Yeah, it'd be nice to get this code.
Reply With Quote
  #14  
Old 2006-10-31, 06:12 PM
ilys's Avatar
ilys ilys is offline
Bug Fixer / Troll
 
Posts: 2,258
Reputation: 5 ilys is cool
Team: [DEV]
Default

Denied.
Reply With Quote
  #15  
Old 2006-11-01, 11:13 AM
dirker dirker is offline
He who is not here
 
Posts: 232
Reputation: 1 dirker is o.k.
Default

Cannot do as it's a licensing problem I guess. But if you really want to do something with the master, I can tell you, it's a really simple protocol *hint*.
Reply With Quote
  #16  
Old 2006-11-01, 05:10 PM
ilys's Avatar
ilys ilys is offline
Bug Fixer / Troll
 
Posts: 2,258
Reputation: 5 ilys is cool
Team: [DEV]
Default

WAREZ! BAN!!!!!
Reply With Quote
  #17  
Old 2006-11-01, 05:21 PM
lnx lnx is offline
Legends & Veterans
 
Posts: 415
Reputation: 1 lnx is cool
Default

HAX!
You could always use Wireshark or tcpdump to dump the packets to a file then have a look.
Reply With Quote
  #18  
Old 2006-11-01, 06:50 PM
*XPF*LPBBear *XPF*LPBBear is offline
Legends & Veterans
 
Posts: 587
Reputation: 2 *XPF*LPBBear will become famous soon enough
Default

Quote:
Originally Posted by codec
Cannot do as it's a licensing problem I guess. But if you really want to do something with the master, I can tell you, it's a really simple protocol *hint*.

Ohhhhhhh, a "secret sauce"....is it mayo, ketchup, and mustard?
Reply With Quote
  #19  
Old 2006-11-01, 07:37 PM
ilys's Avatar
ilys ilys is offline
Bug Fixer / Troll
 
Posts: 2,258
Reputation: 5 ilys is cool
Team: [DEV]
Default

Homemade mayo. Bit salty tho.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Servers? - Server Query Page here? Bramage General Legends Discussion 7 2006-05-29 12:10 AM
Crash on start the map... Helloween Help/Support 16 2006-03-22 10:09 PM
Script for server query page Republican Gun Help/Support 3 2005-06-22 02:40 AM
Crash when join to any server Baochan Help/Support 8 2005-06-10 07:36 AM
Crashes While Loading! dance Bugs/Fixes 0 2004-09-19 08:30 PM

Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright, Legends Dev Team, ATI Technologies Inc. ATI and the ATI logo are registered trademarks and/or trademarks of ATI Technologies Inc. All rights reserved. The GarageGames logo is a registered trademark of GarageGames Inc. The Hit Point Music logo is a trademark of Hit Point Music. All other trademarks and logos appearing on this site are copyright of their respective owners.

All times are GMT. The time now is 10:10 PM.