The online racing simulator
CVS updated to fix some of the more major errors:

Fixed Hosts Unpack Error.
Fixed Incorrect Amount of HL being returned (one two few).
Fixed Incorrect Amount of PB being returned (one two few).
Fixed Incorrect Amount of CH being returned (one two few).
Fixed Incorrect Amount of WR being returned (one two few).
Fixed Incorrect Amount of PST being returned (one two few).
Hello,
i don't know if i'm at the right place, but i ask u:

I want to make website for spliting racers into divisions by hotlaps from LFSWorld. I find Live for Speed Pubstats S2 v1.3 i can get chart of hotlaps for track and car.
But i don't know how to pick some racers and divide them to 2 or more divisions? I think that i have to use your php script, but i don't know how. Coud u give me some advices? Thank u very much for answers.

Edit: i read something about it and i know that i have to place on web LFSWorldSDK.php from post #1 and than i have to create another php file with that script what i want. Am i right?
Download this one.. (Ver 1.5). If you need any more help just post here.
Quote from Dygear :Download this one.. (Ver 1.5). If you need any more help just post here.

Thanx a lot for that, i place it on my website and i tried it, but i have some problems... i write u PM, because in errors it shows my IDK.
Quote from Dygear :Download this one.. (Ver 1.5). If you need any more help just post here.

little hint... leave away the ?revision param, and it will afaik always display the HEAD revision. this could be useful for the first post especially.
Thanks for the tip St4Lk3R.
I put your lfsworldsdk.php at another web: http://www.komora.sk/lfs/lfsworldsdk.php

Could u check it? I'm not sure if it works properly? I was thinking, that it pick up and show only hotlap from Dygear and filur, but it shows quite big list of... many parameters....
That's what your meant to see. That's an array filled with the information you requested. You can then use that to build your (web) application.
Ok, i see.... i left in lfsworldsdk.php only this (from print part of script): print_r($SDK->get_ch(array('621'), array('XFR')));

http://www.komora.sk/lfs/lfsworldsdk.php

It print array with hotlaps from combo AS National Revision - XFR. I think that i need another php script to pick up certain racers from that list. Could u please explain me, or better give me an expample how i pick up for example me: Megin and another one: Ondrejko from that list of hotlaps?That will be wery useful for me

<?php 
require 'lfsworldsdk.php';
$SDK = new LFSWorldSDK('idkey goes here');

function 
some_function_name($SDK$track$car$racers) {
    
$chart $SDK->get_ch(array($track), array($car));
    
$ret   = array();
    
    foreach (
$chart[$track][$car] as $key => $item) {
        if (
in_array($item['racername'], $racers)) {
            
$ret[]  = $item;
            
$sort[] = $item['time'];
        }
    }
    
    
array_multisort($sortSORT_ASC$ret);
    return 
$ret;
}

$drivers = array('Megin',
                 
'Ondrejko',
                 
'dime_miki',
                 
'BenjiMC');

$table some_function_name($SDK621'XFR'$drivers);

foreach (
$table as $p => $driver)
    echo (
$p 1), '. '$driver['racername'], '<br />'PHP_EOL;
?>

Brings a tear to my eye filur.
Say it with me now "Heeessssssssssssssss baaaaaaaaaaaaaackkkkkkkkkkk!"
Thank u guys a lot , it finaly works .
Now i try modify that myself - add there time of drivers and divide them to division (when i pick up more drivers). So i hope it will be without big problems, if not.... i ask here, becouse PRO like U always know....
Quote from PaulC2K :... amongst other HL info, how would i go about picking out peices so i can specify say:
$id = 1205
$track = 420
$car = BF1
$time = 104250
$flags_hlaps = 1614

I found an awesome function that will do what you asked. (Turn an array into tokens / variables that you can use.)


<?php 
foreach($sdk->hl('Dygear') as $item)
    
extract($itemEXTR_OVERWRITE);
?>

Quote from Dygear :I found an awesome function that will do what you asked. (Turn an array into tokens / variables that you can use.)


<?php 
foreach($sdk->hl('Dygear') as $item)
    
extract($itemEXTR_OVERWRITE);
?>


LOL
5th October 2006, 22:54

Cant say your not committed to answering any questions asked no matter how long ago they were asked!

Havent actually made use of the SDK for quite some time , did our teams update for xmas and never got round to updating the SDK powered scripts (though i still plan to) but that should come in handy when i figure out what it might have been that I needed to do what i was asking about

Cheers.
I always fell bad when I don't have an answer to question, and I found that one line fix and that rocks.
Hi Dygear,

i have a problem with the SDK

Please check the following code:
Quote :
<?php
require_once("scripts/LFSWorldSDK.php5");

