Jump to content

[BF4] Stats webpage for XpKiller's Stats Logger Plugin


tyger07

Recommended Posts

  • Replies 1.7k
  • Created
  • Last Reply

Originally Posted by Kinsman*:

 

Other question, why the first seen and last seen are no longer appear in player statistics ?
Thank for your reply :smile:
You will want to add to the query.

Code:
// get player stats
        $player_data_result = @mysql_query("SELECT tpd.CountryCode, tpd.SoldierName, tps.Suicide, tps.Score, tps.Kills, tps.Deaths, tps.TKs, tps.Headshots, tps.FirstSeenOnServer, tps.LastSeenOnServer, tps.Rounds, tps.Wins, tps.Losses, tps.Playtime, tps.Killstreak, tps.Deathstreak FROM tbl_playerstats tps INNER JOIN tbl_server_player tsp ON tsp.StatsID = tps.StatsID INNER JOIN tbl_playerdata tpd ON tsp.PlayerID = tpd.PlayerID WHERE tsp.ServerID = '$server_ID' AND SoldierName = '$player_name'");
        // if no stats were found for player name, display this
Then add how you like.

Code:
$firstseen = $player_data_result_row['FirstSeenOnServer'];
            $lastseen = $player_data_result_row['LastSeenOnServer'];
            $playtime = $player_data_result_row['Playtime'];
            $wins = $player_data_result_row['Wins'];
            $losses = $player_data_result_row['Losses'];
            $wlr = round(($wins / $losses),2);
            // fix huge wlr division error
            if($losses == 0.0001)
            {
                $wlr = ($wlr / 10000);
            }
            // fix tiny wlr division error
            if($wlr == 0.0001)
            {
                $wlr = 0;
            }
            echo '
            <div class="innercontent">
            
            <table width="90%" align="center" border="0">
            <tr>
            <td style="text-align: left;" width="10%"> </td>
            ';
            // search the country array for the country code of interest and assign the full name to a variable
            $country = array_search($CountryCode,$country_array);
            echo '
            <td width="30%" style="text-align: left;"> <font class="information">Country: </font> <img src="' . $country_img . '" alt="' . $country_name . '"/> ' . $country . '<font class="information"> (</font> ' . $CountryCode . '<font class="information">)</font></td>
            <td width="30%" style="text-align: left;"> <font class="information">Score: </font> ' . $Score . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Rounds Played: </font> ' . $Rounds . '</td>
            </tr>
            <tr>
            <td style="text-align: left;" width="10%"> </td>
            <td width="30%" style="text-align: left;"> <font class="information">First Visit: </font> ' . date('d-m-Y', strtotime($firstseen)) . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Last Visit: </font> ' . date('d-m-Y', strtotime($lastseen)) . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Hours Played: </font> ' . number_format(($playtime/60/60), 2, '.', '') . '</td>
            </tr>
            <tr>
            <td style="text-align: left;" width="10%"> </td>
            <td width="30%" style="text-align: left;"> <font class="information">Kills: </font> ' . $Kills . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Deaths: </font> ' . $Deaths . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Kill / Death Ratio: </font> ' . $KDR . '</td>
            </tr>
            <tr>
            <td style="text-align: left;" width="10%"> </td>
            <td width="30%" style="text-align: left;"> <font class="information">Wins: </font> ' . $wins . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Losses: </font> ' . $losses . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Win / Loss Ratio: </font> ' . $wlr . '</td>
            </tr>
            <tr>
            <td style="text-align: left;" width="10%"> </td>
            <td width="30%" style="text-align: left;"> <font class="information">Killstreak: </font> ' . $Killstreak . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Deathstreak: </font> ' . $Deathstreak . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Team Kills: </font> ' . $TKs . '</td>
            </tr><tr>
            <td style="text-align: left;" width="10%"> </td>
            <td width="30%" style="text-align: left;"> <font class="information">Headshots: </font> ' . $Headshots . '</td>
            <td width="30%" style="text-align: left;"> <font class="information">Headshot Ratio: </font> ' . $HSpercent . '<font class="information"> %</font></td>
            <td width="30%" style="text-align: left;"> <font class="information">Suicides: </font> ' . $Suicides . '</td>
            </tr>
            </table>
            </div>
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Yes, each map for each game mode.

1: Siege of Shanghai MP_Siege Domination 34 1.42

