View Single Post
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 09-11-2016 , 20:35   Re: Time Played plugin based off Dr. McKay's Player Analytics
Reply With Quote #6

"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.
__________________
SourceTimer | WeaponSkins++ | BasePlugins++ https://github.com/OSCAR-WOS
OSWO is offline