The online racing simulator
http and get [SOLVED]

http("http://www.demourl.nl/lfs_plugin.php?u=". GetCurrentPlayerVar("UserName") );

This doesn't seem to work

Is it possible to use a variable in an url?
In fact...

"Normal" http requests doesn't seem to work either. Is that true?

http("http://www.demourl.nl/lfs_plugin.php" );

I doesn't see any request trying to be made in my HTTP server log.

Are http requests limited to http://www.frh-team.net ... Hope not :eye-poppi
Quote from nl2dav :In fact...

"Normal" http requests doesn't seem to work either. Is that true?

http("http://www.demourl.nl/lfs_plugin.php" );

I doesn't see any request trying to be made in my HTTP server log.

Are http requests limited to http://www.frh-team.net ... Hope not :eye-poppi

well i hope u arnt trying to connect to demourl.nl as that isnt even a real url :P
No

I used search and discovered that there is someone with a similar idea like I have.

http://www.lfsforum.net/showthread.php?p=1265539#post1265539

demourl is just there for people like Fire_optikz001 who are too curious

But its basically a true/false generator based on laps someone made. To keep crashers and fake accounts out of our races.

//edit: LOL, I just realized thats your thread
Sigh...

I'm used to use // when I comment on my own code

If you do that all upcoming code turns invalid. Its working now

* Also I would like to add that it looks like you can only use the http instruction once during an event.
thats not nice :P why not use a login sys? which culd be hard or very easy :P
Why do I want another login systeem?

It destructs the open character of the game. The only people I don't want are the not so serious people.

The lap threshold is working now, maybe I put in a PB threshold or a win/second/third threshold as well...

Got to find out how this develops.
#8 - Krayy
I've sent a patch to Gai-Luron which should make http handling a lot more useful. Hopefully he will include it in the next update.
Hello,

i think there is a misunderstanding on how work http request. When you send a request to a web server LFSLapper attemps to receive a GLScript code and execute it.

Example
if i use you web call: you send a request to know if player is allowed, http("http://www.demourl.nl/lfs_plugin.php?u=". GetCurrentPlayerVar("UserName") );
and GetCurrentPlayerVar("UserName") -> "gai-luron"

web response can contain this glScript lines:

$allowed = 1;
$userName = "gai-luron";
doMyCode( $userName,$allowed );

OR

doMyCode( "gai-luron",1 );

LFSLapper interpret this GLScript code and in this code you can see you have a call to subroutine. This subroutine can be declared in lpr file.

In you lpr file tou have:
SUB doMyCode( $userName,$allowed )
... Do what you want if lpr file
IF( $allowed == 0 ) THEN
cmdlfs( "/kick " . $userName );
ELSE
privMsg("Allowed");
ENDIF

ENDSUB

And other way is to put all code in the returned webcommand
Request = http("http://www.demourl.nl/lfs_plugin.php?u=". GetCurrentPlayerVar("UserName") );

Returning web commands if allowed:

privMsg("Allowed");

Returning web commands if not allowed:

cmdlfs( "/kick gai-luron");

It's a very flexible system more than returning value inline, i hope i'am clear.

Krayy i see your code but it's not usefull when you know how webreturn work. Thank's anyway

Gai-Luron

PS: You can put any GLScript command in returned web, like top(), topuser(), etc...
Yes, excellent reply... Thank you.

Its already working and doing great

# check minimum amount of laps
$laps_username = GetCurrentPlayerVar("UserName");
http("http://demourl.nl/lfs_plugin.php?u=". $laps_username );


<?php 

$username 
$_GET['u'];
$req '';
$check_XRG '';
$check_XFG '';
$fp fopen ("http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&idk=use_your_own_here_please&action=pb&racer=".$username."&s=1""r");
while (!
feof($fp))
{
    
$req .= fread($fp500);
}
fclose($fp);

$lfs_php_array json_decode($req);

if (
sizeof($lfs_php_array) == 0) {
    echo 
"error";
    die();
}

