Jump to content

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


tyger07

Recommended Posts

Originally Posted by EntraVenuS*:

 

Thanks for the info ty_ger07 .. i got 1 more question how do i add/ change the background image for the stats page and what size does it have to be to show fullscreen. Im a bit noobish with this kinda stuff but willing to learn .. heres what it is showing at the moment

 

http://anarchygaming.uk/stats/

* Restored post. It could be that the author is no longer active.
Link to comment
  • Replies 1.7k
  • Created
  • Last Reply

Originally Posted by BuRockK*:

 

Thanks for the info ty_ger07 .. i got 1 more question how do i add/ change the background image for the stats page and what size does it have to be to show fullscreen. Im a bit noobish with this kinda stuff but willing to learn .. heres what it is showing at the moment

 

http://anarchygaming.uk/stats/

This is how you do it

 

This is where the background image is specified in stats.css:

https://github.com/tyger07/BF4-Serve...mmon/stats.css

Line 49

Code:

background-image: url("./images/BF4back.jpg");
You can put multiple images in "common/images/" folder and change the jpg name in that code to whichever jpg file you want to use

 

Im not sure on image sizes though, i suggest taking BF4back.jpg default image file as an example and set new images the same size

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

Originally Posted by Prophet731*:

 

Since Procon knows who has an admin user account, and AdKats is an admin tool which connects to XpKiller's stats database, I was hoping that there was the possibility that AdKats saved information about admins into the database.

 

Oh well. As I said, your admin control panel webpage is very nice and there is no reason why I should try to compete and duplicate some of the same functionality into my stats page. It just wouldn't make sense.

 

All I needed was an easy way to reliably determine who is an admin using information saved in the stats database in order to enable an option to only show the chat content if the viewer is an admin (having an IP address which matches a known admin). I didn't want to be involved in building that information or creating login pages or admin rights management pages. So, I will simply not pursue it any further. It was a pipe dream to attempt to satisfy the request.

The problem I see happening though would be if the IP changed for the admin but not in the database yet, so they wouldn't be able to see admin actions until that's updated. As far as determining who is an admin in AdKats all we do is based on a person's EAGUID when they join then AdKats checks its roles/permissions for the player.

 

The main tables for the users though are in this gist.

 

https://gist.github.com/Prophet731/1...501bb1a329949f

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

Originally Posted by EntraVenuS*:

 

This is how you do it

 

 

 

You can put multiple images in "common/images/" folder and change the jpg name in that code to whichever jpg file you want to use

 

Im not sure on image sizes though, i suggest taking BF4back.jpg default image file as an example and set new images the same size

got it thanks for your help working like a charm now
* Restored post. It could be that the author is no longer active.
Link to comment
  • 2 weeks later...

Originally Posted by )RAG()N*:

 

You would have to manually bring your edits into the updated file(s).

thanks for the reply ty_ger07,, now I just have to remember where I done them :tongue:
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by BuRockK*:

 

Hi ty_ger07, i was wondering if it is possible to add a table to the right side of "Top player" table in the main stats page of a server. Or does it need the plugin to be upgraded?

 

EDIT: Maybe use the second banner example in "Server Info" tab on the page but just use current map picture and a list of maps in the maplist instead of a list of current players maybe_. I wouldnt know how to do it either way

 

Example:

 

Attached Files:

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

Originally Posted by ty_ger07*:

 

The maplist isn't saved to the database. There would be no way of knowing which maps are in the list nor the number of rounds. The stats page could try to save a list of maps each time it loads and checks the current map, but the list would end up being very full of errors because it wouldn't be able to guess when you change your map list and wouldn't know which maps were played in the gaps when no one loaded the stats page.

 

A historical list of all maps which have ever been played (you can see this in the maps tab) is about as good as you can do.

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

Originally Posted by BuRockK*:

 

I wanna ask what about dealing with "maplist.list" and "mapList.availableMaps" using that somehow to work around this but to be fair i dont even know how those rcons work

 

But can we still do this with manually adding the maplist but fetch to show which map is currently running with map image and maybe highlight the map in the list?

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

Originally Posted by ty_ger07*:

 

The webpage has no access to rcon commands. That functionality would need to be added to XpKiller's plugin before it could be available to the webpage.

 

You could make a custom list of maps for your server and display it somewhere in the stats page, but it isn't functionality I would officially add to the stats page since it would be custom code which would only function if someone manually added that information to their database.

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

Originally Posted by BuRockK*:

 

The webpage has no access to rcon commands. That functionality would need to be added to XpKiller's plugin before it could be available to the webpage.

 

You could make a custom list of maps for your server and display it somewhere in the stats page, but it isn't functionality I would officially add to the stats page since it would be custom code which would only function if someone manually added that information to their database.

