The online racing simulator
Nice mod. I'll put that into our Lapper installs.

Couple of things:

1) Use GetStoredNum to return a numeric, not a string otherwise you need to do a string to num conversion for compare
- thats where your script error came from, trying to minus a string from a number - the following would have fixed it:

<?php 
  $OldTopSpeed 
GetUserStoredValue$userName"OldTopSpeed" );
  
$STdiff ToNum($OldTopSpeed) - $TopSpeed;
?>

BUT...

2) Don't do the ToMph conversion before the pseed compare as this will round down the result to 2 decimal places and is inaccurate
3) Do not use commas in a storevalue key as the SQL parser will incorrectly interpret them
4) Move the notification from the top left as game messages obscure it

Try the code below, replacing all of the Speedtrap# commands with the templates below (makes it easier to maintain) and the Language defs:

<?php 
Sub DoSpeedTrap
$num )
    
$userName GetCurrentPlayerVar"UserName" );
    
$car GetCurrentPlayerVar("Car");
    
$track getLapperVar("ShortTrackName");
    
$TopSpeed ToNumGetCurrentPlayerVar"InstantSpeed" ));
    
$OldTopSpeed GetUserStoredNum $userName"ST" $num "TopSpeed-" $track "-" $car);
    
    IF ( 
$OldTopSpeed # Have not had a valid Speedtrap time before
    
THEN
        openPrivButton
"st_text",1,16,20,5,3,4,80langEngine "%{main_st_none}%" ,ToMph($TopSpeed) ) );
        
SetUserStoredNum $userName"ST" $num "TopSpeed-" $track "-" $car$TopSpeed);
    ELSE
        IF ( 
$TopSpeed $OldTopSpeed)
        
THEN
            openPrivButton
"st_text",1,16,30,5,3,4,80langEngine "%{main_st_faster}%" ToMph($TopSpeed ), ToMph($TopSpeed $OldTopSpeed) ) );
            
SetUserStoredNum $userName"ST" $num "TopSpeed-" $track "-" $car$TopSpeed);
        ELSE
            
openPrivButton"st_text",1,16,30,5,3,4,80langEngine "%{main_st_slower}%" ,ToMph($TopSpeed), ToMph($OldTopSpeed $TopSpeed)  ) );
        ENDIF
    ENDIF
EndSub

Sub SpeedTrap1
$userName )
    
DoSpeedTrap);
EndSub

Sub SpeedTrap2
$userName )
    
DoSpeedTrap);
EndSub

Sub SpeedTrap3
$userName )
    
DoSpeedTrap);
EndSub

Sub SpeedTrap4
$userName )
    
DoSpeedTrap);
EndSub

Sub SpeedTrap5
$userName )
    
DoSpeedTrap);
EndSub

Sub SpeedTrap6
$userName )
    
DoSpeedTrap);
EndSub

Lang 
"EN"
    
main_st_faster "^0Radar Trap: {0} mph (^2+{1}^0)";
    
main_st_slower "^0Radar Trap: {0} mph (^1-{1}^0)";
    
main_st_none  "^0Radar Trap: {0} mph";
EndLang
?>


Just a thought...one addition you could make to the above code is to add an OnRaceStart CatchEvent to cycle through a list of players (GetListOfPlayers) to set their current track & car times to -1 before the race starts so people get fresh stats each race. Of course you would need to set the stored value for all of the split numbers you have (6 at the moment).

Although seeing the stats based on your best time does give you something to aim for.

Alternativey, use this code tthat doesnt store vars:

<?php 
Sub DoSpeedTrap
$num )
    
$userName GetCurrentPlayerVar"UserName" );
    
$car GetCurrentPlayerVar("Car");
    
$track getLapperVar("ShortTrackName");
    
$TopSpeed ToNumGetCurrentPlayerVar"InstantSpeed" ));
    
