TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,245
  • Total Topics: 21,354
  • Online today: 565
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 170
  • Total: 171
  • @rjen

[Block ] Americas army server block help

Started by Hairy, July 19, 2007, 03:23:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hairy

**** UPDATE (split from previous server block snippet)*****

EDIT: I have a new host and have it working now, I have also updated the coding and added the maps (with new ones as well) which were lost

America's Army server status block.

In a PHP block put:
//////////////////////////////////////////////
// America's Army Server Info Block
// based on the PHP Nuke block designed by DivideByZero
//
// Redesigned and converted by Ken McNicholas for TinyPortal block
// Complete Computer Services
// August 20, 2006
//
// TinyPortal 0.86 with SMF 1.1 RC2
//
// The America's Army Server Info Block displays current players
// on a particular America's Army server.
// Set up the configuration info for the server you wish to query
//
//////////////////////////////////////////////

/*
****************************************
****************************************
*** !! User Configuration Section !! ***
****************************************
****************************************
*/

// Server IP you want to query
$aa_ip = 'XXX.XXX.XXX.XXX';
// Server Port - 1716 = default
$aa_port1 = '1716';
// Server Query Port - 1717 = default
$aa_port2 = '1717';

// Server Name
$aa_server_name = 'INSERT NAME TO SHOW HERE';
$aa_server_url = 'http://aaotracker.com/webspec/index.php?addr=';
$aa_lookup_server = 'http://www.aa-mbs.com/serverlookup.php?ip=' . $aa_ip . ':' . $aa_port1 . '';

// URL to where you put the folder containing the map pics (include a trailing slash!)
$aa_image_path = 'http://www.yourdomain.com/pathtoimages/';

// You should only need to change the map array if maps
// are added/deleted/changed, otherwise leave as is
$map = array("Bridge Crossing" => "bridge_crossing.jpg",
"Bridge SE" => "bridge_se.jpg",
"Border" => "border.jpg",
"Canyon" => "canyon.jpg",
"Collapsed Tunnel" => "collapsed_tunnel.jpg",
"District" => "district.jpg",
"Dusk" => "dusk.jpg",
"ES2Border" => "es2_border.jpg",
"FLS Assault" => "fls_assault.jpg",
"Headquarters Raid" => "headquarters_raid.jpg",
"Insurgent Camp" => "insurgent_camp.jpg",
"Interdiction" => "interdiction.jpg",
"JRTC Farm Raid" => "jrtc_farm_raid.jpg",
"Mountain Ambush" => "mountain_ambush.jpg",
"Mountain Pass" => "mountain_pass.jpg",
"Mountain Pass SE" => "mountain_pass_se.jpg",
"Mout McKenna" => "mout_mckenna.jpg",
"Oil Rig" => "oil_rig.jpg",
"OperationShroudedEagle" => "shrouded_eagle.jpg",
"Pipeline" => "pipeline.jpg",
"SF Pipeline" => "pipeline_sf.jpg",
"Radio Tower" => "radio_tower.jpg",
"River Basin" => "river_basin.jpg",
"SMU GH RiverVillage" => "river_village.jpg",
"Rummage" => "rummage.jpg",
"Steamroller" => "steamroller.jpg",
"SF Arctic" => "sf_arctic.jpg",
"SF Oasis" => "sf_oasis.jpg",
"SF Taiga" => "sf_taiga.jpg",
"SF Blizzard" => "sf_blizzard.jpg",
"SF Courtyard" => "sf_courtyard.jpg",
"SF Dockside" => "sf_dockside.jpg",
"SF Extraction" => "sf_extraction.jpg",
"SF PCR" => "sf_pcr.jpg",
"SF Water Treatment" => "sf_water_treatment.jpg",
"SF Village" => "sf_village.jpg",
"SF CSAR" => "sf_csar.jpg",
"SF Hospital" => "sf_hospital.jpg",
"SF Recon" => "sf_recon.jpg",
"SF SandStorm" => "sf_sandstorm.jpg",
"SF SnakePlain" => "sf_snakeplain.jpg",
"SMU GH SFFloodgate" => "sf_floodgate.jpg",
"SMU GH SFRefinery" => "sf_refinery.jpg",
"SMU GH SFOldTown" => "sf_old_town.jpg",
"Swamp Raid" => "swamp_raid.jpg",
"Weapons Cache" => "weapons_cache.jpg",
"Weapons Cache SE" => "weapons_cache_se.jpg",
"Woodland Outpost" => "woodland_outpost.jpg",
"Urban Assault" => "urban_assault.jpg");
                                   
/*
****************************************
****************************************
*/

//////////////////////////////////////////////
//
// The rest of this you should leave as is
// unless you are overly industrious :)
//
//////////////////////////////////////////////

// query server for game info
$aa_sock = fsockopen( "udp://" . $aa_ip, $aa_port2);
if($aa_sock != false){
socket_set_timeout($aa_sock, 0, 500000);
fwrite($aa_sock, "\\info\\");
$aa_info = @fread($aa_sock, 8192);
fclose($aa_sock);
}

