AlliedModders Donor
|
![Old](images/statusicon/post_old.svg)
07-29-2009
, 04:16
Re: [L4D] PounceRecord 1.1
|
#17
|
Here's my release of my customized Web Interface.
Features:
* Fixes bug when there are more than 999 pounces in database
* Lets you choose whether you want to only display pounces made on official maps or not (in config.php).
* Lets you choose whether to show pounces made by bot hunters or not (in config.php).
* Lets users search pounces by name of pouncer or victim or both
Download the zip in the attachment, (or click here) and upload it to your webserver. You will need to reconfigure config.php if you already have the web interface on your server.
Live preview here: http://theelders.clanservers.com/pounces/
===Older two posts merged here===
Here's an addition to the web interface I created and am using.
It lets you choose whether you:
a) Only want to see pounces made on official maps
or
b) See pounces made on any map.
Changes:
Add this to config.php before the ?> at the end of the file:
PHP Code:
// Show pounces made on official maps only? 0=no, 1=yes $officialonly = 1;
Replace connect.php with this:
PHP Code:
<?php /* ----------------------------------------- Hunter Top Pounces PHP Module Created by Daniel 'Icettiflow' McCall [email protected] ----------------------------------------- | DATABASE CONNECTION FILE | ----------------------------------------- */ // Connect to DB mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to MySQL'); mysql_select_db($dbname); // Get SQL Data $total = mysql_query("SELECT * FROM pounces"); $playercount = number_format(mysql_num_rows($total)); // Determine possible rows for display if($showbots==0) { if($officialonly==1) { $query = mysql_query("SELECT * FROM pounces WHERE pounced NOT IN ('Zoey','Francis','Bill','Louis') && map IN ('l4d_vs_hospital01_apartment', 'l4d_vs_hospital02_subway', 'l4d_vs_hospital03_sewers', 'l4d_vs_hospital04_interior', 'l4d_vs_hospital05_rooftop', 'l4d_vs_airport01_greenhouse', 'l4d_vs_airport02_offices', 'l4d_vs_airport03_garage', 'l4d_vs_airport04_terminal', 'l4d_vs_airport05_runway', 'l4d_vs_smalltown01_caves', 'l4d_vs_smalltown02_drainage', 'l4d_vs_smalltown03_ranchhouse', 'l4d_vs_smalltown04_mainstreet', 'l4d_vs_smalltown05_houseboat', 'l4d_vs_farm01_hilltop', 'l4d_vs_farm02_traintunnel', 'l4d_vs_farm03_bridge', 'l4d_vs_farm04_barn', 'l4d_vs_farm05_cornfield') ORDER BY distance DESC"); }else{ $query = mysql_query("SELECT * FROM pounces WHERE pounced NOT IN ('Zoey','Francis','Bill','Louis') ORDER BY distance DESC"); } }else{ if($officialonly==1) { $query = mysql_query("SELECT * FROM pounces WHERE map IN ('l4d_vs_hospital01_apartment', 'l4d_vs_hospital02_subway', 'l4d_vs_hospital03_sewers', 'l4d_vs_hospital04_interior', 'l4d_vs_hospital05_rooftop', 'l4d_vs_airport01_greenhouse', 'l4d_vs_airport02_offices', 'l4d_vs_airport03_garage', 'l4d_vs_airport04_terminal', 'l4d_vs_airport05_runway', 'l4d_vs_smalltown01_caves', 'l4d_vs_smalltown02_drainage', 'l4d_vs_smalltown03_ranchhouse', 'l4d_vs_smalltown04_mainstreet', 'l4d_vs_smalltown05_houseboat', 'l4d_vs_farm01_hilltop', 'l4d_vs_farm02_traintunnel', 'l4d_vs_farm03_bridge', 'l4d_vs_farm04_barn', 'l4d_vs_farm05_cornfield') ORDER BY distance DESC"); }else{ $query = mysql_query("SELECT * FROM pounces ORDER BY distance DESC"); } } $listings = number_format(mysql_num_rows($query)); if($listings<$maxplayers) $displaynumber = $listings; else $displaynumber = $maxplayers; ?>
Feel free to include this in the official version.
Also here's a suggestion for notifying players of a record-breaking pounce.
Because pounces beating the highest damage/distance overall won't occur very often, notify players if they break a record for the current map they are on too.
---------------------
Here's a bug fix for an issue occuring when there are more than 999 pounces in the database.
Bug resolved!
number_format() is being run on the number of listings, so if there are 1000 or more, commas are added! This screws up the listings<maxplayers logic later.
Here's how to fix this:
Either download the .zip attached to the post, and upload it to your webserver in the same directory as the default interface (note: this will overwrite my modification above)
or:
1) Open connect.php
2) Find the line $listings = number_format(mysql_num_rows($query));
3) Replace that line with this:
PHP Code:
$listings = mysql_num_rows($query);
Here's a bonus:
To get the display number to show up all nicely with the comma in it, follow these steps:
1)Open template.tpl
2) Find the line "Displaying the top <?=$displaynumber;?> pounces out of a total of <?=$playercount;?> pounces in the database."
3) Replace it with this:
PHP Code:
Displaying the top <?=number_format($displaynumber);?> pounces out of a total of <?=$playercount;?> pounces in the database.
Last edited by crazydog; 07-29-2009 at 14:23.
|
|