PDA

View Full Version : .


Heiko1
30th December 2008, 13:26
.

Silox
30th December 2008, 16:24
You can use the PubStat (watch out with the maximum of requests) to request the stats, and use StreamReader (or another http reader included in C#) to read the information...

I have no experience with C# nor with PubStat, I just know it's possible this way :)

DarkTimes
30th December 2008, 16:45
edit: irrelevant.

DarkTimes
30th December 2008, 23:33
edit: irrelevant.

Silox
31st December 2008, 08:21
The only thing what i need is that i can insert LFSW stats into a Button:D

Well, DarkTimes (almost) gave you the code for it...
I'll show you in VB.net (not tested, it can be bugged) how to recieve a PB from LFSW in milliseconds with PubStat for a pre-defined racer.


' Place the piece of script where you want to create the button

string pubStatUri = "http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&idk=<Your_Ident_Key_Here>&action=hl&racer=Silox";

' This returned a lot of PB's for my account

' Now the requesting part

WebRequest request = WebRequest.Create(pubStatUri);

using (WebResponse response = request.GetResponse())
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{

' The streamreader reads every time 1 line from the file, so we'll need a loop

' Save the return info in a string, called line

string line;

' Loop trough all the lines of the file

while (line = reader.ReadLine()) != null)
{

' E.g. I want to get my XFG Bl1 PB
' Which is, on the Pubstat like this:
' 240 XFG 45500 0 0 94230 2 1201295794 (Don't know for sure if it's this one)
' Now we'll modify the code:
' I should cut the code into an array

array results

results = String.split(line)

' If BL1 and XFG

If results(0) = 240 and results(1) = "XFG" then

' Save the total time in Miliseconds
string pb
pb = results(7)
' Exit the loop so it will take less time
exit loop;

}
}



Now you have the pb of the racer in milliseconds, you'll just need to edit the pb a bit to make it display in hours, minutes, seconds, hundreths...
And then make a button of out it, using the InSim.CreateButton thing :)

DarkTimes
31st December 2008, 13:11
edit: irrelevant.

Silox
31st December 2008, 14:50
Thanks silox :)

PS: Was on ur server with ur system.

FirstCorner+Demo's:scratchch = Crash carambolage ^^ but nothing against server :) its very less lag!

We're planning to make a 'Noob server'; 1 lap :) Crash!
Well, as the InSim Program is made with a file to save all the data in, the bigger the file gets, the longer to load...

Good luck on your Ranking System!

P.S.: I think it's better to work with a MySQL database to save all the info:
- Much easier way of updating points
- Quicker (I think)
- Better way of backupping

(The 500servers admin accidentally overwrote one of our ranking files... Result: We ended up with a 1 week old file, so we gave everybody more points :) )

P.P.S.: Watch out with the PubStat Tarpit! You can only make 1 request every 4 seconds...


It's actually the fifth one. :)

pb = results(5)


:) Didn't test it, was a guess...

Marco1
31st December 2008, 17:27
donīt give up so fast if you want it realy you will get it !
many times its just a simple failure what you done maybe a } or { to mutch i know this probs from my cruise insim

Silox
1st January 2009, 08:16
Can someone make me the code for:

First Place
Total Distance
Total Driven Laps
Races Finished
Fuel Burnd


PLEASE!


HAPPY NEW YEAR!

You want us to make a System for you? That's gonna cost some money I think...

easyed
22nd January 2009, 15:02
Hi Heiko -

I was wondering if there is a website for your servers that would have such things as rules, stats etc??

Been watching from the remote and it sure looks like it is doing well :)

Mgtghei
27th January 2009, 12:58
hi some belgiumranking system admin here ?