$id_key = "<my key>";
$use_premium = FALSE;
$SDK = new LFSWorldSDK($id_key, $use_premium);

// Test "Lord Of Death"
print_r($SDK->get_pb('Lord Of Death'));

?>

I always get an empty array. But if you check lfsworld (http://www.lfsworld.net/?win=s ... p;racer=Lord%20Of%20Death)you see he has quite some pbs stored.

Any idea?

(I am using version 1.5)


EDIT: As some motivation for you :
Yesterday i launched my TeamStats page in the german lfs forum with great feedback. I am using lfsworldSDK as the backend to retrieve the stats of the drivers and store it with MySQL. Check it out here: http://teamstats.m-bauer.org. If all goes well i will also announce it "officially" here in the forum. But i want to clear most bugs before
Thank you
I didn't check the LFSWorldSDK, but you may want to check if the get_pb function does a urlencode on the racer value. Since Lord of Death contains spaces you need to urlencode it.
Quote from bdshan :I didn't check the LFSWorldSDK, but you may want to check if the get_pb function does a urlencode on the racer value. Since Lord of Death contains spaces you need to urlencode it.

DOH, sometimes it is so easy But to correct you, it only works with "rawurlencode()" (where spaces are converted to "%20" instead of "+").

Thanks very much!
Yeah, I'll consider urlencodeing the racer name in the next version.
(Although, I would not call the base compleat, it's done.)

Thanks to bdshan for the help, with the help.
2x $result['online'] in get_pst()
Hi Dygear,

dont know whether it was mentioned before, but in function get_pst() you use 2 times $result['online'] . I think it should be one times for $result['online_status] and one times for $result['online_credits].

So in the next version you can change it.
My, I messed up that one quite well. Yeah, I did not even notice that one.
Hello, i'm back with another problem. this is example:


<?php 
php
require 'lfsworldsdk.php'
$SDK = new LFSWorldSDK('idkey goes here'); 
function 
some_function_name($SDK$track$car$racers) { 
    
$chart $SDK->get_ch(array($track), array($car)); 
    
$ret   = array(); 
     
    foreach (
$chart[$track][$car] as $key => $item) { 
        if (
in_array($item['racername'], $racers)) { 
            
$ret[]  = $item
            
$sort[] = $item['time']; 
        } 
    } 
     
    
array_multisort($sortSORT_ASC$ret); 
    return 
$ret


$drivers = array('Megin'
                
'BIGMAN'
                
'eraser_svk'    
                
);
                 
               
$table some_function_name($SDK'000''RB4'$drivers);
foreach (
$table as $p => $driver
    echo (
$p 1), '. '$driver['racername'], '<br />'PHP_EOL;
  
 
?>

it make order by hotlaps, on BL1 with RB4 but i don't know how i can add for drivers specific car (TBO class)
Megin - FXO
BIGMAN - RB4
eraser_svk - RB4
and make order with this specific combos

Could u correct this example? Thanx a lot
How about altering the driver array to be an associative array


[COLOR=#0000bb]$drivers [/COLOR][COLOR=#007700]= array([/COLOR][COLOR=#dd0000]'Megin'=>'FXO'[/COLOR][COLOR=#007700],
[/COLOR][COLOR=#dd0000]'BIGMAN'=>'RB4'[/COLOR][COLOR=#007700],
[/COLOR][COLOR=#dd0000]'eraser_svk'=>'RB4'[/COLOR]
[COLOR=#007700]);[/COLOR]

Then in your function use the array keys for the driver and the value as the car.


function [COLOR=#0000bb]some_function_name[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$SDK[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$track[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$racers[/COLOR][COLOR=#007700])[/COLOR]

Just a quick thought off the top of my head.
I try something like that but it didn't work, some modifing of my example will be useful
Your on the right path grasshopper. I cleaned up your code, but made not changes.


<?php 
php

require_once('lfsworldsdk.php');
$SDK = new LFSWorldSDK('idkey goes here');

function 
some_function_name($track$car$racers) {
    global 
$SDK;
    
$chart $SDK->get_ch($track$car);
    
$ret   = array();
    foreach (
$chart[$track][$car] as $key => $item) {
        if (
in_array($item['racername'], $racers)) {
            
$ret[]  = $item;
            
$sort[] = $item['time'];
        }
    }
    
array_multisort($sortSORT_ASC$ret);
    return 
$ret;
}

$drivers = array(
    
'Megin',
    
'BIGMAN',
    
'eraser_svk'
);

$table some_function_name($SDK'000''RB4'$drivers);
foreach (
$table as $p => $driver) {
    echo (
$p 1), '. '$driver['racername'], '<br />'PHP_EOL;
}
?>


FGED GREDG RDFGDR GSFDG