The online racing simulator
HowTo!
(16 posts, started )
HowTo!
Hello, because somes persons are better than me in using LFSLapper ( yes, yes, i'am a dev man not a parameter man :razzSmile i need your help for writing a HowTo for LFSLapper. I think this howto must contain somes sections like ( not complete, if you have another ideas ).If you have time to write a part of one or more sections, this will be a very good thing for all the community. Put you reply here, i update the correct post in this HowTo as soon i receive your contribution.

Thank's

Gai-Luron
Quick Start Guide (Install/Start LFSLapper)
  • [1]-Download the latest version of LFSLapper: DOWNLOAD
  • [2]-Place the LFSLapper directory somewhere you can find it easily.
  • [3]-Open 'LFSServers.cfg' (LFSLapper directory/Bin/LFSServers.cfg) and go the next line that like similar like this.

DEF1|gr1|127.0.0.1|29999|./default|default_1.ini|autowork
#Unique ID|GroupId|IP|InsimPort|WorkDir|IniFile|autowork

-Set IP Adres of the computer were LFSLapper is running on.
-Set Insimport . Default insimport = 29999. This could be differend, if you bought a server.
-Save the file.

  • [4]-Open default_1.ini (LFSLapper directory/Bin/default/default.ini)
    -Set the Serveradminpass: $password = "YourAdminPassHere";
    -Save the file.


  • [5]-Open superusers.txt and admin.txt in default folder (LFSLapper directory/Bin/default)

    -Enter the usernames, who may have adminrights to LFSLapper
    -Save the files.


  • [6]Start LFSLapper by clicking on LFSLapper.exe in the 'Bin' Folder.
  • [7]Have fun
Configuring multiple LFS server on one LFSLapper
Basic LFSLapper configuration. lpr file
LFSLapper Functions
  • -getplayerinfo();
  • -openprivbutton();
  • -closeprivbutton();
    openbutton();
    closebutton();
    setracegrid();
    requestreo();
    getlistofplayers();
    setplayervar();
    getplayervar();
    getplayervarbyucid();
    getplayervarbyplid();
    getlappervar();
    getconfigvar();
    setconfigvar();

    #Converting
    numtomsh();
    numtoms();
    mshtonum();
    tokph();
    tomph();
  • -toupper()

    $string = "example";
    $example = toupper($string); $example = "EXAMPLE";


  • -tolower()

    $string = "EXAMPLE";
    $example = tolower($string); $example = "example";


    toplayerunit();
    langtranslate();
    langengine();
    forcerotation();
    termlapper();
    groupcmdlfs();
    cmdlfs();
    setlicense();
    setcurrentplayervar();
    getcurrentplayervar();

    closetop();
    closedrf();
    closetopuser();

    #Sending messages
    privmsg();
    globalmsg();


    cleanspb();
    showspb();
    showhand();
    lapperversion();
    stats();
    dstats();
    statsqual();
    dstatsqual();
    topuser();
    nearuser();
    currentplayerlfsworldpb();
    currentplayerlfsworldpbfrom();

    top();
    near();
    topqual();
    nearqual();

    getlisttop();
    drf();
    drfqual();
    drfnearqual();
    drfnear();
    privrcm();


    #Buttons
    textprivbutton( "ButtonID","TEXT OF BUTTON" );
    textprivbuttonall();
    openprivtextbutton();
    opentextbutton();

    #Delayed commands
    removeprivdelayedcommand();
    privdelayedcommand();
    removehostdelayedcommand();
    hostdelayedcommand();


    myconfig();
    setuserstoredvalue();
    setuserstorednum();
    getuserstoredvalue();
    getuserstorednum();
    openglobalbutton();
    globalrcm();
    closeglobalbutton();
    http();
    moveusertogroup();
    getlistofusersgroup();
    usergroupfromfile();
    usergrouptofile();
    removeuserfromgroup();
    cleargroup();
    userisadmin();
    userisserveradmin();
    useringroup();
    getusergrippb();
    getuserdriftpb();
    setstoredvalue();
    getstoredvalue();
    getstorednum();
    removedelayedcommand();
    delayedcommand();
    getlongtrackname();
    getlengthtrack();
    getgrouptrack();
    getexttrack();
    registerscheduleaction();
    removescheduleaction();
    registernodeaction();
    removenodeaction();
    registerzoneaction();
    removezoneaction();
    reload();
    crash();
    getlistoflang();
    getlistofplayerbuttons();
    striplfscolor();
    getwr();
    startlightcontrol();
    joinrequest();
    allowedplayercars();
  • -substr()

    $string = "example";
    $example = substr( $string,0,3 ); #Start at the begining ( 0) and give the next 3 characters $example = "exa";
    $example = substr( $string,4,2 ); #Start the the 4e character and give the next 2 characters $example = "pl";

  • -trim()

    $string = "example";
    $example = trim( subStr( $string,2 ) ); #Remove the first part of a string to the 2nd character $example = "ample";

  • -round() #Round Numbers

    round( 12.34,1 ) -> 12.3


  • -strformat()

    Add new GLScript function
    strFormat( formatStr,arg1,..,argn );
    example:
    strFormat( "The player {0}, there is actually {1} players on track", GetCurrentPlayerVar("nickName"), GetLapperVar( "nbPlayersOnTrack" ) )

    This function is a very powerfull fonction to format text
    The following table lists format controls supported by the C# String.Format() method together with examples of each control:
    Control Type Description Example
    • C Currency
      Displays number prefixed with the currency simple appropriate to the current locale
      {0:C} of 432.00 outputs $432.00
    • D Decimal
      Displays number in decimal form with optional padding
      {0:D4} of 432 outputs 00432
    • E Exponential
      Displays number in scientific form with optional value for fractional part
      {0:E5} of 432.32 outputs 4.32320E+002
    • E Fixed
      Displays the number including the specified number of decimal digits
      {0:F3} of 432.324343 outputs 432.324
    • N Number
      Converts a number to a human friendly format by inserting commas and rounding to the nearest 100th
      {0:N} 123432.324343 outputs 123,432.32
    • X Hexadecimal
      Converts a number to hexadecimal
      {0: X} of 432 outputs 1B0
      0:0... Zero Padding
      Adds zeros to pad argument
      {0:0000.00} of 43.1 outputs 0043.10
      0:0#... Space Padding
      Adds spaces to pad argument
      {0:####.##} of 43.1 outputs 43.1
    • % Percentage
      Multiplies the argument by 100 and appends a percentage sign
      {0:00.00%} of .432 outputs 43.20%


  • -tostring() #Convert Var to a string
  • -tonum() #Convert Var to a number


  • -not()
  • -indexof()

    <?php 
     
         $NickName 
    GetPlayerVar($UserName"NickName");    
         
    $NickStrip StripLFSColorToLower($NickName) );     
         
    $IdxOfTag indexOf$NickStrip "[LFS]");
        
         IF( 
    $IdxOfTag != -)    #Check if the user has a tag on with [LFS]
         
    THEN    
            WriteLine
    (GetPlayerVar($UserName"NickName")." has a [LFS] tag");  
         ENDIF  
    ?>

  • -splittoarray()


    <?php 
                $tobesplit 
    "one,two,three";
                
    $splits SplitToArray(  $tobesplit,"," ); 
                
    ########################################################

                //Result on screen with a single line

                    
    WriteLine"The result for pos 1 is " $splits[1] ); #Displayed "one" in command window
                    
    WriteLine"The result for pos 2 is " $splits[2] ); #Displayed "two" in command window
                    
    WriteLine"The result for pos 3 is " $splits[3] ); #Displayed "three" in command window
                ########################################################
                ########################################################

                //Display results with a FOREACH loop
                
                
    FOREACH( $val IN $splits)
                        
    WriteLine"Pos = " $val["value"]);
                ENDFOREACH
                
                
    #Result on screen
                
    Pos =  one
                Pos 
    =  two
                Pos 
    =  Three
                
    ########################################################
                ########################################################

                //Display results with a FOREACH loop
                
                
    $i 1;    
                WHILE(
    $i 4)
                    
    WriteLine"Pos ".$i."=" $splits[$i]);
                    
    $i=$i+1#Count up
                
    ENDWHILE

                    
    Results that will be displayed in Command window
                    Pos 1 
    one
                    Pos 2 
    two
                    Pos 3 
    Three
                
    ########################################################
                ########################################################

                //Display results with a FOR loop
                
                
    FOR($i=1;$i<4;$i=$i+1)
                    
    WriteLine"Pos ".$i."=" $splits[$i]);
                ENDFOR

                    
    Results that will be displayed in Command window
                    Pos 1 
    one
                    Pos 2 
    two
                    Pos 3 
    Three
                
    ########################################################
    ?>

  • -split()
  • -unset()
  • -return()

  • -write()

  • -writeline()

  • -strlen()

    $string = "example";
    $example = StrLen( $string ); #Gives the lenght of a string $example = 7;



  • -dumpvar()
  • -arraycount()
  • -randomnum()
  • -isregexmatch()
  • -sqrt()
  • -mod()

  • -isnum() #check if value is a number
    #check if value is a number
    IF ( IsNum($var) == TRUE ) THEN
    ENDIF

