Top

Half-Life Server Status 2

ver 0.9 by _KaszpiR_ http://hlds.pl


Top

Description:

PHP based server Half-Life 1 and 2 query, that returns the output to the web browser.
For use on clan pages or server info pages, for those who want to see info about server and players on their WWW.
Top

Requirements:

PHP 4.3 with fsockopen() function enabled usually means php needs to be compiled with option --enable-sockets and the fsockopen() function cannot be disabled, aditionally you bettern not have firewall or any ports blocked (or at least unblock the ones used to communicate with server ports)
Optional PHP with GD2 library
Top

Installation:

Notice: map images are not included (well, not all of them), use Google.
Top

Customization

Okay, so you managed to run the thing but it looks not as you want to - edit html files and css files.
Also - use tags . What tags to use?
Well you can set for a moment a template for specified server named showall.html then set $main['showall'] = 1; and then refresh that sterver page and go to the 80% of the page, there are the most interesting tags - anything like [mp_timelimit] can be later used like {mp_timelimit}

Some examples are at the end of this readme (tags).

Also if you edit config.php in $server[] section you can use all new entries as a tag In example you define $server[] like this (notice line about ICQ and the forum)
$server[] = array( // CS 1.6 example
	"disable"	=> 0,// if set to 1 the server is completley ignored
	"ip"		=>"192.168.1.249:27015", // serevr ip:port, can be hostname, if port ommitted default port is 27015
	"template"	=> "vertical-200px.html", // use this skin to display this server, if single mode specified
	"name"		=> "Bagno #1 CS 1.6", // show this name if connection time out
	"gameurl"	=> "halflife",
	"nicklength" => "29",
	"mapurl"	=> "../maps/halflife", //where image maps to this game are stored
	"mapext"	=> "jpg", // image maps extension
	"applaunch"	=> "30", // which application version to run, more at http://developer.valvesoftware.com/wiki/Steam_Application_IDs
	"ha"		=> "_KaszpiR_", // head admin name
	"ha_mail"	=> "kaszpir@gmail.com", // head admin mail
	"ha_icq"	=> "123456", // head admin mail
	"forum"	=> "http://clan-server-site/forum/viewforum.php?id=10", // server specific forum
	
	"timeout"	=> 1 // timeout in seconds
	);

Now you can use the tag in the template (skin file) like this:
<div>
HeadAdmin: <a href="mailto:{ha_mail}" title="Mail to {ha}"><img src="img/email.gif" /> {ha}</a>
ICQ: {ha_icq}<br/>
Server Forum is <a href="{forum}">here</a>

Nice, eh? :D

One more thing - try not tu use tags like version author url cause they will be overwritten by function.php (see the file but please do not change anthing ;D)
GL & HF
Top

Image Output mode

Since version 0.7 you can call a script in such way that it will return image, correspoding to the values.

Image output works only for single server, but of course it should not be a problem.
There are 3 methods of returning image How to use it:
You just have to call specific url to get the image, in the examples the X should be replaced by the desired server id.
- simple
index.php?id=X&img=1
- medium, by slot number
index.php?id=X&img=1&plr=1
- medium, by slot number in percent
index.php?id=X&img=1&plr=2
So you need to use the image tag like this (for server id 1, 2, 3 respecitvely, of course if you got them)
<img src="index.php?id=1&img=1" />
<img src="index.php?id=2&img=1&plr=1" />
<img src="index.php?id=3&img=1&plr=2" />

Now you put that code to your main page, forum , signature, whatever :) Oh, sorry, forums usually use BBcode and don't like strange links, sometimes we can fake them that we support image, by adding &t=.gif at the end
[img]http://your-page/hlss2/index.php?id=1&img=1&t=.gif[/img]
[img]http://your-page/hlss2/index.php?id=1&img=1&plr=2&t=.gif[/img]

Top

Iframe mode:

Incorporating script on you WWW on main page is suggested by using iframe.
Example iframe, of course if you do not call this readme form www server you will not get proper results
Some tips are in the iframe.html (of course after installation on server, so the php works).
Also in config.php try to change list.html to nano_list.html and the small.html to nano.html then see what happends.

I just used the original PQ class and stuffed it with XTemplate class. That means the php and the page design are separated in convenient way. It makes easy for designers to create the output code without needing to interfere with php code.
Top

Extra:

For coders or someone who want to change some images without needig to waste time in graphcal program to change all status images.
See Tools directory.
i.php generates massice filenames to use in config.php (edit i.php on top and run)
m.php gnerates images, edit there colors
mp.php shows images (initializes generation)
out/ - there are images generated by m.php (and mp.php)


