The online racing simulator
Quote from glyphon :oh, i forgot to mention, if you are using premium pubstats, you can remove the sleep(5) line, if you haven't already.

Yeah i had done actually, it was taking forever to load the page for 9 members


Quote from glyphon :and your function already supports what you want.

<?php 
//TeamPlayerOnline("Display Name", "LFS Player Name")
TeamPlayerOnline("Eagle""Astroboy");
?>


Would you believe it eh? The things you can do by mistake


Thanks for all your help fella, much appreciated
I have a small problem, as i'm still learning php i can't figure this out.

in this line;

<?php 
$varStats 
$SDK->get_pst(urlencode(The Very End));
?>

I'm getting an error as the urlencode doesn't seem to be working.
Maybe i've missunderstood what the urlencode does, but i thought it basically turned "The Very End" into "The%20Very%20End".

That line of code works fine with ANY username without spaces, but as soon as a space is introduced i start getting errors on that line.

So, i must be doing something wrong, does anyone know what?
Quote from GFresh :I have a small problem, as i'm still learning php i can't figure this out.

in this line;

<?php 
$varStats 
$SDK->get_pst(urlencode(The Very End));
?>

I'm getting an error as the urlencode doesn't seem to be working.
Maybe i've missunderstood what the urlencode does, but i thought it basically turned "The Very End" into "The%20Very%20End".

That line of code works fine with ANY username without spaces, but as soon as a space is introduced i start getting errors on that line.

So, i must be doing something wrong, does anyone know what?

I think there is another method named "rawurlencode()". AFAIR the only difference is the treating of spaces - urlencode maps spaces to "+" while rawurlencode produces the expected "%20".

(This info is just from my head so it might be totally wrong. But i remember having similar problems...)
Yeah, i forgot to mention, i have tried a couple of different codes.
The one i posted above doesn't throw an error, it just doesn't retrieve any stats.
If i do the same line, but use rawurlencode(), then it throws an error on that line.




Thanks.


EDIT: I lie! Both of those throw an error...
Can you give the actual line of code and the error text? I use rawurlencode() and do not have any issues.
Certainly.
The line of code is in my post above, and the error text is;