The banner examples in Server Info tab on webpage shows the currently active map. I was hoping that would be enough to also highlight the map in the custom made list.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

The banner examples in Server Info tab on webpage shows the currently active map. I was hoping that would be enough to also highlight the map in the custom made list.

Yes. But first you need to add the custom made list and add a place to display it.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

PHP is a very forgiving high-level programming language which is quite easy to understand with a little practice. I suggest that you give it a try. It is similar to C languages in construction but usually simpler.

 

Here is an example of the most complex C program I have written. Not very good, huh?

Code:

// Inspirations:
// http://raspberrypi.stackexchange.com/questions/6978/get-pis-temperature-using-c
// http://kernelreloaded.blog385.com/index.php/archives/formatting-output-from-raspberry-pi-temperature-sensors/
// http://kurup87.blogspot.com/2014/09/16x2-lcd-hello-world-using-c-wiringpi.html

#include <wiringPi.h>
#include <lcd.h>
#include <softPwm.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

// 16x2 LCD pinout:
// 1   = VSS (GND)
// 2   = VDD (VCC,5V)
// 3   = VE (connect with variable resistor)
// 4   = RS, Register Select
// 5   = RW, Read/Write
// 6   = E, Enable
// 7   = Data0, D0
// 8   = Data1, D1
// 9   = Data2, D2
// 10 = Data3, D3
// 11 = Data4, D4
// 12 = Data5, D5
// 13 = Data6, D6
// 14 = Data7, D7
// 15 = Backlight Anode (VCC)
// 16 = Backlight Cathode (GND)

// Define which Raspberry Pi pins are connected to which LCD pin.
#define LCD_RS  29				//Register select pin
#define LCD_E   28				//Enable Pin
#define LCD_D4  0				//Data pin 4
#define LCD_D5  1				//Data pin 5
#define LCD_D6  2				//Data pin 6
#define LCD_D7  3				//Data pin 7

// Use 'gpio readall' in Terminal to read Raspberry Pi pin assignments.

// Main function
int main()
{
	int lcd;
	int line;
	FILE *fp;
	char path[50];
	char CPUtemperature[3];
	char CPUfrequency[4];
	char GPUtemperature[3];
	char Memusage[4];
	double V;

	// Initialize LCD
	wiringPiSetup();
	if(lcd = lcdInit(2, 16, 4, LCD_RS, LCD_E,LCD_D4, LCD_D5, LCD_D6, LCD_D7, 0, 0, 0, 0))
	{
		lcdClear(lcd);
		printf("lcd init failed! \n");
		return -1;
    }

	// set up fan
	softPwmCreate(4, 0, 500);

	lcdClear(lcd);
	printf("\n LCD System Monitor \n View values on LCD display. \n");

	// Loop
	while(1)
	{
		
		line = 0;

		// Check the GPU temp.
		fp = popen("/opt/vc/bin/vcgencmd measure_temp|cut -c6-9", "r");
		if(fp == NULL)
		{
			lcdClear(lcd);
			printf("GPU command failed! \n");
	            	return -1;
		}
		// Read the output a line at a time.
		while(fgets(path, sizeof(path)-1, fp) != NULL)
		{
			V = snprintf(GPUtemperature,3,"%f", path);
			break;
		}
		// close file
		pclose(fp);

		// Check the memory usage.
		fp = popen("free -h|cut -c26-28", "r");
		if(fp == NULL)
		{
			lcdClear(lcd);
			printf("Memory command failed! \n");
	            	return -1;
		}
		// Read the output a line at a time.
		while(fgets(path, sizeof(path)-1, fp) != NULL)
		{
			line++;
			if(line == 3)
			{
				V = snprintf(Memusage,4,"%s", path);
				break;
			}
		}
		// close file
		pclose(fp);

		// Read CPU frequency from existing file
		fp = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r");
		if(fp == NULL)
		{
			lcdClear(lcd);
			printf("Opening CPU frequency file failed! \n");
            		return -1;
		}
		fscanf(fp, "%lf", &V);
		V /= 1000000;
		snprintf(CPUfrequency,4,"%1.1f",V);
		fclose(fp);

		// Read CPU temp from existing file
		fp = fopen("/sys/class/thermal/thermal_zone0/temp", "r");
		if(fp == NULL)
		{
			lcdClear(lcd);
			printf("Opening CPU temp file failed! \n");
            		return -1;
		}
		fscanf(fp, "%lf", &V);
		V /= 1000;
		snprintf(CPUtemperature,3,"%2.0f",V);
		fclose(fp);

		// make a fan speed ratio between 34 and 44 degrees
		V = V - 34;
		if(V < 0)
		{
			V = 0;
		}
		if(V > 10)
		{
			V = 10;
		}
		V = (V/10)*500;

		// turn fan on amount calculated
		softPwmWrite(4, V);

		// Display values on LCD screen
		lcdPosition(lcd,0,0);
		lcdPuts(lcd, "CPU ");
		lcdPosition(lcd,4,0);
		lcdPuts(lcd, CPUtemperature);
		lcdPosition(lcd,6,0);
		lcdPuts(lcd, ".C");
		lcdPosition(lcd,8,0);
		lcdPuts(lcd, " ");
		lcdPosition(lcd,9,0);
		lcdPuts(lcd, CPUfrequency);
		lcdPosition(lcd,12,0);
		lcdPuts(lcd, " ");
		lcdPosition(lcd,13,0);
		lcdPuts(lcd, "GHz");
		lcdPosition(lcd,0,1);
		lcdPuts(lcd, "GPU ");
		lcdPosition(lcd,4,1);
		lcdPuts(lcd, GPUtemperature);
		lcdPosition(lcd,6,1);
		lcdPuts(lcd, ".C");
		lcdPosition(lcd,8,1);
		lcdPuts(lcd, " ");
		lcdPosition(lcd,9,1);
		lcdPuts(lcd, "   ");
		lcdPosition(lcd,9,1);
		lcdPuts(lcd, Memusage);
		lcdPosition(lcd,12,1);
		lcdPuts(lcd, " ");
		lcdPosition(lcd,13,1);
		lcdPuts(lcd, "MB ");

		// Pause 2 second before repeating loop
		sleep(2);
	}
}

