<?php
const ISB_C1 1 // you can choose a standard
const ISB_C2 2 // interface colour using
const ISB_C4 4 // these 3 lowest bits - see below
const ISB_CLICK 8 // click this button to send IS_BTC
const ISB_LIGHT 16 // light button
const ISB_DARK 32 // dark button
const ISB_LEFT 64 // align text to left
const ISB_RIGHT 128 // align text to rightconst
openPrivButton ("player_".$userName."_".$id."_remove",$topleft_x+6,$topleft_y+1,
25,5,5,-1,ISB_LEFT | ISB_LIGHT,"Remove",Remove_Registered)
more clear than
openPrivButton ("player_".$userName."_".$id."_remove",$topleft_x+6,$topleft_y+1,
25,5,5,-1,80,"Remove",Remove_Registered)
?>
<?php
...
openPrivButton ("player_".$userName."_".$id."_remove",$topleft_x+6,$topleft_y+1,25,5,5,-1,80,"Remove",Remove_Registered)
...
Sub Remove_Registered( $KeyFlags,$receiveId )
IF ($receiveId != "")
THEN
$ar = SplitTOArray( $receiveId ,"_" );
privMsg("DEBUG: uName = " . $ar[1] . "; id = " . $ar[2]);
ENDIF
EndSub
?>
Sub TRI_split1_0( $userName ) # Player event
globalMsg( langEngine( "%{main_great1}%", NumToMSH(GetCurrentPlayerVar("SplitTime")),GetCurrentPlayerVar("Nickname") ) );
EndSub
Sub TRI_split1_1( $userName ) # Player event
globalMsg( langEngine( "%{main_good1}%",NumToMSH(GetCurrentPlayerVar("SplitTime")),GetCurrentPlayerVar("Nickname") ) );
EndSub
Sub TRI_split2_0( $userName ) # Player event
globalMsg( langEngine( "%{main_great2}%", NumToMSH(GetCurrentPlayerVar("SplitTime")),GetCurrentPlayerVar("Nickname") ) );
EndSub
Sub TRI_split2_1( $userName ) # Player event
globalMsg( langEngine( "%{main_good2}%",NumToMSH(GetCurrentPlayerVar("SplitTime")),GetCurrentPlayerVar("Nickname") ) );
EndSub
Sub TRI_split3_0( $userName ) # Player event
globalMsg( langEngine( "%{main_great3}%", NumToMSH(GetCurrentPlayerVar("SplitTime")),GetCurrentPlayerVar("Nickname") ) );
EndSub
Sub TRI_split3_1( $userName ) # Player event
globalMsg( langEngine( "%{main_good3}%",NumToMSH(GetCurrentPlayerVar("SplitTime")),GetCurrentPlayerVar("Nickname") ) );
EndSub
Sub TRI_lap_0( $userName ) # Player event
globalMsg( langEngine( "%{main_greatlap}%",NumToMSH( GetCurrentPlayerVar("LapTime") ), GetCurrentPlayerVar("Nickname" ) ) );
EndSub
Sub TRI_lap_1( $userName ) # Player event
globalMsg( langEngine( "%{main_goodlap}%", NumToMSH( GetCurrentPlayerVar("LapTime") ), GetCurrentPlayerVar("Nickname") ) );
EndSub
+-------------------------------+
|Changes from v5.852 to 5.901 |
+-------------------------------+
1. GetListOfPlayer accept an optional argument to sort the list og player
Example:
$list = GetListOfPlayers("U"); # List sorted by userName
Or
$list = GetListOfPlayers("N"); # List sorted by nickName
2. Fix groupCmdLfs( cmd ); order in other serv
3. Add GLScript command reload() to stop lapper and reload config
4. CatchEvent eventName structure
Add new structure feature, it's offer the ability to define code in this struct
and catch an existing event located in the main lpr file. LFSLapper execute code located
in event then jump to code located in one or more catchEvent. it's very usefull for creating
script without modify the original lpr file.
To add a new functionality to lapper just add include(newScript) at the end
of lpr file and to remove put a # before the include.
newScript must use this CatchEvent.
CatchEvent eventName
...
EndCatchEvent
Example:
CatchEvent OnConnect( $userName )
WriteLine( "OnConnect appended");
EndCatchEvent
Before Event OnConnect( $userName ) is executed then execute code
located into one or more CatchEvent OnConnect( $userName )
5. CatchSub subName --> Same as CatchEvent but for sub
Add new structure feature, it's offer the ability to define code in this struct
and catch an existing sub located in the main lpr file. LFSLapper execute code located
in sub then jump to code located in one or more catchSub. it's very usefull for creating
script without modify the original lpr file.
To add a new functionality to lapper just add include(newScript) at the end
of lpr file and to remove put a # before the include.
newScript must use this CatchSub.
CatchSub mySub
...
EndCatchSub
Example:
CatchSub MySub( )
WriteLine( "MySub appended");
EndCatchSub
Before Sub MySub( ) is executed then execute code
located into one or more CatchSub MySub( )
6. Add userName in args passed to event player
OnMSO,OnAuthAllowed,OnAuthNotAllowed,OnAuthReached,OnSwearWords1
OnSwearWords2,OnToLowHandicap,OnNotMatchFlags,OnConnect,OnDisConnect
OnSplit1,OnSplit2,OnSplit3,OnLap,OnSpbSplit1,OnSpbSplit2,OnSpbSplit3
OnSpbLast,OnFlood,OnMaxSessionLaps,OnAngleVelocity,OnMaxNbInStunt
OnMaxAllowedLapTime1,OnMaxAllowedLapTime2,OnIdle1,OnIdle2,OnDriftPB
OnDriftLap,OnDriftScore,OnPB,OnPBQual,OnAcceleration,OnBeginPit
OnEndPit,OnPit,OnNotPitWindow,OnBeginPitWindow,OnEndPitWindow
OnFastDriveOnPitL1,OnFastDriveOnPitL2,OnMaxFastDriveOnPit,OnFalseStartL1
OnFalseStartL2,OnLeaveRace,OnDriftTooLow,OnGoodDrift,OnNewGapPlayerBehind
OnNewGapPlayerBefore,OnNewPlayerJoin,OnChangeTyres,OnFinish,OnResult
OnCarReset,OnMaxCarResets,OnExitPitLane,OnEnterPitLane,OnNameChange
7. Patch to allow storing data as another user. I.e: ( krayy )
SetUserStoredValue( "hmass", GetPlayerVar($uName,"h_mass"));
OR
SetUserStoredValue( $uName, "hmass", GetPlayerVar($uName,"h_mass"));
GetUserStoredValue( "hmass" );
OR
GetUserStoredValue( $uName, "hmass" );
8. Fix SQL error when userName have a single-quote (') in it in PB, Drift and stored
9. Add new GLScript function SplitToArray, this function allow splitting a string by a split char and put result into array
Example:
$tosplited = "Un,Deux,Trois,Quatre";
$splites = SplitToArray( $tosplited,"," );
WriteLine( "The result for pos 2 is " . splites[1] );
FOREACH( $val IN $splites)
WriteLine( "Val = " . $val["value"]);
ENDFOREACH
Result on Screen
The result for pos 2 is Deux
Val = Un
Val = Deux
Val = Trois
Val = Quatre
$allowed = 1;
$userName = "gai-luron";
doMyCode( $userName,$allowed );
doMyCode( "gai-luron",1 );
SUB doMyCode( $userName,$allowed )
... Do what you want if lpr file
IF( $allowed == 0 ) THEN
cmdlfs( "/kick " . $userName );
ELSE
privMsg("Allowed");
ENDIF
ENDSUB
privMsg("Allowed");
cmdlfs( "/kick gai-luron");
<?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
?>
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
?>
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%
<?php
$NickName = GetPlayerVar($UserName, "NickName");
$NickStrip = StripLFSColor( ToLower($NickName) );
$IdxOfTag = indexOf( $NickStrip , "[LFS]");
IF( $IdxOfTag != -1 ) #Check if the user has a tag on with [LFS]
THEN
WriteLine(GetPlayerVar($UserName, "NickName")." has a [LFS] tag");
ENDIF
?>
<?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
########################################################
?>
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.
-Set the Serveradminpass: $password = "YourAdminPassHere";
-Save the file.
-Enter the usernames, who may have adminrights to LFSLapper
-Save the files.