$OldTopSpeed ToNum(GetCurrentPlayerVar "ST" $num "TopSpeed-" $track "-" $car));
    
    IF ( 
$OldTopSpeed # Have not had a valid Speedtrap time before
    
THEN
        openPrivButton
"st_text",1,16,20,5,3,4,80langEngine "%{main_st_none}%" ,ToMph($TopSpeed) ) );
        
SetCurrentPlayerVar "ST" $num "TopSpeed-" $track "-" $car$TopSpeed);
    ELSE
        IF ( 
$TopSpeed $OldTopSpeed)
        
THEN
            openPrivButton
"st_text",1,16,30,5,3,4,80langEngine "%{main_st_faster}%" ToMph($TopSpeed ), ToMph($TopSpeed $OldTopSpeed) ) );
            
SetCurrentPlayerVar "ST" $num "TopSpeed-" $track "-" $car$TopSpeed);
        ELSE
            
openPrivButton"st_text",1,16,30,5,3,4,80langEngine "%{main_st_slower}%" ,ToMph($TopSpeed), ToMph($OldTopSpeed $TopSpeed)  ) );
        ENDIF
    ENDIF
EndSub
?>


Many thanks for the coding help Krayy. Will try it when I get home tonight (i'm currently at work).

I especially liked the $num in the sub header part.

Quote from Krayy :Just a thought...one addition you could make to the above code is to add an OnRaceStart CatchEvent to cycle through a list of players (GetListOfPlayers) to set their current track & car times to -1 before the race starts so people get fresh stats each race. Of course you would need to set the stored value for all of the split numbers you have (6 at the moment).

Although seeing the stats based on your best time does give you something to aim for.

As I use Yisc's Pitboard add-on (have used it since first came out), I'm used to aiming for green split/sector times.

When I first had the speedtraps, I had set them on long straights, bit like what you get on F1 timings to see who had highest top speed.

But recently, having listened to Martin Brundell enough times doing BBC1's F1 commentary, he talks a lot about corner entry and corner exit speeds.

Because of these 2 things, I thought I'd change my philosophy for the speedtraps, and I've started to change the locations so that they're after the exit of a corner, or series of corners. This way I could see if I was losing time (slower speed=longer time) on a corner or series of corners, and seeing how different lines compared.

Of course, if I was a consistant driver, that would be very helpful, but I'm the sort of driver that can be +/- a couple of seconds per lap.

Saw your comment about placement of the speed/radar traps. Yes, I was going to move that once I got the code sorted out. If I can find space somewhere.

I was also thinking about having a sort of table of speedtraps that stayed up every lap, and as you went on another lap, the speeds would be overwritten. That way you could maybe see which part of the lap was costing you time.

e.g. (first time using car/track combo)
Lap 1
Radartrap1: 67.21 mph
Radartrap2: 85.76 mph
Radartrap3: 92.83 mph

Lap 2
Radartrap1: 68.98 mph
Radartrap2: 83.65 mph
Radartrap3: 92.88 mph

etc.

Still debating this; lots of people already think far too much InSim "stuff" cluttering up the screen as it is. But then again, I do stuff that suits me!

One last thing - about the mph part of the code.

Originally I didn't have that; I wanted it to be kph/mph depending on what people choose to be their default speed unit choice. But that didn't work; it would always choose to show speeds in kph.

Tried lots of things, like
ToPlayerUnit( GetCurrentPlayerVar( "InstantSpeed" )),GetCurrentPlayerVar("UnitSpeed") ) );

but always gave me kph.

And I had problems with calculations, etc, when trying to include the UnitSpeed.

If anyone else wants to use this code, but they want to have kph as the default rather than mph, then where code says ToMph( value ), change it to ToKph( value ). I'll need to see if changing it to ToPlayerUnit( value ) will work with your code.

Again, thanks.
OK, works a treat.

I've changed the text colour (to suit myself) as the black is too dark, and I've changed the location to show on my HUD, above the mirror.