// compile:
// gcc -o monitor monitor.c -lwiringPi -lwiringPiDev -lpthread  -march=armv7ve -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=vfpv3-d16 -mtune=native
But I can write thousands and thousands of lines of PHP just fine. If I can do it, you can do it.

 

This will get you started for sure (if you are interested and have the time).

https://www.youtube.com/watch_v=iCUV...2FA2C127377F07

 

That playlist will teach you everything you need to know about getting a php webserver started, MySQL, and programming php webpages. Very helpful.

 

 

Yes, you could echo out standard static HTML in my stats pages to generate a static map list.

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

Originally Posted by BuRockK*:

 

Thanks man ill definitelly check that out. Also i might need to delete one of the servers player stats from the database and and the server itself from the stats page. is there an easy way for this?

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

Originally Posted by ty_ger07*:

 

Is there a way to add Accuracy to the weapons stats ?

No, it is not possible to do using the information available to Procon through DICE's Rcon system. Procon doesn't know what bullets are nor how many were fired. All Procon knows is that player A killed player B with weapon W.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by aceventura81*:

 

may I ask why I getting this error on my hosting ?

 

 

Unable to access stats database. Please notify this website's administrator.

 

If you are the administrator, please seek assistance here.

 

Error: Connection timed out

 

all database setting is same as in Plugin.

 

thanks

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

Originally Posted by aceventura81*:

 

may I ask why I getting this error on my hosting ?

 

 

Unable to access stats database. Please notify this website's administrator.

 

If you are the administrator, please seek assistance here.

 

Error: Connection timed out

 

all database setting is same as in Plugin.

 

thanks

Small update, my hosting provided information that port 3306 is blocked so I am unable to get mapstats on my website. Any ideas where to go ? Thank you.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Small update, my hosting provided information that port 3306 is blocked so I am unable to get mapstats on my website. Any ideas where to go ? Thank you.

The problem is most likely that your webserver and your database are on different machines and therefore the database needs to allow external connections if the webserver is going to be allowed to talk to the database. If you can't convince your database host to allow external connections to access through port 3306, you are pretty much stuck.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by aceventura81*:

 

The problem is most likely that your webserver and your database are on different machines and therefore the database needs to allow external connections if the webserver is going to be allowed to talk to the database. If you can't convince your database host to allow external connections to access through port 3306, you are pretty much stuck.

Thanks for answer. Yeah, I stuck. Webhosting provider blocking port 3306. So now I have to found provider where to move my web or get VPS and there is no problem at all.

 

Thank you again.

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

Originally Posted by Dete96*:

 

Thanks for answer. Yeah, I stuck. Webhosting provider blocking port 3306. So now I have to found provider where to move my web or get VPS and there is no problem at all.

 

Thank you again.

I had exactly the same problem a few month ago. I chose another provider (https://byet.host/free-hosting/news) just for the stats page and linked it from our clan homepage. The provider is free and has open port 3306. I never had a problem nor heard of them since I installed the stats page.
* Restored post. It could be that the author is no longer active.
Link to comment
  • 3 weeks later...
  • 4 weeks later...

Archived

This topic is now archived and is closed to further 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.