// create array to hold game info
$aa_infoarr = explode("\\", $aa_info);
$aa_info = array();
$aa_infosize = count($aa_infoarr);
// since first element is unused (element 0) start at element 1
// and populate an associative array (nicer, and easier!)
for ($i = 1; $i < $aa_infosize; $i += 2){
$aa_info[$aa_infoarr[$i]] = $aa_infoarr[$i+1];
}

// get player list
$players = "";
$p = 1;
for ($i = 0; $i < $aa_info['numplayers']; $i++){
$players .= $p . ' - ' . $aa_info['player_' . $i] . '<br />';
$p++;
}

// display info
// Host name and link to detail from FO Online Server Browser
echo '<a href="' . $aa_server_url . $aa_ip . ':' . $aa_port1 . '">' . $aa_server_name . "</a><br />";
//IP:Port address
echo 'IP: ' . $aa_ip . ':' . $aa_port1 . '<br />';
// Map Name
echo 'Map: ' . $aa_info['mapname'] . '<br />';
// Players / Max Players
echo 'Players: ' . $aa_info['numplayers'] . '/' . $aa_info['maxplayers'] . '<br />';
// Round
echo 'Round: ' . $aa_info['current_round'] . '<br />';
//Mission Time
echo 'Time: ' . $aa_info['mission_time'] . '<br />';

$mappic = "";
if (array_key_exists($aa_info['mapname'], $map)){
echo '<img src="' . $aa_image_path . $map[$aa_info['mapname']] . '"><br />';
} else {
echo '<img src="' . $aa_image_path . 'unknown.jpg">';
}
echo '<a href="' . $aa_lookup_server . '">* Server Intel *</a><br />';
echo 'Current Players:<br />';
echo '<a name="scrollingCode"></a>';
// display scrolling player list
echo '<marquee behavior="scroll" align="left" direction="up" height="80" width="90%" scrollamount="2" scrolldelay="100" bgcolor="232323"
loop="infinite" onmouseover="this.stop()" onmouseout="this.start()">';
echo '<a href="' . $aa_lookup_server . '">' . $players . '</a></marquee>';


Edit the configuration section of the code to suit the server you wish to display and upload the attached maps to your site.



/EDIT
**** END UPDATE*****


I cant get it to work either  :tickedoff: My server is with SMPM and they suck, maybe thats my problem???   :-\

IP: 209.160.39.51

If someone can help it would be greatly appreciated


Cheers
Hairy

Hairy

I'm just thinking, maybe it's because I am using the latest versions of SMF and TinyPortal, is it maybe a compatiblity issue?

IchBin

TP version will not matter.

Perhaps this part in Thurnoks post is why you can't.
QuoteNOTE: Your Host provider must allow the fsockopen() php function on your server otherwise you will get no data.  Not all Host providers allow this function.  Talk to your Host provider about allowing it if they do not already.

Hairy

I asked them (SMPM) in a support ticket 4 days ago if their settings would cause that problem and they said "no" but their support is not very knowledgable   :uglystupid2:

By "host provider" does that mean the host of the "game" server or the host of your website, I only checked the "game" server host, I searched the PHP settings of my website host but could not see that command listed anywhere.

Cheers

IchBin

The web server, not the game server needs to have the fsockopen function available.

Hairy

Ok thanks mate, I will try to sort it out with my web host.

Silly me  :idiot2:

Thurnok

Yes... the fsockopen() function in php is disabled by many host providers (your webhost provider for your website).  They disable it to help prevent hacking attempts and botting.

If it is disabled by your host provider, you "might" be able to get them to open it for you.  In some cases, they will open it to a specific IP address and specific Port number which prevents it from being abused to access servers all over the world.  In that case, you need to provide them an IP address and a Port number.
Thurnok
The one, the only!

Hairy

Just got a response and the socket is open, always has been.

But reading the first post:

Quote from: knight111 on August 20, 2006, 06:26:53 PM

now mainly i am looking to get the Server scroller block goin on the new one and need help .... not sure if anyone has coded it or not ... i have searched and found a few things but i really like this block ... you can download the block at Forward observer found here

http://www.forwardobserver.us/modules.php?name=Downloads&d_op=getit&lid=25

if there is anything anyone knows about this i would really apreciate it ... love The TP block setup by the way ... very clean ... great job all

Are there extra files that are needed from that link? all I did was add the code to a block and change the settings to suit my game servers and put some map files in a images directory. (with the code for the images pointing to that folder)

If extra files are needed from the original application then I can't do it because that link is dead.

Cheers

RBakker

Download Trackers Webspectator2.2 http://aaotracker.com/downloaddb.php?file=39

it comes with an usable Maps-Pack

I've got Turnocs snipplet to work

except for the colormod of MebyMyselve ( that one gives me a parsing error: parse error: syntax error, unexpected T_STRING in /home/cs84521/public_html/Forums/Sources/Load.php(1736) : eval()'d code(35) : eval()'d code on line 67)

A solution woould be welcome but not really neccecary yet

Hairy

Thanks for everyones help but it's still not working :( I think it's something to do with my host. I even tried just using Trackers Webspectator viewer and just getting a message that the server is unavailable (the one downloaded on my website) the one on trackers website is working.

Cheers

This website is proudly hosted on Crocweb Cloud Website Hosting.