Again, thanks.
Attached images
Speedtrap.png
Here's a modified version taht is designed to allow a more modular approach for setting Traps in mid-corner, corner exit or whever you want. I've changed the display to be basic PrivMsg's, so you'll need to change them if you want to use it in your HUD.

Add extras nodes like this (although the Nodes are worng, this is just a demo):


<?php 
    RegisterNodeAction
"FE1" 50StMidCorner1,"" );
    
RegisterNodeAction"FE1" 105SpeedTrap1,"" );
    
RegisterNodeAction"FE1" 288SpeedTrap2,"" );
?>

This also displays the speed based on the players UnitSpeed.

PS: This version is mostly optimised by reducing the number of calls to the Lapper.exe by using the GetPlayerInfo function that returns an array to the Lapper script that contains all relevant calls. Also, the GetStored* and SetStored* functions can be called without the $UserName parameter as it will default to current player.


<?php 
Sub DoSpeedTrap
$TrapType$TrapText$TrapNum )
    
$currPly GetPlayerInfo();
    
$TopSpeed ToNum$currPly["InstantSpeed"] );

    
$StoredVarName "TrapSpeed" "-" $TrapType "-" $TrapNum "-" getLapperVar("ShortTrackName") . "-" $currPly["Car"];
    
$OldTopSpeed GetUserStoredNum $StoredVarName);
    
    IF ( 
$OldTopSpeed # Have not had a valid Speedtrap time before
    
THEN
        privMsg 
langEngine "%{main_st_none}%" $TrapTextToPlayerUnit($TopSpeed), $currPly["UnitSpeed"] ) );
        
SetUserStoredNum $StoredVarName$TopSpeed);
    ELSE
        IF ( 
$TopSpeed $OldTopSpeed)
        
THEN
            privMsg 
langEngine "%{main_st_faster}%" $TrapTextToPlayerUnit($TopSpeed ), ToPlayerUnit($TopSpeed $OldTopSpeed), $currPly["UnitSpeed"] ) );
            
SetUserStoredNum $StoredVarName$TopSpeed);
        ELSE
            
privMsg langEngine "%{main_st_slower}%" $TrapTextToPlayerUnit($TopSpeed), ToPlayerUnit($OldTopSpeed $TopSpeed), $currPly["UnitSpeed"]  ) );
        ENDIF
    ENDIF
EndSub

Sub StMidCorner1
$userName )
    
DoSpeedTrap"MC""Mid-Corner speed");
EndSub

Sub StCornerExit1
$userName )
    
DoSpeedTrap"CE""Corner Exit speed");
EndSub

Sub SpeedTrap1
$userName )
    
DoSpeedTrap"RT""Radar Trap speed");
EndSub

Sub SpeedTrap2
$userName )
    
DoSpeedTrap"RT""Radar Trap speed");
EndSub

Sub SpeedTrap3
$userName )
    
DoSpeedTrap"RT""Radar Trap speed");
EndSub

Sub SpeedTrap4
$userName )
    
DoSpeedTrap"RT""Radar Trap speed");
EndSub

Sub SpeedTrap5
$userName )
    
DoSpeedTrap"RT""Radar Trap speed");
EndSub

Sub SpeedTrap6
$userName )
    
DoSpeedTrap"RT""Radar Trap speed");
EndSub

Lang 
"EN"
    
main_st_faster "{0}: {1} {3} (^2+{2}^0)";
    
main_st_slower "{0}: {1} {3} (^1-{2}^0)";
    
main_st_none  "{0}: {1} {2}";
EndLang

?>


You should make this a proper lapper add-on now, with it's own thread.

Probably have to make it so there's about 6 of each type of $TrapType, e.g.

<?php 
Sub StMidCorner1
$userName )
    
DoSpeedTrap"MC""Mid-Corner speed");
EndSub

Sub StMidCorner2
$userName )
    
DoSpeedTrap"MC""Mid-Corner speed");
EndSub

etc
?>


That way, if anyone wants to make a note of the nodes for any of the tracks, they can add them in a post to the thread.

