Raised This Month: $ Target: $400
 0% 

Gametracker Played Time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 09-14-2015 , 13:40   Gametracker Played Time
Reply With Quote #1

Hello AM. I want to get total played minutes of a player from gametracker link .

I saw a plugin that load in motd this page and you just see minutes played but i want to extract this to a variable and then when player writes /time , it just says "You total played time is x Hours (Integer).".
I dont need the whole plugin , i have the plugin but it only loads the webpage in motd but i want to extract only minutes played.
Is that possible without any module instalation? I think it's html code on the page and all spans have the same name .

Last edited by siriusmd99; 09-14-2015 at 13:41.
siriusmd99 is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 09-15-2015 , 11:34   Re: Gametracker Played Time
Reply With Quote #2

real all the pages in theese two threads and you will find more than u need.
Here and especially Here

And i also have this 'old' output according to that thread.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < amxmisc >
#include < sockets >
#include < regex >

#define PLUGIN "GT Player Statistics"
#define VERSION "1.7.5"

enum (+= 1000)
{
    
TASK_CHANGE 1000,
    
TASK_CLOSE,
    
TASK_DISPLAY,
    
TASK_VERIFY,
    
TASK_DISCONNECT
}

enum _:iDatasId
{
    
iFirstSeen,
    
iLastSeen,
    
iScore,
    
iMinutesPlayed,
    
iScorePerMinute,
    
iRank
}
enum _:iDatas
{
    
szPrefix32 ],
    
szPattern128 ]
}

new const 
g_szDatasiDatasId ][ iDatas ] =
{
    { 
"First Seen:""\w{3} [0-3][0-9], [12][019][0-9][0-9]" },
    { 
"Last Seen:""Online Now|(((Yester|To)day)|(\w{3} [0-3][0-9], [12][019][0-9][0-9])) (1[0-2]|[0-9]):[0-5]\d [A|P]M"    },
    { 
"Score:""\n*\s*(\d+)\s*\n*" },
    { 
"Minutes Played:""\n*\s*(\d+)\s*\n*" },
    { 
"Score per Minute:""\s+(\d+\.?\d*)" /*"\n*\s*(\d+\.?\d*)\s*\n*"*/ },
    { 
"Rank on Server:""#\d+ out of \d+"    }
}

new 
g_szPlayerDatasiDatasId ][ 32 ][ 33 ];

new const 
g_szTag[ ] = "|GT Player Statistics:";
new const 
g_szHost[ ] = "www.gametracker.com";
new const 
g_szPlayer[ ] = "/player";

new const 
g_szServerNotFound[ ] = "No Statistics Available";
new const 
g_szPlayerNotFound[ ] = "Player Not Found";
new const 
g_szPlayerSearchFor[ ] = "Player Search for";


new 
g_szServerIp32 ];
//new const g_szServerIp[ ] = "188.213.212.12:27015";

new g_szRequest[33][ 128 ];
new 
g_szData[33][ 4096 ];
new 
g_szName33 ][ 32 ];
new 
g_iSocket33 ];
new 
g_iPacketNum33 ];
new 
g_iError33 ];


public 
plugin_init( )
{
    
register_pluginPLUGINVERSION"Askhanar" );
    
    
register_clcmd"say""HookClCmdSayOrSayTeam" );
    
register_clcmd"say_team""HookClCmdSayOrSayTeam" );
    
    
register_clcmd"gt_stats""ClCmdGTStats" );
    
register_clcmd"amx_gtstats""ClCmdAmxGTStats" );
    
    
get_user_ip0g_szServerIpsizeof g_szServerIp ) -1); //--| Ii luam ip la sv cu tot cu port!
    
    
    
register_menucmdregister_menuid"GTStatsMenu" ), (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9), "GTStatsMenuHandler" );
    
set_task300.0"task_DisconnectAllPlayers"TASK_DISCONNECT );
    
    
// Add your code here...
}


public 
task_DisconnectAllPlayers( )
{
    static 
iPlayers32 ];
    static 
iPlayersNum;
    
    
get_playersiPlayersiPlayersNum"ch" );
    if( !
iPlayersNum )
        return;
    
    static 
idi;
    for( 
0iPlayersNumi++ )
    {
        
id iPlayers];
        
remove_taskid TASK_CHANGE );
        
remove_taskid TASK_DISPLAY );
        
        if( 
g_iSocketid ] > )
        {
            
socket_closeg_iSocketid ] );
            
g_iSocketid ] = 0
            
            g_iPacketNum
id ] = 0;
            
