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

Recent

Welcome to TinyPortal. Please login or sign up.

April 18, 2024, 05:21:13 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 190
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 115
  • Total: 115

Americas army server block help

Started by knight111, August 20, 2006, 06:26:53 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

knight111

I have just switch from PHPnuke to the SMF 1.1 RC2 and really like it ... the only things i miss on the nuke are the Donations block and the server scroller ... here is my old site that has both for and Example:   http://acesarmy.com/main/modules.php?name=Forums

they are both setup on the left side now because the site is closed and if u hit HOME it takes u to the new site.

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

[Hairy Working America Army Server block code can be found here, Also check links in that post for updates
http://www.tinyportal.net/index.php/topic,7628.msg220631.html#msg220631    ]

G6Cad

Im pretty sure that some of the coders here will give you a hand with the army block code snippet.

Also i have seen some diffrent block code snippets for diffrent donation blocks for TP.

I will move this thread to block code and snippets board.

knight111

thx a ton wasnt sure on where to post :) will be awaiting help

thx again

IchBin

If you can give me your IP and Port I can test this to see if I can get it to work.

Thurnok

Here you go!

Place the attached files somewhere on your server.  Next, put the following code into a phpblock:

//////////////////////////////////////////////
// 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 = '8.6.76.34';
// Server Name
$aa_server_name = 'aces server';
$aa_server_url = 'http://www.forwardobserver.us/browser/foserverlist.php?ServerIP=';
$aa_lookup_server = 'http://www.aa-mbs.com/serverlookup.php?ip=' . $aa_ip . ':1716';

// Server Port - 1717 = default
$aa_port = '1717';

// 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.jpg",
"Bridge SE" => "Bridge SE.jpg",
"Collapsed Tunnel" => "Tunnel-d.jpg",
"FLS Assault" => "FLS-b.jpg",
"Headquarters Raid" => "HQ_Raid.jpg",
"Insurgent Camp" => "Insurgent_Camp-c.jpg",
"JRTC Farm Raid" => "JRTC_Farm.jpg",
"Mountain Ambush" => "Mountain_Ambush-b.jpg",
"Mountain Pass" => "Mountain_Pass.jpg",
"Mountain Pass SE" => "Mountain Pass SE.jpg",
"Mout McKenna" => "MOUT_McKenna.jpg",
"Pipeline" => "Pipeline-b.jpg",
"Pipeline SF" => "Pipeline.jpg",
"Radio Tower" => "Radio_Tower.jpg",
"River Basin" => "River_Basin-c.jpg",
"SF Oasis" => "sf_oasis.jpg",
"SF Taiga" => "sf_taiga.jpg",
"SF Blizzard" => "sf_blizzard.jpg",
"SF Courtyard" => "sf_courtyard.jpg",
"SF PCR" => "sf_pcr.jpg",
"SF Water Treatment" => "sf_water_treatment.jpg",
"SF Arctic" => "sfarctic.jpg",
"SF Village" => "sfvillage.jpg",
"SF CSAR" => "sf_csar.jpg",
"SF Hospital" => "sf_hospital.jpg",
"SF Recon" => "sf_recon.jpg",
"SF SandStorm" => "sf_sandstorm.jpg",
"Swamp Raid" => "Swamp_Raid-a.jpg",
"Weapons Cache" => "Weapons_Cache-d.jpg",
"Weapons Cache SE" => "Weapons_Cache-a.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_port);
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_info['hostname'] . "</a><br />";
//IP:Port address
echo 'IP: ' . $aa_ip . ':' . $aa_port . '<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 'Map Unavailable!<br />';
}
echo '<a href="' . $aa_lookup_server . '">* Server Intel *</a><br />';
echo '<a href="aao://' . $aa_ip . '"><img src="' . $aa_image_path . 'joinserver.gif" border="0" alt="Join Server!!"></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>';


Next, configure the code above for your information.  I don't know if there are other servers you can grab the info from, but you will definately need to set the $aa_image_path variable to the URL you can get to the images you place on your server.

NOTE: 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.

knight111

Awsome mate ... works great .... thx very very much .... if by chance u happen to get the DONATIONS block for paypal like my old site ... would bow down before you even more :) lol thx again

G6Cad

Thank you for this Turnok :)
I knew you could pull it off :)

rbh

here is an smf donation mod. it is in beta yet, but a lot of people are using it with success

http://mods.simplemachines.org/index.php?mod=413

knight111

yeah i have that one installed ... the only thing is it doesnt show like the donations does in my old Nuke forum ... was just wondering if anyone had coded it like Thurnok  so graciously did with the server scroller block

thx

IchBin

You have a link to that mod Knight111? I couldn't seem to find a download for it that worked.