2: Siege of Shanghai MP_Siege SmallConquest 20 1.10

 

Other question, why the first seen and last seen are no longer appear in player statistics ?

 

Thank for your reply :smile:

As far as first seen / last seen, the reason it was excluded was because I personally didn't think that information was as relevant as the other stats and needed to leave it out to make an even row length.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Kinsman*:

 

Does anybody know how we could calculate total dogtags taken? I have managed to add Dogtag Victims, and also added a total column to the dogtags table.

 

http://jw.servegame.org/bf4stats/ser..._player=Search

 

But Total Dogtags displayed as a number eludes me.

 

If i can fix that I'll tidy up some stuff and post a zip of the file for anybody to use.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Does anybody know how we could calculate total dogtags taken? I have managed to add Dogtag Victims, and also added a total column to the dogtags table.

 

http://jw.servegame.org/bf4stats/ser..._player=Search

 

But Total Dogtags displayed as a number eludes me.

 

If i can fix that I'll tidy up some stuff and post a zip of the file for anybody to use.

The stats page already sort of displays total dogtags taken in the weapons area. Dog tags are obtained through weapon melee. Every dog tag should be accompanied by one weapon melee kill in a perfect world.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Kinsman*:

 

Aha thanks, but your dogtag code seems far more accurate than melee?

 

in this example their are 44 victims, for a total of 48 dogtags. Melee only shows 46 kills.

 

What I was attempting to do was display your dogtag table as a result Total Dogtags: 48, I know I need to sum $KillCount by the Count (no rows), but PHP and Maths are not my strong suit. :sad:

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

For review, here is the dog tag victim query as the stats page currently uses it:

 

$player_dogtag_result = @mysql_query("SELECT tpd.SoldierName AS Killer, dt.Count , tpd2.SoldierName AS Victim FROM tbl_dogtags dt INNER JOIN tbl_server_player tsp ON tsp.StatsID = dt.KillerID INNER JOIN tbl_server_player tsp2 ON tsp2.StatsID = dt.VictimID INNER JOIN tbl_playerdata tpd ON tsp.PlayerID = tpd.PlayerID INNER JOIN tbl_playerdata tpd2 ON tsp2.PlayerID = tpd2.PlayerID WHERE tpd.SoldierName = '$player_name' AND tsp.ServerID = '$server_ID' ORDER BY Count DESC");

 

 

If you wanted to count and display the number of victims in the header alone (instead of adding them up in the list), add this after the above query:

 

$num_rows = @mysql_num_rows($player_dogtag_result);

 

Then, you could say something like:

 

echo 'This player has taken dog tags from ' . $num_rows . ' victims';

 

That number would not be the number of dog tags collected, only the number of victims dog tags have been taken from. Since a victim could have their dog tag taken multiple times, the number of dog tags could be higher than the number of victims.

 

 

If you want to count the total number of individual dog tags taken and not worry about who the victims were or how many were taken from each victim, use the following query:

 

SELECT SUM(dt.Count) AS Tags

FROM tbl_dogtags dt

INNER JOIN tbl_server_player tsp ON tsp.StatsID = dt.KillerID

INNER JOIN tbl_playerdata tpd ON tsp.PlayerID = tpd.PlayerID

WHERE tpd.SoldierName = '$player_name' AND tsp.ServerID = '$server_ID'

 

The output is 'Tags'.

 

For example, if I execute this query in my old version of your database:

 

SELECT SUM( dt.Count ) AS Tags

FROM tbl_dogtags dt

INNER JOIN tbl_server_player tsp ON tsp.StatsID = dt.KillerID

INNER JOIN tbl_playerdata tpd ON tsp.PlayerID = tpd.PlayerID

WHERE tpd.SoldierName = 'Mrs_Teletubby'

AND tsp.ServerID = '3'

 

I get this output:

 

Tags

12

 

That is the total number of dog tags collected by Mrs_Teletubby in server ID 3 in my old version of your database.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

The strange thing is that each dog tag should be associated with a melee kill. In your case, your stats show otherwise. This is odd. If you take your 46 melee kills and your 2 defib kills, you get a sum of 48. I would ask xpkiller if his plugin for some reason counts a defib kill as a dog tag.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Porthos1973*:

 

Does anybody know how we could calculate total dogtags taken? I have managed to add Dogtag Victims, and also added a total column to the dogtags table.

 