Top

Tested with:


Top

Legal notice

This software is being provided free for all users under the GNU GPL license. See the included license.txt file for futher details.
gpl.txt - GNU General Public License
Donations are always welcome.
_KaszpiR_ http://nvt.prv.pl
Top

Special thanks to:


Top

ToDo:

- LDU mod
Top

Changelog:

0.9
- updated PsychoQuery inlcude files to work with newest Half-Life protocol

0.8
- fixed missing number zero in config.php
- added class checking when script used as include - to avoid class redeclaration under Land down Under and Seditio and other scripts using Xtemplate
- added customizable skin directory variable in config.php - now you can have skin selswere than subdirectory of hlss
	$main['skindir'] = "skin/"; //where are stored skin template files, remember to add end slash

- disabled ob_flush() on end of index.php - should be more covenient when including on some pages.

** Upgrading
- you just need to add on top of the config.php below line (if needed customize of course):
	$main['skindir'] = "skin/"; //where are stored skin template files, remember to add end slash
- overwrite inc/functions.php with new version.
- typo in the secret phrase :)

0.7
- added cache mode - speed improvement and also saves you problem with banned www server on game server
	in older versions if there were too many queries about server status from certain
	ip, then that ip got banned on game server (the game server wasignoring status request)
	that caused that you could no more get server status info
	the cache is updating server status from time to time, - increases speed and 
	decreases ban possibilty to almost zero (well unless you suddenly get over 100 hits 
	to www in one specified second when the scrit was updating server status, but tis is extremely rare)

- added option to output images
- added some tags in config for:
	mapsurl - given some examples (to suit better cs and cs:s)
	gameurl - for use in template to change path to maps images and game mod icons
	applaunch - example to activate game launch when klicking on server ip

- added special char change in player names
- added tag player_shortname if you want list with truncated nicknames
- added some small tools for image generation
- changed readme.txt
- added doc/ dir
- moved readme.txt to doc/readme.html and made it HTML
- minor typos fixed
- favicon in some .html (templates)