g_iErrorid ] = 0;
            
            
copyg_szDataid ], sizeofg_szData[ ] ) -1"" );
        }
    }
}

public 
client_disconnectid )
{
    if( 
is_user_botid ) )
        return;
        
    
remove_taskid TASK_CHANGE );
    
remove_taskid TASK_CLOSE );
    
remove_taskid TASK_DISPLAY );
    
    
socket_closeg_iSocketid ] );
    
g_iSocketid ] = 0;
    
    
g_iPacketNumid ] = 0;
    
g_iErrorid ] = 0;
    
}

public 
HookClCmdSayOrSayTeamid )
{
    static 
szArgs192 ], szCommand192 ];
    
read_argsszArgssizeof szArgs ) -);
    
    if( !
szArgs] )
        return 
PLUGIN_CONTINUE;
    
    
remove_quotesszArgs );
    
    if( 
equalszArgs"/gtstats"strlen"/gtstats" ) ) )
    {
        
        
replaceszArgssizeof szArgs ) -1"/gt"""  );
        
formatexszCommandsizeof szCommand ) -1"gt_%s"szArgs );
        
        
client_cmdidszCommand );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
ClCmdGTStatsid )  
{
    
    new 
szFirstArg32 ];
        
read_argv1szFirstArgsizeof szFirstArg ) -);

    if( 
equaliszFirstArg"" ) )
    {
        
get_user_nameidg_szNameid ], sizeof g_szName[ ] ) -);
        
ReplaceNameidtrue );
        
        
BeginShowingStatsidg_szNameid ] );
    }
    
    else
    {
        
        new 
iPlayer cmd_targetidszFirstArg);
        if(!
iPlayer  )
        {
            
client_printidprint_chat"%s Player '%s' is not connected on server."g_szTagszFirstArg );
            return 
PLUGIN_HANDLED;
        }
        else if( 
iPlayer == id )
        {
            
client_printidprint_chat"%s Use only '/gtstats' instead."g_szTag );
            return 
PLUGIN_HANDLED;
        }

        
get_user_nameiPlayerg_szNameid ], sizeof g_szName[ ] ) -);
        
ReplaceNameidtrue );
        
BeginShowingStatsidg_szNameid ] );
    }
    
    return 
PLUGIN_HANDLED;
}

public 
ClCmdAmxGTStatsid )  
{
    
    if( !( 
get_user_flagsid ) & ADMIN_RCON ) )
    {
        
client_cmdid"echo You have NO acces to this command!" );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szFirstArg32 ];
        
read_argv1szFirstArgsizeofszFirstArg ) -);

    if( 
equaliszFirstArg"" ) )
    {
        
client_cmdid"echo USAGE: amx_gtstats <^"Exact Name^"> " );
        return 
PLUGIN_HANDLED;
    }
    
    
copyg_szNameid ], sizeofg_szName[ ] ) -1szFirstArg );
    
ReplaceNameidtrue );
    
BeginShowingStatsidg_szNameid ] );
    
    
client_cmdid"echo Requesting information about: %s!"szFirstArg );
    
client_cmdid"echo Watch your chat for information!" );
    
    return 
PLUGIN_HANDLED;
}

public 
BeginShowingStatsid, const szName[ ] )
{
    if( 
g_iSocketid ] > )
        
socket_closeg_iSocketid ] );
    

    
g_iSocketid ] = socket_openg_szHost80SOCKET_TCPg_iErrorid ] );
    
    if( 
g_iErrorid ] == && g_iSocketid ] > )
    {
        
        
formatexg_szRequestid ], sizeof g_szRequest[ ] ) -1,"GET %s/%s/%s/ HTTP/1.1^r^nHost: %s^r^n^r^n"g_szPlayerszNameg_szServerIpg_szHost );
        
        
socket_sendg_iSocketid ], g_szRequestid ], sizeofg_szRequest[ ] ) );
        
g_iPacketNumid ] = 0;
        
        
set_task0.1"task_Change"id TASK_CHANGE__"b");
        
set_task5.0"task_Close"id TASK_CLOSE );
        
        
client_printidprint_chat"%s Waiting for GameTracker to response.."g_szTag );
        
    }
    else
    {
        switch( 
g_iErrorid ] )
        {
            case 
1:    log_amx("[ERROR] Unable to create socket." );
            case 
2:    log_amx("[ERROR] Unable to connect to hostname." );
            case 
3:    log_amx("[ERROR] Unable to connect to the HTTP port." );
            
        } 
        
        
client_printidprint_chat"%s An error occuered while trying to establish connection!"g_szTag );
        return 
PLUGIN_HANDLED;
    }
    
    