http://jw.servegame.org/bf4stats/ser..._player=Search

 

But Total Dogtags displayed as a number eludes me.

 

If i can fix that I'll tidy up some stuff and post a zip of the file for anybody to use.

Kinsman, is your version on the github? I am going to attempt again(totally screwed things up last time) to use one database for both of my servers and like the way you have everything set up.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Kinsman, is your version on the github? I am going to attempt again(totally screwed things up last time) to use one database for both of my servers and like the way you have everything set up.

Porthos, he is using my code which is in the first post of this thread.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Porthos1973*:

 

Porthos, he is using my code which is in the first post of this thread.

Yeah I have used yours and like it but like the additions he has added so was wondering if he would share his current set up.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Yeah I have used yours and like it but like the additions he has added so was wondering if he would share his current set up.

I don't know which specific additions you are referring to so could not consider adding them to the parent code, but I would advise everyone to branch off the github I have posted in the first thread rather than posting their own version as if it were their own personal code. One reason of course is credit and the other reason is fragmentation mitigation.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Porthos1973*:

 

I don't know which specific additions you are referring to so could not consider adding them to the parent code, but I would advise everyone to branch off the github I have posted in the first thread rather than posting their own version as if it were their own personal code. One reason of course is credit and the other reason is fragmentation mitigation.

Thanks for mentioning the branches. I had went to github and did not see any branches which is why I came here and asked.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

I want to update this code when I have a chance. I want to add the expansion pack and make the index page and stats pages all one page and have the code automatically find all available servers in the database.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Kinsman*:

 

That would be awesome, I've pretty much finished my meager tinkering and waiting for the next update now.

 

http://jw.servegame.org/bf4stats/ser..._player=Search

 

http://jw.servegame.org/bf4stats/server.php_id=2

 

Global Stats from across all servers has pretty much defeated me, these are the ONLY ones I know that are working correctly.

 

http://jw.servegame.org/bf4stats/pubplayer.php_id=Spudx

 

I can throw all that in a zip for ideas, and update your DB to 17,000 players if that helps.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Consolidating all servers into one file and automatically finding all servers in the database is under way. When it is finished, all you should need to do is provide your database connection details in the common file and nothing else.

 

In the mean time, if you view my demo pages, they are a mess as work is in progress.

 

Since the battlelog link is not in the database, I am using this alternative for the server join buttons in order to avoid users having to manually add battlelog links (the point is to make everything automatic):

 

$battlelog = 'http://battlelog.battlefield.com/bf4/servers/pc/_filtered=1&expand=0&useAdvanced=1&q=' . $ServerName;

 

Example:

 

http://battlelog.battlefield.com/bf4...01000Tx%20-%20

 

Instead of:

 

http://battlelog.battlefield.com/bf4...1000Tx-PBBANS/

 

Is that acceptable?

 

It won't bring you directly to the server's page since I don't think that is possible using the information available, but it does a battlelog search for that identical server name so the results should still be acceptable.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Kinsman*:

 

if you check the latest db I added for you, you will see i simply added "links" to the server table, and actually am storing them in the DB. Wouldn't be hard to run an sql to add that. Also all my links only need the server code itself, not the whole link, which makes life easier. (3c23b12d-da3c-4476-ba31-38f4630752ef).

 

Join Server

 

I'm also interested in what stats can be made global across all servers, so far these work ok, though SPM is just a calculation of your total score/time so not actually your BL SPM, as that uses teamscore, squad score etc etc.

 

http://jw.servegame.org/bf4stats/pub...php_id=MasoAus

 

And these server top 10's are ok, but theres no way to make them global.

 

http://jw.servegame.org/bf4stats/server.php_id=3

 

Attached Files:

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

if you check the latest db I added for you, you will see i simply added "links" to the server table, and actually am storing them in the DB. Wouldn't be hard to run an sql to add that. Also all my links only need the server code itself, not the whole link, which makes life easier. (3c23b12d-da3c-4476-ba31-38f4630752ef).

Yes, I saw that. But it is not standard and the majority of people will not have that information in their database. Since I am making this all automatic for users who do not know how to access a database or find server ids and so forth, I cannot expect those users to modify their database and insert battlelog links into their database.

 

There is no way to make this code automatically find battlelog links and insert them into the database since there is no way to reliably automatically find battlelog links. So, that option is out. Doing a server search for the identical server name is much more automated.

 