EDIT
And a reminder they need the latest version of lapper (v6.012) or $currPly will throw up an error.

EDIT2
And you need to change the lang files a bit otherwise the end bracket is wrong colour.
From
main_st_faster = "{0}: {1} {3} (^2+{2}^0)";
main_st_slower = "{0}: {1} {3} (^1-{2}^0)";
main_st_none = "{0}: {1} {2}";
To
main_st_faster = "{0}: {1} {3} (^2+{2}^8)";
main_st_slower = "{0}: {1} {3} (^1-{2}^8)";
main_st_none = "{0}: {1} {2}";

EDIT3
Playing about, and done a panel for it - better than putting it in my hud - see attached, which is really only configured for AS1R. For the longer tracks, may need more nodes for corners and corner exits
Attached files
radartrap.zip - 2.2 KB - 333 views
I have just moved over to a new server but the 1st one worked fine but now it is just saying "LFSLapper is in Stand By State"
Sounds like you might have an error in your lfslapper.lpr or one of the add-on .lpr files.

Check you error log file in the /defaults/logs folder - will have your server ip address as first part of file name, followed by -ERR.log (e.g. 127.0.0.1-29999-ERR.log).

Should say which file has the error in it, and what line to look for.

Error is not always on line it says - it could easily be the line before if you're missing a semi-colon ( or something.
15/02/2010 21:18:37 -> Not a connexion packet! Close connection

That's It
I think you're looking in wrong logs folder.

In my directory where the LFSLapper.exe file resides, I have couple of folders - one is default, and other is logs.

You need to go into the default folder, which will likely have an includes and a log folder.

The log folder you can see here is the one you need to look in.

The wrong log folder has file name LFSLapper-ERR.log, whereas correct folder will have ip numbers then ERR.log.
No ERR files only MSS ones
Then the only thing I can suggest is that you re-install the whole of lapper again, and, without changing anything, see if it will work.
Ok i will try this soon thanks for allof you help

EDIT: Not worked I think it's the server not lfslapper but I will just run it when I need it
Welcome,

Would anyone know how to do that on the show openPrivButton speed?


This should be something like this but to act.
main_speed = "^7{0} {1}";

openPrivButton( "speed",1,118,27,4,4,-1,32,langEngine( "%{main_speed}%" , ToPlayerUnit( GetCurrentPlayerVar( "InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed") ) );

How to make tables Baltic characters?
As ^B does not always work.
-
(LFSCruise) DELETED by LFSCruise
hello
I wonder how I can do to delay an order

after the message

Event OnConnect( $userName ) # Player event
$NickName = GetCurrentPlayerVar("NickName");
$Posabs = GetCurrentPlayerVar("PosAbs");
$Groupqual = GetCurrentPlayerVar("GroupQual");

IF ( GetUserStoredNum("MemberType") >= $MEMBERTYPE_AFFILIATE )
THEN
LoginMember($userName);
ELSE
openPrivButton( "welc",25,50,150,15,12,-1,ISB_undesirableNE, langEngine("%{main_welc1}%", $NickName ) );
openPrivButton( "pos",25,80,150,10,8,-1,ISB_undesirableNE,langEngine("%{main_welc2}%",$Posabs,$Posqual,$Groupqual ) );
openPrivButton( "clos",78,120,20,10,10,-1,ISB_DARK,langEngine("%{main_accept}%"),OnConnectClose );
openPrivButton( "ref",103,120,20,10,10,-1,ISB_DARK,langEngine("%{main_deny}%"),OnConnectCloseKick );
ENDIF

IF ( GetUserStoredNum("MemberType") >= $MEMBERTYPE_undesirable )

THEN
globalMsg ($NickName . "^8, ^1 you are a driver undesirable");
privMsg ("^8, ^1was undesirableished to be explained on the forum!");
privMsg ("^8, ^1reminder of the rules!");
privMsg ("^8, ^1undesirable accident at high speed");
privMsg ("^8, ^1undesirable voluntary accident");
privMsg ("^8, ^1undesirablet insult");
privMsg ("^8, ^1respect the rules of courtesy");
privMsg ("^8, ^2www.layoutracingteam.com");

ENDIF
EndEvent


thank you to the developers GUI-admin-membreship

thank you all
Attached files
gui_admin_membership.lpr.txt - 10 KB - 368 views
If you're talking about running a function after the user logins, then use the privDelayedCommand after the last ENDIF, but before the EndEvent:


<?php 
    
ENDIF
        
privdelayedcommand4MyDelayedFunc);
EndEvent