(Catch)Events overview
These events can you use in your scripts.
Every eevent will be closed with EndEvent

If you use the same Event in a another script you have to write CatchEvent/EndCatch event

CatchEvent <Eventname>
EndCatchEvent


<?php 
Event OnAcceleration
$userName );  #Acceleration from 0 to 100
Event OnAcceleration2$userName ); #Acceleration from 100 to 160
Event OnAngleVelocity$userName ); #Driftangle for example
Event OnAuthAllowed$userName );
Event OnAuthNotAllowed$userName );
Event OnAuthReached$userName,$level );
Event OnBeginPit$userName );
Event OnBeginPitWindow$userName );
Event OnButtonFunction($userName$SubT);
Event OnCarReset$userName ); #User Reset Car
Event OnChangePos($userName$lastPos$currPos);
Event OnChangeTyres$userName$FL_Changed$FR_Changed$RL_Changed$RR_Changed );
Event OnConnect$userName ); #User Connect to server
Event OnDisConnect$userName$reason ); #User Disconnect from server
Event OnDistDone$userName );
Event OnDriftLap$userName );
Event OnDriftPB$userName );
Event OnDriftResetScore$userName );
Event OnDriftScore$userName );
Event OnDriftTooLow$userName );
Event OnEndPit$userName );
Event OnEndPitWindow$userName );
Event OnEnterPitLane$userName$reason );
Event OnExitPitLane(  $userName );
Event OnFalseStartL1$userName );
Event OnFalseStartL2$userName );
Event OnFastDriveOnPitL1$userName );
Event OnFastDriveOnPitL2$userName );
Event OnFinish$userName );
Event OnFlood$userName );
Event OnGoodDrift$userName );
Event OnIdle1$userName );
Event OnIdle2$userName );
Event OnLap$userName );
Event OnLapperStart();
Event OnLeaveRace$userName );
Event OnMaxAllowedLapTime1$userName );
Event OnMaxAllowedLapTime2$userName );
Event OnMaxCarResets$userName );
Event OnMaxFastDriveOnPit$userName );
Event OnMaxNbInStunt$userName );
Event OnMaxSessionLaps$userName );
Event OnMSO$userName$text );
Event OnNameChange($userName$oldNickName$newNickName);
Event OnNewGapPlayerBefore$userName$split );
Event OnNewGapPlayerBehind$userName$split );
Event OnNewPlayerJoin$userName );
Event OnNotMatchFlags$userName );
Event OnNotPitWindow$userName );
Event OnPB$userName );
Event OnPBQual$userName );
Event OnPit$userName );
Event OnPracStart$numP );
Event OnQualStart$NumP );
Event OnRaceEnd( );
Event OnRaceStart$NumP );
Event OnREO $NumP$ReqI$GridOrder );
Event OnResult$userName,$flagConfirm );
Event OnRotateCar();
Event OnRotateTrack();
Event OnSpbLast$userName );
Event OnSpbSplit1$userName );
Event OnSpbSplit2$userName );
Event OnSpbSplit3$userName );
Event OnSplit1$userName );
Event OnSplit2$userName );
Event OnSplit3$userName );
Event OnSwearWords1$userName );
Event OnSwearWords2$userName );
Event OnToLowHandicap$userName );
Event OnVoteEndChange($PlayerOnTrack$Vote$Need);
Event OnVoteEndReach($PlayerOnTrack$Vote$Need);
Event OnVoteEndZero();
Event OnVoteQualifyChange($PlayerOnTrack$Vote$Need);
Event OnVoteQualifyReach($PlayerOnTrack$Vote$Need);
Event OnVoteQualifyZero();
Event OnVoteRestartChange($PlayerOnTrack$Vote$Need);
Event OnVoteRestartReach($PlayerOnTrack$Vote$Need);
Event OnVoteRestartZero();
Event OnObjectHit($userName,$ObjectFlag,$ObjectHitTime,$Object_X,$Object_Y,$Object_Z,$ObjectType,$ObjectInDex); #When User hit an opject
Event OnCarContact($PlayerA,$PlayerB,$PlayerA_Speed,$PlayerB_Speed,$PlayerA_X,$PlayerB_X,$PlayerA_Y,$PlayerB_Y); #Collision between 2 drivers
Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex);
Event OnCarStateChanged($userName,$StateOfCar#User cars state changed
?>

Player Variables in LFSLapper

This can be retreived with function:
GetCurrentPlayerVar( idOfVar )
GetPlayerVar( username, idOfVar )
or
$currPly = getplayerinfo($userName );
$currPly[ idOfVar ];


<?php 
 NickName
,               // nickName of the player
            
NickNameStripped,       // nickName without color code
            
UserName,               // User Name or LFS Name
            
Car,                    // CUrrent car for the player
            
PitWork,                // Work do on car on the pit
            
PlayerFlags,            // Current players control flags
            
PosAbs,                 // Current pos in top in format pos/total
            
GroupQual,              // Current Group qualification if user is in the group qualification -> A,B,C,...
            
PosQual,                // Current pos in qualification in format pos/total
            
UnitSpeed,              // km/h or mph relative t o the player choice
            
UnitDist,               // miles or kms relative t o the player choice
            
Typ,                    // Spb type "PB" server, "Sess" Session, "WR" Worls record
            
Dist,                   // dist for the player in km on this server
            
SessDist,               // dist for the player in km on this session
            
UNameBehind,            // UserName of the player behind you in race
            
GapBehind,              // Gap between you and player behin in Race
            
UnameBefore,            // the username of the player before you in race
            
GapBefore,              // gap between you and the player before you in race
            
OldTyreRearLeft,        // Old Tyre on rear left before pit
            
OldTyreRearRight,       // Old Tyre on rear right before pit
            
OldTyreFrontLeft,       // Old Tyre on front left before pit
            
OldTyreFrontRight,      // Old Tyre on front right before pit
            
TyreRearLeft,           // Current Tyre on rear left
            
TyreRearRight,          // Current Tyre on rear right
            
TyreFrontLeft,          // Current Tyre on front left
            
TyreFrontRight,         // Current Tyre on front right
            
AuthLevel,              // Player authorization level
            
PenaltyNew,             // Player penalty new
            
NumCarResets,           // Number of Car reset
            
Laps,                   // Total number of laps done on the current track and with the current car
            
Pos,                    // current position of the player in top
            
SessLaps,               // Total number of laps done this session on current track and with the current car
            
TotalPitTime,           // Cumuled Time used for a pit stop on session
            
PitTime,                // Time used in Pit
            
PitStops,               // Number of pitstop do by a player in session
            
SwearWordsRem,          // Remaining number of swearwords to be used before OnSwearWords2 is triggered
            
LapsDone,               // Total laps done for player current car/track
            
P_Mass,                 // Current player Mass
            
P_Tres,                 // Current Player  Restriction
            
H_Mass,                 // Current Required Handicap User mass
            
H_Tres,                 // Current Required Handicap Restriction
            
Split1,                 // Last First Split, updated when doing new Split1
            
Split2,                 // Last Second Split, erased when doing Split1
            
Split3,                 // Last third Split, erased when doing Split1
            
LapTime,                // Current Lap Time, erased when doing New LapTime
            
PBLapTime,              // Current PB on current Combo
        
PBDrift,                // Current Drift PB on current Combo
            
DiffLapTimeToPB,        // Laptime - PBLTime, Last PBLTime is new realised
            
SplitTime,              // Last Split time done by player
            
WR,                     // World record for this player Combo
        
PSDistance,            // online statistics of one racer - distance in metres
        
PSFuel,            // online statistics of one racer - fuel burnt in cl
        
PSLaps,            // online statistics of one racer - laps
        
PSHostsJoined,        // online statistics of one racer - hosts joined
        
PSWins,            // online statistics of one racer - Wins
        
PSSecond,            // online statistics of one racer - Second
        
PSThird,            // online statistics of one racer - third
        
PSFinished,            // online statistics of one racer - finished
        
PSQuals,            // online statistics of one racer - quals
        
PSPole,            // online statistics of one racer - pole
        
PSDrags,            // online statistics of one racer - drags
        
PSDragWins,            // online statistics of one racer - drag wins
        
PSCountry,            // online statistics of one racer - country
            
SectorSplit1,           // Last First sector Time, updated when doing new Split1
            
SectorSplit2,           // Last Second sector Time, updated when doing new Split2
            
SectorSplit3,           // Last third sector Time, updated when doing new Split3
            
SectorSplitLast,        // Last Last sector Time, erased when doing Split1
            
BestSectorSplit1,       // Best Split duration for the sector 1
            
BestSectorSplit2,       // Best Split duration for the sector 2
            
BestSectorSplit3,       // Best Split duration for the sector 3
            
BestSectorSplitLast,    // BestSplit duration for the last sector
            
DiffSectorSplit1,       // SectorSplit1 - BestSectorSplit1
            
DiffSectorSplit2,       // SectorSplit2 - BestSectorSplit2
            
DiffSectorSplit3,       // SectorSplit3 - BestSectorSplit3
            
DiffSectorSplitLast,    // SectorSplitLast - BestSectorSplitLast
            
IsBestSectorSplit1,     // 1 if this sector split is best than previous Best, otherwise 0
            
IsBestSectorSplit2,     // 1 if this sector split is best than previous Best, otherwise 0
            
IsBestSectorSplit3,     // 1 if this sector split is best than previous Best, otherwise 0
            
IsBestSectorSplitLast,  // 1 if this sector split is best than previous Best, otherwise 0
            
AvgSpeed,               // Avg Speed on last Lap Time
            
InstantSpeed,           // Instant speed for the player
            
BestSpeed,              // Best Speed done on this combo by player
            
Tpb,                    // Theoretical PB using best sector split
            
DriftScore,             // last Drift score
            
AngleVelocity,          // Last Angle velocity in degrees
            
LastDriftScore,         // Last drift score
            
AccelerationStartSpeed// Min value for the acceleration feature relative to user unit km or mph
            
AccelerationEndSpeed,   // Max value for the acceleration feature relative to user unit km or mph
            
AccelerationTime,       // Acceleration time achieved from start to end speed
            
AccelerationStartSpeed2// Min value for the acceleration feature relative to user unit km or mph
            
AccelerationEndSpeed2,   // Max value for the acceleration feature relative to user unit km or mph
            
AccelerationTime2,       // Acceleration time achieved from start to end speed
            
MaxAllowedLapTime1,     // Max Allowed Time before trigger Event OnMaxAllowedLapTime1
            
MaxAllowedLapTime2,     // Max Allowed Time before trigger Event OnMaxAllowedLapTime2
            
RemainFDIP,             // Remain count for fast drive in pit
            
FinishedPos,            // finish or qualify pos (1 = win / 256 = not added to table)
            
RaceTotalTime,          // race time (ms) the use of NumToMsh is needed
            
RacePBTime,             // race personnal best time in ms the use of NumToMsh is needed
            
CurrNode,               // is the node on the track where the player is, -1 is player is not on track
            
OnTrack,                // 1 if player is on track, otherwise 0
            
X,                      // Coordonate X axis of the player on the map
            
Y,                       // Coordonate Y axis of the player on the map
            
Z,                       // Coordonate Z axis of the player on the map
            
TotDistMeter,            // Session distance in meter done by a player
            
ViewSPBSplit,            // What split PB to Show, S = Session, P = PB, W = World record ( Can be SET )
            
ShowSplitPb,            // Does the split PB iare showed 1 = Yes, 0 = No  ( Can be SET )
            
UnitSpeedKmh,            // What's unit is used for speed and distance 1 = kms 0 = miles  ( Can be SET )
            
IdLang,                    // Id of the player lang  ( Can be SET )
            
Heading,                // Direction of forward axis : 0 = world y direction
            
Direction,                // Car's motion if Speed > 0 : 0 = world y direction
?>

Replacing Event or Multiple catching event
Multi Language management
Web connectivity

When you send a request to a web server LFSLapper attemps to receive a GLScript code and execute it.

Example
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");

Gai-Luron

PS: You can put any GLScript command in returned web, like top(), topuser(), etc...
Upload Feature
Qualification feature
Reference language guide
Quote from Gai-Luron :Quick Start Guide (Install/Start LFSLapper)
  • [1]-Download the latest version of LFSLapper: DOWNLOAD
  • [2]-Place the LFSLapper directory somewhere you can find it easily.
  • [3]-Open 'LFSServers.cfg' (LFSLapper directory/Bin/LFSServers.cfg) and go the next line that like similar like this.

DEF1|gr1|127.0.0.1|29999|./default|default_1.ini|autowork
#Unique ID|GroupId|IP|InsimPort|WorkDir|IniFile|autowork

-Set IP Adres of the computer where LFSLapper is running on.
-Set Insimport . Default insimport = 29999. This could be differend if you bought a server.
-Save the file.

  • [4]-Open default_1.ini (LFSLapper directory/Bin/default/default.ini)
    -Set the Serveradminpass: $password = "YourAdminPassHere";
    -Save the file.


  • [5]-Open superusers.txt and admin.txt in default folder (LFSLapper directory/Bin/default)

    -Enter the usernames who may have adminrights to LFSLapper
    -Save the files.


  • [6]Click on LFSLapper.exe in the 'Bin' Folder.
  • [7]Have fun

How can i do this if ive brought my server of lfs themselves?
Quote from zero87945 :How can i do this if ive brought my server of lfs themselves?

It is not possible.
I have difficulty downloading the LFSLapper, I couldn't proceed. Can you suggest what's the problem? I love to hear your reply.

Link removed

HowTo!
(16 posts, started )
FGED GREDG RDFGDR GSFDG