I'm also interested in what stats can be made global across all servers, so far these work ok, though SPM is just a calculation of your total score/time so not actually your BL SPM, as that uses teamscore, squad score etc etc.

Yes, I plan to add global stats to the index page once the index page is created. The automated index page hasn't even been created yet.

 

I don't find SPM to be accurate. Therefore, I do not include it. For one, it does not include any bonuses (as you mentioned). Secondly, XpKiller's plugin does not seem to accurately monitor player's joining and leaving times for some reason in some situations. I have seen a player counted as being in an empty server for hours when they are actually not in the server at all. If their play time is not accurate, their SPM will be all screwed up. If SPM is all randomly screwed up, there is no valid comparisons to make between players. This is the same reason I have not included "total play time".

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Haha yeah, maybe I should make that read as Total Recorded Playtime :biggrin:

 

No problem with the links, I'll just edit in our server details, as I much prefer to open the server page.

Ok, sounds good.

 

This will take me a while to release since I am doing a lot of different things at once. I am just starting from the top and working down and have a long ways to go.

 

Highlights:

- SQL injection security fix by only allowing expected inputs

- New code structure splitting code into different files in the common folder to make finding what you are looking for easier

- One single index file which leads to all available servers automatically without needing to know server IDs or create multiple separate pages

- More comments in the code to explain what is going on

- Formatting SQL queries to make them more readable

- SQL queries executed with a specified connection link to avoid issues which might happen if you executed this page inside another page

- Minor SQL optimizations

- Minor file size reductions

- Better error handling

- URL query strings changed to make them slightly shorter and to reference PlayerID instead of SoldierName

- More graphs

- Vehicle stats (as much as the crippled Rcon will allow)

- And the new DLC of course

 

I am only about 1/4 finished so far...

 

Teaser:

http://open-web-community.com/bf4sta...=1540&search=1

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Code linked to in first post has been updated!! Updating your code to the latest code is highly recommended.

 

Changes:

- SQL injection security fix by only allowing expected inputs

- New code structure splitting code into different files in the common folder to make finding code easier

- One single index file which leads to all available servers automatically without needing to know server IDs or create multiple separate pages

- More comments in the code to explain what is going on

- Formatting SQL queries to make them more readable

- SQL queries executed with a connection link to avoid issues which might happen if you executed this page inside another page

- Minor SQL optimizations

- Minor file size reductions

- Better error handling

- URL query strings changed to make them slightly shorter and to reference PlayerID instead of SoldierName

- More graphs

- Vehicle stats (as much as the crippled Rcon will allow)

- Added DLC

 

 

http://open-web-community.com/bf4sta...tats/index.php

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

I see there are no links for the global players on index, so I'm guessing it would be pretty hard.

Yeah...

 

The problem is that the global stats on the index page are pulling data from all the servers, so there is no single server stats to link to.

 

A global player stats page would be necessary. Which would be tricky I think. I haven't wrapped my head around how that would be done.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Kinsman*:

 

This seems to match up very well with your globals!

 

http://jw.servegame.org/bf4stats/pub...php_id=MasoAus

 

http://jw.servegame.org/stuff/

 

You will find that file attached a few posts above, hope it gives you some ideas. :biggrin:

 

Edit: reattached here

 

Attached Files:

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

This seems to match up very well with your globals!

 

http://jw.servegame.org/bf4stats/pub...php_id=MasoAus

 

http://jw.servegame.org/stuff/

 

You will find that file attached a few posts above, hope it gives you some ideas. :biggrin:

 

Edit: reattached here

Fair enough.

 

Navigating to the page still seems a little awkward to me. I am afraid people would get lost. They might already be lost for all I know. There is an index page, there are individual stats pages for each server, and then add additional global stats pages? How will the user remember if they are in the global stats pages or individual server stats pages? How will they navigate back and forth between the pages fluidly?

 

It's the layout and navigation which is baffling me. I am afraid that the current navigation might already be confusing as it is.

 

Any ideas?

* Restored post. It could be that the author is no longer active.
Link to comment

Archived

