Raised This Month: $ Target: $400
 0% 

Reading data


Post New Thread Reply   
 
Thread Tools Display Modes
Old 08-21-2013, 15:34
Adryyy
This message has been deleted by Adryyy. Reason: noob!
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-13-2013 , 12:26   Re: Reading data
Reply With Quote #2

i found another issue:

when the player is online.. you will retrieve the CURRENT STATS not ALL TIME STATS.
you know what i mean ( ctrl + u in gametracker's page and search for it )

it was easy for me to fix it ( because i dont read each line from a file.. i read directly from reply ).

thanks again.

LE: here's my output ( i`m afraid i keep it only for me ).
Click

Last edited by red_bull2oo6; 08-13-2013 at 12:32. Reason: nothing important
red_bull2oo6 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-13-2013 , 20:44   Re: Reading data
Reply With Quote #3

There appears to be a delay in the download function if that's what you're referring to. I don't know much about sockets but this forums seems pretty dead atm and I don't have anything better to do than debugging it.

If you're trying to do this:
set_hudmessage(20, 232, 20, 0.0, 0.14, 0, 6.0, 12.0, -1)
Then I can understand why you're getting it. Channel is the 11th parameter.

set_hudmessage(20, 232, 20, 0.0, 0.14, 0, 6.0, 12.0, _, _, -1)

_ means it will use default value, if set.
__________________

Last edited by Black Rose; 08-13-2013 at 20:44.
Black Rose is offline
Turle
Junior Member
Join Date: Aug 2013
Old 08-14-2013 , 05:43   Re: Reading data
Reply With Quote #4

Quote:
Originally Posted by Black Rose View Post
There appears to be a delay in the download function if that's what you're referring to. I don't know much about sockets but this forums seems pretty dead atm and I don't have anything better to do than debugging it.

If you're trying to do this:
set_hudmessage(20, 232, 20, 0.0, 0.14, 0, 6.0, 12.0, -1)
Then I can understand why you're getting it. Channel is the 11th parameter.

set_hudmessage(20, 232, 20, 0.0, 0.14, 0, 6.0, 12.0, _, _, -1)

_ means it will use default value, if set.
Oh, I understand, thanks!

I've tried like this but still not working, there isn't a problem about delay, it just doesn't appear.

Thanks for reply though!
Turle is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-16-2013 , 10:42   Re: Reading data
Reply With Quote #5

is there possible to retrieve TOP 10 PLAYERS from that page?

i tried but nothing was good.. ims i suck at regex even i thought i learned it )

this is what i receive and i need to parse it but for me its impossible

if you cant help me just tell me if its possible so i know if i keep trying..
red_bull2oo6 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-16-2013 , 14:49   Re: Reading data
Reply With Quote #6

It's very much possible. Here's a basic example buffering the complete file content and reading through it.
I assume you read directly from the downloaded code, so you will edit this to fit your use better. This was just the easiest way for me to test.

Code:
#include <amxmodx> #include <regex> new Filecontents[10000]; public plugin_init() {     register_plugin("Test Plugin 6", "", "");         new len, hFile = fopen("!TESTTEST.txt", "rb");     while ( ! feof(hFile) )         len += fread_blocks(hFile, Filecontents[len], charsmax(Filecontents) - len, BLOCK_BYTE);         fclose(hFile);             new Results[4][32], Count, ResultNum, Pos;     new Regex:hRegex = regex_compile("(?:<td class=^"c0[1234]^">\n*\s*)(?:(?:(?:<a.+>\n*\s*)(.+)$)|(\d+(?:\.?\d+)?))", ResultNum, Results[0], charsmax(Results[]), "m");         while ( regex_match_c(Filecontents[Pos], hRegex, ResultNum) > 0 && Pos != -1 ) {                 regex_substr(hRegex, 0, Results[Count % 4], charsmax(Results[])); // Get the complete string. If we search for "1" in strfind() we will get the wrong result guaranteed.         Pos += strfind(Filecontents[Pos], Results[Count % 4]) + 1; // Prevents from returning the same match twice.                 regex_substr(hRegex, ResultNum - 1, Results[Count % 4], charsmax(Results[])); // Get the string we really want.                 Count++; // Just to keep track of what information we're retrieving.         if ( ! ( Count % 4 ) ) { // We've reached 4 data collected, This means one player is done.             Results[1][strlen(Results[1]) - 1] = 0; // To remove the line feed at the end of the name. I'm still learning Regex...             server_print("%s. %s^tScore: %s^tTime Played: %s", Results[0], Results[1], Results[2], Results[3]); // Make use of the information.         }     }     regex_free(hRegex); }

Here's the result:
Code:
1. DubFX        Score: 3516     Time Played: 341.6
2. Menthor      Score: 2270     Time Played: 285.95
3. gogujj       Score: 1950     Time Played: 148.37
4. Mindpower    Score: 1903     Time Played: 151.63
5. Tito .       Score: 1664     Time Played: 142.58
6. gotz. - UP!  Score: 1638     Time Played: 186.55
7. paLL maLL    Score: 1627     Time Played: 232.02
8. TheSeekers ;x        Score: 1502     Time Played: 193.7
9. idontlikecandy       Score: 1304     Time Played: 93.28
10. IceStep     Score: 1207     Time Played: 136.48
__________________

Last edited by Black Rose; 08-16-2013 at 14:55.
Black Rose is offline
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-17-2013 , 20:00   Re: Reading data
Reply With Quote #7

thanks man, you always helped me

it works flawlessly.
red_bull2oo6 is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-21-2013 , 16:21   Re: Reading data
Reply With Quote #8

Is the plugin running?
Are there any errors in the log?
Did you change the IP?
Did you compile it yourself?
__________________
Black Rose is offline
KinderBueno
Junior Member
Join Date: Sep 2011
Old 08-21-2013 , 18:01   Re: Reading data
Reply With Quote #9

Quote:
Originally Posted by Black Rose View Post
Is the plugin running?
Are there any errors in the log?
Did you change the IP?
Did you compile it yourself?

1. The plugin is running
2. No errors in log
3. I changed IP
4. I compiled myself in local with all includes (http.inc, sokets.inc, etc) No errors at compilation
KinderBueno is offline
Send a message via Yahoo to KinderBueno
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-21-2013 , 16:51   Re: Reading data
Reply With Quote #10

hey! that's my private plugin.. well i think i can't name it 'private' cause i sell it.
you can do that alone.. just need to build a menu.

btw Black Rose, i'm in your debt.
thanks for everything.
i need again some help. i retrieved the top from gametracker ( thanks to your code ) but its too long to fit it in a menu, it fits only first 5 positions .

what can i do ?
red_bull2oo6 is offline
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 15:56.


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