Parse error: syntax error, unexpected T_STRING in C:\***\***.php on line 50
[COLOR=#000000][COLOR=#000000][COLOR=#000000][COLOR=#0000bb]$varStats [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$SDK[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000bb]get_pst[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]urlencode[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]The Very End[/COLOR][COLOR=#007700]));[/COLOR][/COLOR][/COLOR][/COLOR]

urlencode expects a string, have you tried wrapping The Very End in quotes?
[COLOR=#0000bb][COLOR=#000000][COLOR=#000000][COLOR=#000000]$varStats [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$SDK[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000bb]get_pst[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]urlencode[/COLOR][COLOR=#007700]("[/COLOR][COLOR=#0000bb]The Very End"[/COLOR][COLOR=#007700]));[/COLOR][/COLOR][/COLOR][/COLOR]


or

$racer = "The Very End";
$varStats = $SDK->get_pst(urlencode($racer));

I will try those.

Thanks a lot.


EDIT: Yep, changing to a string worked
Thanks fella, nice one!
LFSWorldSDK 1.8Alpha
Here is 1.8Alpha, tell me if you find any issues. Keep in mind this works of a soon to be removed URL, so this is just for testing ... and I mean that. Also I know about the progress function not working.

I do need some help with the rest of the cars as they are no longer in order ...


<?php 
    
function convert_car_bits($bits) {
    
$data = array();
    if (
$bits 1)
        
$data[1] = 'XFG';
    if (
$bits 2)
        
$data[2] = 'XRG';
    if (
$bits 4)
        
$data[4] = 'XRT';
    if (
$bits 8)
        
$data[8] = 'RB4';
    if (
$bits 16)
        
$data[16] = 'FXO';
    if (
$bits 32)
        
$data[32] = 'LX4';
    if (
$bits 64)
        
$data[64] = 'LX6';
    if (
$bits 128)
        
$data[128] = 'MRT';
    if (
$bits 128)
        
$data['raw'] += $bits;
    return 
$data;
}
?>

Attached files
LFSWorldSDK1.8Alpha.zip - 2.2 KB - 450 views
Maybe will help...
The function trys to return an array with car classes first and then individual cars.


<?php 
$cars 
= array(
  
'XFG' => array('name'=>'XF GTI'       ,'bit'=>1     ),
  
'XRG' => array('name'=>'XR GT'        ,'bit'=>2     ),
  
'XRT' => array('name'=>'XR GT Turbo'  ,'bit'=>4     ),
  
'RB4' => array('name'=>'RB4 GT'       ,'bit'=>8     ),
  
'FXO' => array('name'=>'FXO Turbo'    ,'bit'=>16    ),
  
'LX4' => array('name'=>'LX4'          ,'bit'=>32    ),
  
'LX6' => array('name'=>'LX6'          ,'bit'=>64    ),
  
'MRT' => array('name'=>'MTR5'         ,'bit'=>128   ),
  
'UF1' => array('name'=>'UF 1000'      ,'bit'=>256   ),
  
'RAC' => array('name'=>'RaceAbout'    ,'bit'=>512   ),
  
'FZ5' => array('name'=>'FZ50'         ,'bit'=>1024  ),
  
'FOX' => array('name'=>'Formula XR'   ,'bit'=>2048  ),
  
'XFR' => array('name'=>'XF GTR'       ,'bit'=>4096  ),
  
'UFR' => array('name'=>'UF GTR'       ,'bit'=>8192  ),
  
'FO8' => array('name'=>'Formula V8'   ,'bit'=>16384 ),
  
'FXR' => array('name'=>'FXO GTR'      ,'bit'=>32768 ),
  
'XRR' => array('name'=>'XR GTR'       ,'bit'=>65536 ),
  
'FZR' => array('name'=>'FZ50 GTR'     ,'bit'=>131072),
  
'BF1' => array('name'=>'BMW Sauber'   ,'bit'=>262144),
  
'FBM' => array('name'=>'Formula BMW'  ,'bit'=>524288),
);

$cars_c = array(
  
'ALL' => array('name'=>'All'          ,'bit'=>1048575),
  
'STD' => array('name'=>'STD Class'    ,'bit'=>259    ),
  
'TBO' => array('name'=>'TBO Class'    ,'bit'=>28     ),
  
'LRF' => array('name'=>'LRF Class'    ,'bit'=>1600   ),
  
'FWD' => array('name'=>'FWD Class'    ,'bit'=>12561  ),
  
'GTR' => array('name'=>'GTR Class'    ,'bit'=>229376 ),
  
'S-S' => array('name'=>'S-S Class'    ,'bit'=>804992 ),
);

function 
lfsw_get_host_cars_array($bits) {
  global 
$cars$cars_c;
  
$tmp = array();
  foreach (
$cars_c as $k => $class) {
    if ((
$class['bit'] & $bits) == $class['bit']) {
      
$tmp[$k] = &$cars_c[$k];
      
$bits -= $class['bit'];
      if (
$bits==0) {return $tmp;}
    }
  }
  foreach (
$cars as $k => $car) {
    if ((
$car['bit'] & $bits) == $car['bit']) {
      
$tmp[$k] = &$cars[$k];
      
$bits -= $car['bit'];
      if (
$bits==0) {return $tmp;}
    }
  }
  return 
$tmp;
}
?>

Quote from kanutron :Maybe will help...
The function trys to return an array with car classes first and then individual cars.

I like the idea ... But, I don't think that is the direction I want to go with the SDK at this time. Thanks for the rest of the Bit flags tho.
Does anybody have idea how to import and show tracker on Joomla 1.5? I need on tracker WR, HL, PB and 103% from the best PB/HL. Thanks for futher help!
LFSWorldSDK 1.8
Update, nothing major. You'll should know the drill by now.

There is one extra thing in there now tho. There is a file called, lfsworldsdk_all.php, what that file does is convert the different bit flags for you. The normal lfsworldsdk.php file has that ability, the functions are there, but it is not done on the fly.
Attached files
LFSWorldSDK1.8.zip - 4.3 KB - 776 views
Quote from Dygear :Update, nothing major. You'll should know the drill by now.

There is one extra thing in there now tho. There is a file called, lfsworldsdk_all.php, what that file does is convert the different bit flags for you. The normal lfsworldsdk.php file has that ability, the functions are there, but it is not done on the fly.

For me? Tnx.
Quote from Dygear :Update, nothing major. You'll should know the drill by now.

There is one extra thing in there now tho. There is a file called, lfsworldsdk_all.php, what that file does is convert the different bit flags for you. The normal lfsworldsdk.php file has that ability, the functions are there, but it is not done on the fly.

I've been playing around with this SDK and I found a couple of problems.

- while lfsworldsdk_all.php seem to work as expected, trying to use lfsworldsdk.php results in page timeout without any result retrieved.
Comparing the two I couldn't spot the difference in the code responsible for this... (I'm just beginning with PHP, sorry)

- host progress gives problems related to compression issue. Removing the compression bit from the query solves the problem.
I will check into this right now, have not seen this code in quite some time so I would not be able to give you the answers right away.

The get_progress function is a known bug, one that I've not gotten around to fixing.
As for the normal vs all version of the lfsworldsdk timing out, I would like to see the code that reproduces this.
I would assume that you are using the same code for this query, and only changing the included_once or required_once file.
Yes, I'm using the same code included as an example in the package.


<?php 
php
    
include('lfsworldsdk.php');
    
print_r($SDK->get_hl(array('Ulisse''filur''Victor''glyphon')));
    echo 
'<!-- get_ch -->Test<p />';

?>

This code never gets to echoing 'Test'.
Including lfsworldsdk_all.php works as expected...
Hello,

i try to get a hl list from some driver on 2 tracks, but everything i try, nothing works :-(

maybe here anyone who can help me, i read all posts here andy try all. but no way. i get latest sdk version, but no way for me.

Im not a code PRO, i need only

2 tracks KY2 and AS7 for the GTRs i only need the timestamps.

this try dosn´t work


<?php 
php
    
include('lfsworldsdk.php');
    echo 
'<!-- get_hl --><p />';
    
print_r($SDK->get_hl(array('kiste''FXR', )));
//
?>


<?php 
php
    
include('lfsworldsdk.php');
    echo 
'<!-- get_hl --><p />';
    
print_r($SDK->get_hl('kiste, array('KY2' 'AS7'), array('FXR'))));
//
?>


the first give me all hotlaps, the second a error on line 4

when i have 30 drivers its to much data ^^

i hope anyone can help me, thx a lot

:-)
Quote from [BiA]Luder :

<?php 
print_r
($SDK->get_hl('kiste, array('KY2' 'AS7'), array('FXR'))));
?>



You made an error in your code. The error can be found here: 'kiste, Simply put, you did not close your quote. And the funny thing is, the PHP Code highlighter in this forum picked up that error!

So, with that fix implemented, your code now looks like this:

<?php 
print_r
($SDK->get_hl('kiste', array('KY2' 'AS7'), array('FXR'))));
?>

Replace the 4th line of your code with that, and then it should work.

Please check over your own code, and read the errors that the PHP parser gives you. They are not there to laugh at you, they are there to help you find out what went wrong.
Hello and thx.


<?php 
print_r
($SDK->get_hl('kiste, array('KY2' 'AS7'), array('FXR))));  
?>

doesn´t work

error

Quote :
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')'

i don´t know why we close the array twice ?
[COLOR=#000000][COLOR=#DD0000]('[/COLOR][COLOR=#0000BB]KY2[/COLOR][COLOR=#DD0000]' '[/COLOR][COLOR=#0000BB]AS7[/COLOR][COLOR=#DD0000]')[/COLOR][/COLOR]

so we close quote 5th ( in the end again ) when i delete one, it dosnt working :-(


but, now i will see later again

thx 4 help
greetz jörg
Quote from [BiA]Luder :

<?php 
print_r
($SDK->get_hl('kiste, array('KY2' 'AS7'), array('FXR))));  
?>


I knew you had two errors in your code, I just forgot to tell you about the second one ...
Simply put, array objects have to be separated. ('KY2', 'AS7'). Like so.


<?php 
print_r
($SDK->get_hl('kiste', array('KY2''AS7'), array('FXR'))));
?>

ok thx a lot, i will try later
can somebody make a short tutorial about how to use this?

i get this

Warning: Invalid argument supplied for foreach() in /h....../public_html/lfswsdk/lfsworldsdk.php on line 173


Warning: Invalid argument supplied for foreach() in /home/...../lfswsdk/lfsworldsdk.php on line 181
Quote from Andrei221 :can somebody make a short tutorial about how to use this?

i get this

Warning: Invalid argument supplied for foreach() in /h....../public_html/lfswsdk/lfsworldsdk.php on line 173


Warning: Invalid argument supplied for foreach() in /home/...../lfswsdk/lfsworldsdk.php on line 181

What version are you using? Sorry for the late reply also, for what ever reason, I did not get a E-Mail when this thread got a hit, I just happend to stumble apon it.
i have LFSWorldSDK1.8

FGED GREDG RDFGDR GSFDG