This topic is now archived and is closed to further replies.




  • Our picks

    • Game Server Hosting:

      We're happy to announce that EZRCON will branch out into the game server provider scene. This is a big step for us so please having patience if something doesn't go right in this area. Now, what makes us different compared to other providers? Well, we're going with the idea of having a scaleable server hosting and providing more control in how you set up your server. For example, in Minecraft, you have the ability to control how many CPU cores you wish your server to have access to, how much RAM you want to use, how much disk space you want to use. This type of control can't be offered in a single service package so you're able to configure a custom package the way you want it.

      You can see all the available games here. Currently, we have the following games available.

      Valheim (From $1.50 USD)


      Rust (From $3.20 USD)


      Minecraft (Basic) (From $4.00 USD)


      Call of Duty 4X (From $7.00 USD)


      OpenTTD (From $4.00 USD)


      Squad (From $9.00 USD)


      Insurgency: Sandstorm (From $6.40 USD)


      Changes to US-East:

      Starting in January 2022, we will be moving to a different provider that has better support, better infrastructure, and better connectivity. We've noticed that the connection/routes to this location are not ideal and it's been hard getting support to correct this. Our contract for our two servers ends in March/April respectively. If you currently have servers in this location you will be migrated over to the new provider. We'll have more details when the time comes closer to January. The new location for this change will be based out of Atlanta, GA. If you have any questions/concerns please open a ticket and we'll do our best to answer them.
      • 5 replies
    • Hello All,

      I wanted to give an update to how EZRCON is doing. As of today we have 56 active customers using the services offered. I'm glad its doing so well and it hasn't been 1 year yet. To those that have services with EZRCON, I hope the service is doing well and if not please let us know so that we can improve it where possible. We've done quite a few changes behind the scenes to improve the performance hopefully. 

      We'll be launching a new location for hosting procon layers in either Los Angeles, USA or Chicago, IL. Still being decided on where the placement should be but these two locations are not set in stone yet. We would like to get feedback on where we should have a new location for hosting the Procon Layers, which you can do by replying to this topic. A poll will be created where people can vote on which location they would like to see.

      We're also looking for some suggestions on what else you would like to see for hosting provider options. So please let us know your thoughts on this matter.
      • 4 replies
    • Added ability to disable the new API check for player country info


      Updated GeoIP database file


      Removed usage sending stats


      Added EZRCON ad banner



      If you are upgrading then you may need to add these two lines to your existing installation in the file procon.cfg. To enable these options just change False to True.

      procon.private.options.UseGeoIpFileOnly False
      procon.private.options.BlockRssFeedNews False



       
      • 2 replies
    • I wanted I let you know that I am starting to build out the foundation for the hosting services that I talked about here. The pricing model I was originally going for wasn't going to be suitable for how I want to build it. So instead I decided to offer each service as it's own product instead of a package deal. In the future, hopefully, I will be able to do this and offer discounts to those that choose it.

      Here is how the pricing is laid out for each service as well as information about each. This is as of 7/12/2020.

      Single MySQL database (up to 30 GB) is $10 USD per month.



      If you go over the 30 GB usage for the database then each additional gigabyte is charged at $0.10 USD each billing cycle. If you're under 30GB you don't need to worry about this.


      Databases are replicated across 3 zones (regions) for redundancy. One (1) on the east coast of the USA, One (1) in Frankfurt, and One (1) in Singapore. Depending on the demand, this would grow to more regions.


      Databases will also be backed up daily and retained for 7 days.




      Procon Layer will be $2 USD per month.


      Each layer will only allow one (1) game server connection. The reason behind this is for performance.


      Each layer will also come with all available plugins installed by default. This is to help facilitate faster deployments and get you up and running quickly.


      Each layer will automatically restart if Procon crashes. 


      Each layer will also automatically restart daily at midnight to make sure it stays in tip-top shape.


      Custom plugins can be installed by submitting a support ticket.




      Battlefield Admin Control Panel (BFACP) will be $5 USD per month


      As I am still working on building version 3 of the software, I will be installing the last version I did. Once I complete version 3 it will automatically be upgraded for you.





      All these services will be managed by me so you don't have to worry about the technical side of things to get up and going.

      If you would like to see how much it would cost for the services, I made a calculator that you can use. It can be found here https://ezrcon.com/calculator.html

       
      • 11 replies
    • I have pushed out a new minor release which updates the geodata pull (flags in the playerlisting). This should be way more accurate now. As always, please let me know if any problems show up.

       
      • 9 replies
×
×
  • Create New...

Important Information

Please review our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.