Sub MyDelayedFunc
$userName )
...
EndSub
?>


ok

thx
good evening
I have a problem now

when I log m it displays as I want his face on a group that has

j did like her

Event OnConnect( $userName ) # Player event
$NickName = GetCurrentPlayerVar("NickName");
$Posabs = GetCurrentPlayerVar("PosAbs");
$Groupqual = GetCurrentPlayerVar("GroupQual");

IF ( GetUserStoredNum("MemberType") >= $MEMBERTYPE_AFFILIATE )
THEN
LoginMember($userName);
ELSE
openPrivButton( "welc",25,50,150,15,12,-1,ISB_undesirableNE, langEngine("%{main_welc1}%", $NickName ) );
openPrivButton( "pos",25,80,150,10,8,-1,ISB_undesirableNE,langEngine("%{main_welc2}%",$Posabs,$Posqual,$Groupqual ) );
openPrivButton( "clos",78,120,20,10,10,-1,ISB_DARK,langEngine("%{main_accept}%"),OnConnectClose );
openPrivButton( "ref",103,120,20,10,10,-1,ISB_DARK,langEngine("%{main_deny}%"),OnConnectCloseKick );
ENDIF

IF ( GetUserStoredNum("MemberType") >= $MEMBERTYPE_undesirable )

THEN
globalMsg ($NickName . "^8, ^1 you are a driver undesirable");
privMsg ("^8, ^1was undesirableished to be explained on the forum!");
privMsg ("^8, ^1reminder of the rules!");
privMsg ("^8, ^1undesirable accident at high speed");
privMsg ("^8, ^1undesirable voluntary accident");
privMsg ("^8, ^1undesirablet insult");
privMsg ("^8, ^1respect the rules of courtesy");
privMsg ("^8, ^2www.layoutracingteam.com");

ENDIF
privdelayedcommand( 10, messundesirable);
EndEvent

Sub messundesirable( $userName )
privMsg ("message 1");
privMsg ("message 2");
privMsg ("message 3");
privMsg ("message 4");


EndSub


how to make the group just junk is concerned?

thx
Is it possible to do that speed on display openPrivButton?
But there is a radar I do not need me to be only one openPrivButton and that he would show the speed.

Or do so that the COP could build the radar and if anyone out it recorded radar overpass it.

I think something could come up.
How do the show with a table of window all currently connected players NickName?

Maybe it should be something related to:
GetListOfPlayers ()
If LFSLapper reads:
GetCurrentPlayerVar("IP") or GetCurrentPlayerVar("IPAddress") commands?

Why a file is read only Cruise.lpr Baltic characters? Why not other ^B?
Hi, i'm running Lapper 6.0.1.2 since 3-4 days ago on a demo server XFG+XRG. On !top and !near command it's showing only XFG status... how can i config. it to show stats for both cars ?
Thank you in advance and sorry for my bad english!
Quote from Robert_RO :Hi, i'm running Lapper 6.0.1.2 since 3-4 days ago on a demo server XFG+XRG. On !top and !near command it's showing only XFG status... how can i config. it to show stats for both cars ?
Thank you in advance and sorry for my bad english!

$DefaultTopCar = "XFG+XRG";
This thread is closed

Config help
(1112 posts, closed, started )
FGED GREDG RDFGDR GSFDG