AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved Time Played plugin based off Dr. McKay's Player Analytics (https://forums.alliedmods.net/showthread.php?t=287616)

sneaK 09-11-2016 02:05

Time Played plugin based off Dr. McKay's Player Analytics
 
I'm aware there are already a couple "time played" plugins, but I was looking to consolidate and use my existing player analytics databases.

Basically I'm requesting a plugin that when a player types !timeplayed they get their total time played in hours and minutes. The plugin would only read from the current databases, not write, dr mckay's plugin would still do all that work.

Dr McKay's Player Analytics plugin


If necessary I can provide a sample database as well. Game specifically I'm looking for is CS:GO, but can be for any I'm sure

Arkarr 09-11-2016 06:11

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
I bet I can do that. Gimme a few houres, no PC acces right now.

sneaK 09-11-2016 17:09

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
Quote:

Originally Posted by Arkarr (Post 2453005)
I bet I can do that. Gimme a few houres, no PC acces right now.

Thanks, that'd be great!

OSWO 09-11-2016 17:59

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
Mind providing the column name of time played? Or how is it arranged? Does every new connection from the player create a new entry, or does it keep updating as steamID is the primary key?

Mind running this query through phpmyadmin?

"SELECT * FROM `table_name` WHERE auth = 'your authid'";

sneaK 09-11-2016 19:12

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
Here is a partial screenshot of the database (with personal info blocked, of course):

http://puu.sh/r83hg/9c229bd16b.png

Every new connection from the player creates a new entry, the primary key is ID. I did a sample export of a couple rows in my player analytics database, here's the pastebin: http://pastebin.com/5BqU1RH0

I guess the plugin would need to find all entries for the player's auth and add the duration together, and spit it out in a legible format.

OSWO 09-11-2016 20:35

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
"SELECT SUM(duration) AS total FROM `table_name` WHERE auth = '%s'", yourauthid);

Hook that into a TQuery on when the command is run, then format the seconds.

PHP Code:

if (SQL_FetchRow(hndl)) {
    
int I_MonthsI_WeeksI_DaysI_HoursI_MinutesI_Seconds;
    
I_Seconds SQL_FetchInt(hndl0);

    
//Formating Seconds > Months ... etc

    //Months
    
if (I_Seconds >= 2628000) {
        
I_Months RoundToFloor(I_Seconds 2628000.0);
        
I_Seconds I_Seconds 2628000;
    }

    
//Weeks
    
if (I_Seconds >= 604800) {
        
I_Weeks RoundToFloor(I_Seconds 604800.0);
        
I_Seconds I_Seconds 604800;
    }

    
//Days
    
if (I_Seconds >= 86400) {
        
I_Days RoundToFloor(I_Seconds 86400.0);
        
I_Seconds I_Seconds 86400;
    }

    
//Hours
    
if (I_Seconds >= 3600) {
        
I_Hours RoundToFloor(I_Seconds 3600.0);
        
I_Seconds I_Seconds 3600;
    }

    
//Minutes
    
if (I_Seconds >= 60) {
        
I_Minutes RoundToFloor(I_Seconds 60.0);
        
I_Seconds I_Seconds 60;
    }


Messy code but I think you know what to do.

sneaK 09-13-2016 12:09

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
Quote:

Originally Posted by OSWO (Post 2453212)
"SELECT SUM(duration) AS total FROM `table_name` WHERE auth = '%s'", yourauthid);

Hook that into a TQuery on when the command is run, then format the seconds.

Interesting, anyone able to do this? :)

AeroAcrobat 10-14-2016 11:54

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
Any news on this?

Arkarr 10-14-2016 13:37

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
Oh wow... haha... I guess I forgot this thread. I'll see what I can do.

Deathknife 10-14-2016 15:22

Re: Time Played plugin based off Dr. McKay's Player Analytics
 
2 Attachment(s)
Try this. Uses mysql config 'timeplayed'

EDIT:
You might want to use the following: https://forums.alliedmods.net/showpo...6&postcount=17
Won't show invalid command in console anymore https://forums.alliedmods.net/showpo...1&postcount=18


All times are GMT -4. The time now is 13:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.