for (
$i 1$i <= sizeof($lfs_php_array); $i++) {
$n $i 1;
    if (
$lfs_php_array[$n]->track == "000" && $lfs_php_array[$n]->car == "XRG") {
        if (
$lfs_php_array[$n]->lapcount 40) {
            
$check_XRG 1;
        }
        else {
            
$check_XRG 0;
        }
    }
    if (
$lfs_php_array[$n]->track == "000" && $lfs_php_array[$n]->car == "XFG") {
        if (
$lfs_php_array[$n]->lapcount 40) {
            
$check_XFG 1;
        }
        else {
            
$check_XFG 0;
        }
    }
}

if (
$check_XFG == OR $check_XRG == 1
{
    
// echo 'globalMsg("true");';
}
else 
{
    echo 
'privMsg("^3Woops you are a newbie! Please come back in 3 days, bye!");';
    echo 
'GlobalMsg("'.$username.' is unexperienced (<40 laps /car) and gets a 3 day ban");';
    echo 
'cmdLFS("/ban '.$username.' 3" );';
    
// echo 'GlobalMsg("'.$username.' - XFG: '.$check_XFG.' XRG: '.$check_XRG.'");';
}



?>

The only flaw is that it generates an error if it requests stats within 5 seconds, could fix that by using multiple stat idk's but I think its OK for now.
You can insert a tarpit in your php Script and retry 5 second later.

Receive WebCmd in LFSLapper is asynchronus and don't freeze working of LFSLapper in waiting to receive web response.

Soon, LFSLapper retreive by ownself this stats values.

Gai-Luron
Quote from Gai-Luron :Hello,

i think there is a misunderstanding on how work http request. When you send a request to a web server LFSLapper attemps to receive a GLScript code and execute it.

Example
if i use you web call: you send a request to know if player is allowed, http("http://www.demourl.nl/lfs_plugin.php?u=". GetCurrentPlayerVar("UserName") );
and GetCurrentPlayerVar("UserName") -> "gai-luron"
...

Ahhhh...I wondered why it was creating the WebReturnFunction function dynamically. Very clever and flexible to boot.

Let me know if my "suggestions" start get annoying
Good to know its asynchronous but I hate delays if they are not necessary so I extended the routine with an extra IDK
Quote from Krayy :Ahhhh...I wondered ...

Let me know if my "suggestions" start get annoying

No no problem you can continue, it's a better way to learn on how work Lapper. If i don't want suggestions, i don't release source and i make a "closed" app. you can't know everything on Lapper, me too i forgot many things on LFSLapper and some user know my app better than me

Gai-Luron
wow that's cruel a 3 day ban for just because they haven't drove 40 laps
Quote from Fire_optikz001 :wow that's cruel a 3 day ban for just because they haven't drove 40 laps

Hell it takes me 2 days to do 20 laps in an RAC, so why not?
Yeah maybe 1 day is okay too... But most newbies are not doing 40 laps in one day.

Somehow its not checking user accounts with a space, got to find out why.

The script above is old anyway, contains more bugs.
Quote from Krayy :Hell it takes me 2 days to do 20 laps in an RAC, so why not?

XD noob i can do 20 lap races in about an hour ... in xfg
Quote from Fire_optikz001 :XD noob i can do 20 lap races in about an hour ... in xfg

/off topic.
Please upload it on the follow combo : AS7R and XFG

You Noob, how can you say that. he got a good point...
Quote from hotmail :/off topic.
Please upload it on the follow combo : AS7R and XFG

You Noob, how can you say that. he got a good point...

u heard of sarcasm?
Quote from Fire_optikz001 :u heard of sarcasm?

Apparently not in Holland...Ishint dat veeerdt? I love Goooooooolllllld!!!!


P.S You want a schmoke and a pancake? How bout a shigar and a waffle?
Ey! Don't generalize a complete nation just because of one posting

It's a demo problem anyway. I suppose you don't need these kind of measurements when running a S1 or S2 server. The people there are already lost on those servers
Quote from nl2dav :Ey! Don't generalize a complete nation just because of one posting

Sorry about that, but Goldmember WAS a funny movie

FGED GREDG RDFGDR GSFDG