0.6
- rewritten config
- changed direcotry structure (cleaner)
- if calling with id=0 (that means alist all servers, server uses only one template, 
	and does not include, separate templates specfic for each server
	this was introduced for security reasons
- output buffering (i forgot :D)
- renamed .tpl to .html, better usage for morons
- few examples like nano, and nano_list
- the idea for users how and which tags to use (at the end of readme)

0.5 unreleased (or if realeased, the do not use it)
- added option to parse the GET['id'], so if you run your script like index.php? it shows all
  servers in a list, and if you run index.php?id=0 it will display only server number zero 
  that is a first server in a config.php, use respectively index.php?id=1 for second server etc.

  notice this required .tpl change.

0.4
- minor tweaks

0.3
- initial release

Top

Powered by:

Psycho Query PHP script from Psychostats 2.3.1 http://www.psychostats.com/
Psychostats created by Jason Morriss aka. "Stormtrooper"
xtemplate class 0.3pre + MODIFIED FOR LDU Website engine http://www.neocrome.net / read below
html generation with templates - fast & easy
copyright (c) 2000-2001 Barnabás Debreceni [cranx@users.sourceforge.net]

latest stable & CVS versions always available @
http://sourceforge.net/projects/xtpl/

Modifcations made by Olivier "Neuro" C. (http://www.neocrome.net) :

* 10-jun-2003 :
- Function assign modified, for parsing of arrays in arrays.

* 02-feb-2004 :
- Added the function out_to_file
- Commented out the "header(content-length)".
- Commented out the error message if block do not exists.

Top

Tags

Universal use of PHP varaibles
use {PHP.variable_name}, also works with arrays!
like {PHP.array_name.sub_array_name.key}
in example {PHP._SERVER.SERVER_NAME}
Between PLAYERS
in example {player_id}
[player_name] => [P0D]Trust Noone "(88)"
[player_id] => 5
[player_kills] => 1
[player_time] => 225
[player_time_min] => 00:03:45
[player_shortname] => [P0D]Trust...
[i] => 0
[j] => 1
notice: j is the row number
i is the infomation if the row number is divisible by two without the rest ( i = j modulo 2)

they are useful for making player rows different with css, i suggest you see list.html and search for row{i}

Between STATUS
in exampe {template}, {skin} or {map}
	    [disable] => 0
            [ip] => 192.168.1.1
            [template] => showall.html
            [name] => Szambo
            [ha] => 
            [ha_mail] => 
            [timeout] => 0
            [id] => 4
            [skin] => showall
            [ping] => 11
            [ipport] => 192.168.1.1:27015
            [port] => 27015
            [int_ipport] => 127.0.0.1:27015
            [int_port] => 27015
            [int_ip] => 127.0.0.1
            [map] => de_nuke
            [gamedir] => cstrike
            [gamename] => Counter-Strike
            [totalplayers] => 5
            [maxplayers] => 20
            [protocol] => 47
            [servertype] => d
            [serveros] => l
            [serverlocked] => 0
            [modrunning] => 1
            [modurl] => www.counter-strike.net
            [modftp] => 
            [modver] => 1.0
            [modsize] => 184000000
            [modserveronly] => 0
            [modclientdll] => 1
            [hlss_update_time] => 1141777570
            [update_time] => 2006-03-08

Between Status with use of rules
in example {rules.amx_nextmap} {rules.mp_timelimit} etc
notice, if the variable does not exist, the result will be empty string
that's why you can mix tags from varius requests (HL1 or HL:Source) in certain places and you get proper output (example is around nextmap)
[rules] => Array
(
    [_tutor_bomb_viewable_check_interval] => 0.5
    [_tutor_debug_level] => 0
    [_tutor_examine_time] => 0.5
    [_tutor_hint_interval_time] => 10.0
    [_tutor_look_angle] => 10
    [_tutor_look_distance] => 200
    [_tutor_message_character_display_time_coefficient] => 0.07
    [_tutor_message_minimum_display_time] => 1
    [_tutor_message_repeats] => 5
    [_tutor_view_distance] => 1000
    [allow_spectators] => 1
    [amx_match_deluxe] => 1.72
    [amx_nextmap] => cs_estate
    [amx_timeleft] => 17:51
    [amx_version] => 0.9.9b (5 modules)
    [atac_version] => 2.5.3
    [coop] => 0
    [deathmatch] => 1
    [decalfrequency] => 30
    [edgefriction] => 2
    [fun_version] => 0.9.9b
    [hostage_debug] => 0
    [hostage_stop] => 0
    [humans_join_team] => any
    [max_queries_sec] => 1
    [max_queries_sec_global] => 1
    [max_queries_window] => 1
    [metamod_version] => 1.17.3
    [mp_allowmonsters] => 0
    [mp_autokick] => 0
    [mp_autoteambalance] => 0
    [mp_buytime] => 0.25
    [mp_c4timer] => 35
    [mp_chattime] => 10
    [mp_consistency] => 1
    [mp_fadetoblack] => 0
    [mp_flashlight] => 1
    [mp_footsteps] => 1
    [mp_forcecamera] => 2
    [mp_forcechasecam] => 1
    [mp_fragsleft] => 0
    [mp_freezetime] => 6
    [mp_friendlyfire] => 1
    [mp_ghostfrequency] => 0.1
    [mp_hostagepenalty] => 0
    [mp_kickpercent] => 0.66
    [mp_limitteams] => 0
    [mp_logdetail] => 3
    [mp_logfile] => 1
    [mp_logmessages] => 1
    [mp_mapvoteratio] => 0.66
    [mp_maxrounds] => 0
    [mp_mirrordamage] => 0
    [mp_playerid] => 0
    [mp_roundtime] => 1.75
    [mp_startmoney] => 800
    [mp_timeleft] => 0
    [mp_timelimit] => 20
    [mp_tkpunish] => 0
    [mp_windifference] => 1
    [mp_winlimit] => 0
    [pausable] => 0
    [smyga_plugin] => ;Destuckme 2.1;
    [sv_accelerate] => 5
    [sv_aim] => 0
    [sv_airaccelerate] => 10
    [sv_airmove] => 1
    [sv_allowupload] => 1
    [sv_alltalk] => 0
    [sv_bounce] => 1
    [sv_cheats] => 0
    [sv_clienttrace] => 1
    [sv_clipmode] => 0
    [sv_contact] => 
    [sv_friction] => 4
    [sv_gravity] => 800
    [sv_logblocks] => 1
    [sv_maxrate] => 20000
    [sv_maxspeed] => 320
    [sv_minrate] => 0
    [sv_password] => 0
    [sv_proxies] => 1
    [sv_region] => 3
    [sv_restart] => 0
    [sv_restartround] => 0
    [sv_stepsize] => 18
    [sv_stopspeed] => 75
    [sv_uploadmax] => 0.5
    [sv_voiceenable] => 1
    [sv_wateraccelerate] => 10
)

HLSS2 specific tags
{version} = "0.7"
{url} = "http://hlds.pl"
{author} = "_KaszpiR_"

Ed of file. Top.