remove_taskid TASK_DISPLAY );
    
set_task3.0"task_Display"id TASK_DISPLAY );
    
    return 
PLUGIN_CONTINUE;
    
}

public 
task_Changeid )
{
    
id -= TASK_CHANGE;
    if( !
is_user_connectedid ) )
        return 
PLUGIN_HANDLED;
    
    if( 
socket_changeg_iSocketid ], ) )
    {
        
        if( 
socket_recvg_iSocketid ], g_szDataid ], sizeofg_szData[ ] ) ) )
        {
            if( ++
g_iPacketNumid ] == )
            {
                if( 
containig_szDataid ], g_szServerNotFound ) != -)
                {
                    
client_printidprint_chat"%s Current Server was not found on GameTracker database!"g_szTag );
                    
task_Closeid TASK_CLOSE );
                    return 
PLUGIN_HANDLED;
                }
                
                if( 
containig_szDataid ], g_szPlayerNotFound ) != -|| containig_szDataid ], g_szPlayerSearchFor ) != -)
                {
                    
ReplaceNameidfalse );
                    
client_printidprint_chat"%s Player '%s' was not found on GameTracker database!"g_szTagg_szNameid ] );
                    
task_Closeid TASK_CLOSE );
                    return 
PLUGIN_HANDLED;
                }
            }
            
            
            static 
iDataStart;
            static 
iNumszError128 ];
            
iNum 0;new bool:bFixedStats false;
            
            for( new 
iFirstSeen<= iRanki++ )
            {
                
                if( 
>= iScore && !bFixedStats )
                {
                    if( 
containg_szDataid ], "CURRENT STATS" ) != -)
                    {
                        new 
iAllStats containig_szDataid ], "ALL TIME STATS" );
                        if( 
iAllStats != -)
                        {
                            
bFixedStats true;
                            
formatg_szDataid ], sizeofg_szData[ ] ) -1"%s"g_szDataid ][ iAllStats ] );
                        }
                    }
                }
                            
                
iDataStart containig_szDataid ], g_szDatas][ szPrefix ] );
                if( 
iDataStart != -)
                {
                    new 
Regex:hRegex regex_matchg_szDataid ][ iDataStart ], g_szDatas][ szPattern ], iNumszErrorsizeofszError ) -);
            
                    if( 
hRegex >= REGEX_OK )
                    {
                        
regex_substrhRegex0g_szPlayerDatas][ id ], sizeofg_szPlayerDatas[ ][ ] ) -);
                        
server_print"%s %s"g_szDatas][ szPrefix ], g_szPlayerDatas][ id ] );
                        
regex_freehRegex );
                    }
                    else
                    {
                        
client_printidprint_chat"%s Regex occured an error, please try again"g_szTag );
                        
task_Closeid TASK_CLOSE );
                    }
                }
            }

        }
    }
    
    return 
PLUGIN_CONTINUE;
        
}

public 
task_Closeid )
{
    
id -= TASK_CLOSE;
    if( !
is_user_connectedid ) )
        return;
        
    
remove_taskid TASK_CHANGE );
    
remove_taskid TASK_DISPLAY );
    
    
socket_closeg_iSocketid ] );
    
g_iSocketid ] = 0
    
    g_iPacketNum
id ] = 0;
    
g_iErrorid ] = 0;
    
    
copyg_szDataid ], sizeofg_szData[ ] ) -1"" );
    
}

public 
task_Displayid )
{
    
id -= TASK_DISPLAY;
    if( !
is_user_connectedid ) )
        return;
        
    
client_printidprint_chat"%s GameTracker has successfully responded.."g_szTag );
    
GTStatsMenuid );
    
}

public 
GTStatsMenuid )
{
    
ReplaceNameidfalse );
    new 
szMenuName512 ], szHostName64 ];
    
get_cvar_string"hostname"szHostNamesizeofszHostName ) -);
    
    
replace_allg_szPlayerDatasiRank ][ id ], sizeofg_szPlayerDatas[ ][ ] ) -1"#""" );
    
replace_allg_szPlayerDatasiRank ][ id ], sizeofg_szPlayerDatas[ ][ ] ) -1" out of "" \wfrom\r " );
    
    
formatexszMenuNamesizeofszMenuName ) -1"\y| \r%s \y|^n| \wPlayer Statistics for: \r%s \y|^n^n^n|\w First Seen:\r %s\y |^n|\w Last Seen:\r %s\y |^n|\w Score:\r %i\y |^n|\w Score per Minute:\r %.1f\y |^n|\w Minutes Played:\r %i\w (\r %s\w )\y |^n|\w Rank on Server:\r %s\y |^n^n^n\wPress\r 1\w to see this stats in\y MOTD^n\wStatistics directly token from:^n     \r%s",
        
szHostNameg_szNameid ] , g_szPlayerDatasiFirstSeen ][ id ], g_szPlayerDatasiLastSeen ][ id ],
        
str_to_numg_szPlayerDatasiScore ][ id ] ), floatstrg_szPlayerDatasiScorePerMinute ][ id ] ),
        
str_to_numg_szPlayerDatasiMinutesPlayed ][ id ] ), GetPlayedTimestr_to_numg_szPlayerDatasiMinutesPlayed ][ id ] ) ),
        
g_szPlayerDatasiRank ][ id ], g_szHost );
        
    
show_menuid, (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9), szMenuName, -1"GTStatsMenu" );
}

public 
GTStatsMenuHandleridiKey )
{
    
/* Menu:
    * | %s |
    * | Player Statistics for: %s |
    *
    * 
    * 
    * | First Seen: %s |
    * | Last Seen: %s |
    * | Score: %i |
    * | Score per Minute: %.1f |
    * | Time Played: %i ( %s ) |
    * | Rank on Server: %s |
    * 
    * 
    * Press 1 to see this stats in MOTD
    * Statistics directly token from:
    *      www.gametracker.com
    */

    
switch( iKey )
    {
        case 
0:
        {
            
ReplaceNameidtrue );
            static 
szCustomUrl128 ];
            
formatexszCustomUrlsizeofszCustomUrl ) -1"http://%s%s/%s/%s/",
                
g_szHostg_szPlayerg_szNameid ], g_szServerIp );
        
            
show_motdidszCustomUrl );
            
GTStatsMenuid );
        }
        
        case 
1..9:    return;
    }
}

GetPlayedTime( const iTime )
{
    new 
szTime64 ];
    
    new 
iSeconds iTime 60;
    new 
iMinutes 0;
    new 
iHours 0;
    
    while( 
iSeconds >= 60 )
    {
        
iSeconds -= 60;
        
iMinutes++;
    }
    
    while( 
iMinutes >= 60 )
    {
        
iMinutes -= 60;
        
iHours++;
    }
    
    new 
bool:UseFormatInsteadFormatex false;
    if( 
iSeconds )
    {
        
formatexszTimesizeofszTime ) -1"%i s"iSeconds );
            
        
UseFormatInsteadFormatex true;
    }
    if( 
iMinutes )
    {
        if( 
UseFormatInsteadFormatex )
        {
            
formatszTimesizeofszTime ) -1"%i m, %s"iMinutes,  szTime );
        }
        else
        {
            
formatexszTimesizeofszTime ) -1"%i m"iMinutes);
            
UseFormatInsteadFormatex true;
        }
    }
    if( 
iHours )
    {
        if( 
UseFormatInsteadFormatex )
        {
            
formatszTimesizeofszTime ) -1"%i h, %s"iHours,  szTime );
        }
        else
        {
            
formatexszTimesizeofszTime ) -1"%i h"iHours );
            
            
UseFormatInsteadFormatex true;
        }
    }
    
    if( !
UseFormatInsteadFormatex )
    {
        
        
copyszTimesizeofszTime ) -1"Unknown" );
    }
    
    return  
szTime;
}

ReplaceNameid, const bool:bSafe true )
{
    if( 
bSafe )
    {
        
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"#""%23" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"?""%3F" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1":""%3A" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1";""%3B" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"/""%2F" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1",""%2C" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"$""%24" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"@""%40" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"+""%2B" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"=""%3D" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"®""®" );
    }
    else
    {
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%23","#" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%3F""?" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%3A"":" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%3B"";" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%2F""/" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%2C""," );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%24""$" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%40""@" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%2B""+" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"%3D""=" );
        
replace_allg_szNameid ], sizeofg_szName[ ] ) -1"®""®" );
        
    }
        

__________________

My PC Themes . .
red_bull2oo6 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 09-16-2015 , 10:32   Re: Gametracker Played Time
Reply With Quote #3

Thanks . Solved.
siriusmd99 is offline
petyrkpetrov
Junior Member
Join Date: Jan 2017
Old 01-07-2017 , 08:51   Re: Gametracker Played Time
Reply With Quote #4

http://agrarzonegaming.eu/upload-ima...ge.php?di=0RRQ


This is what it shows to me, no stats, but the player got some kills and played time in the server. Please help!
petyrkpetrov is offline
Send a message via Skype™ to petyrkpetrov
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:04.


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