The online racing simulator
Release: LFSLapper V7.0.4.10


Hello Lapperusers,

After some weird bug reports and checking the sourcecode, i couldnt explain were those bugs came from.
So i rebuild the new version from the working 7.0.4.8 version.

For the one who downloaded 7.0.4.9, i highly recommend to upgrade to V7.0.4.10

NOTE: Its not the same as V7.0.4.9

EDIT: official version available

See the summery of changes below.


+--------------------------------+
|Changes from 7.0.4.8 to 7.0.4.10| #7.0.4.9 is skipped, caused by a big sourcecode bug
+--------------------------------+
-New Lappervars added
-New Events/InsimPackets added : OnPlayerFlags , OnAdminCommandReport
=================================================
New:
=================================================
01: New lappervars added: (retrieve values from LFS)

mustpit //MustPit is enabled on the server ( Returns 0 or 1)
canvote //Guest may vote kick/ban ( Returns 0 or 1)
canselect //Guest may select track/car ( Returns 0 or 1)
canreset //Guest may reset theire car ( Returns 0 or 1)
midracejoin //Guest may join during a race ( Returns 0 or 1)
cruise //Guest is allowed to drive the wrong way (Returns 0 or 1)
forcedcockpitview //Forced cockpitview ( Returns 0 or 1)
nbofcheckpoints //Number of checkpoints ( Returns 0, 1, 2 or 3) Also works on layouts (Insim checkpoints doesnt count)
timing //Type of Timing:
-Returns 0 : Open config without use checkpoints
-Returns 1 : Normal laptiming ( normal circuit)
-Returns 2 : Custom/AutoX laptiming ( userplaced checkpoints/finishline)
lapperversion //Returns only the lapperversion
lfsversion //Returns version of lfsserver. currently 0.6R
lfsmode //Returns mode of LFSServer (Demo/S1/S2/S3)

02: New Event: OnPlayerFlags (Detects Yellow/Blue flags and Lag/Missing packets)

##########################################################################################
#Action on Event when player receives a Flag (Yellow/Blue flags and Lag/Missing packets).
##########################################################################################
#The Flags below returns 1 or 0 depends on which flag is received by the user
#$YellowFlag: Player receives a YellowFlag
#$BlueFlag : Player recieves a BlueFlag
#$LagFlag : Player is lagging or is missing carpackets
#$Time : ShortTimeFormat,same as GetLapperVar("ShortTime");

##########################################################################################
$PlayerFlagEvent = -1; #Enable Event 1 = ON / -1 = OFF
Event OnPlayerFlags($userName,$YellowFlag,$BlueFlag,$LagFlag,$Time) # Player event
/*
IF( $YellowFlag == 1) THEN
privmsg("^3YELLOW FLAG");
ENDIF
IF( $BlueFlag == 1) THEN
privmsg("^4BLUE FLAG");
ENDIF
IF( $LagFlag == 1) THEN
privmsg("^5LAG");
ENDIF
*/
EndEvent

03: New Event: OnAdminCommandReport (Report admincommands)

######################################################
#Action on entering a admincommand ( "/ commands" )
######################################################
#$userName = username of the player who typed the admincommand.
#$IsAdmin = Is player a admin ( 0 = no admin / 1 = is an admin)
#$Status = Status of command ( 1 - processed / 2 - rejected / 3 - unknown command)
#$Command = Entered command by player
#$Time = Date/Time of action
######################################################

Event OnAdminCommandReport( $userName,$IsAdmin,$Status,$Command,$Time ) # Player event
#Yourcode
EndEvent

04: New Function: InArray(), Check if a value already exist in the current array.

#Array = $TESTARRAY[]
#Value = 7

IF( inarray($TESTARRAY,"7") == 1) THEN
privmsg("^2Does exist");
ELSE
privmsg("^1Does not exist");
ENDIF

05: New Function: Remove(), Remove chars from a string. Old way: Trim( SubStr ());

There are 2 ways to use the function

Remove amount of characters from the string from StartIndex
1 : $NewString = remove($OldString,$StartIndex,$Charstoremove)
or
Remove everything from StartIndex
2 : $NewString = remove($OldString,$StartIndex)

06: New event: OnHostMSO($Text,$Time) (Thanks to LakynVonLegendaus)

#Every messages by the host will be sent to this event.
#DO NOT USE GlobalMsg()!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Event OnHostMSO($Text,$Time)
#YourCode
EndEvent

07: New event: OnPlayerSelectCar($userName,$Car,$Time) # Player event

#This event will execute when a player select a car in the garage
Event OnPlayerSelectCar($userName,$Car,$Time)
#YourCode
EndEvent

08: New event: OnNewJoinRequest # Player event (Thanks to LakynVonLegendaus)

#######################################
#Player sends a join request (Shift+J)#
#######################################
NOTE:
#To enable OnNewJoinRequest event, $ReceiveJoinRequest has to be set to 1.
#If enabled, LFS waits (cca 1 second) for a response from the Lapper on each join request.
#To respond to a join request - use joinrequest() function.
#The Player's unique ID (PLID Must be 0 to use the join request system)
#If no response is sent, LFS spawns the car normally (with a delay [because LFS waits for the join request response]).
#For more info see ..\LFS\docs\InSim.txt

$ReceiveJoinRequest = -1; #Enable (1) or disable (-1) for Receive JoinRequest.

Event OnNewJoinRequest( $userName ) # Player event
/*
$Flags = 0; #Move car (128) else (0)
$X_Axis = 0; #X axis SpawnPoint
$Y_Axis = 0; #Y axis SpawnPoint
$Z_Axis = 0; #Z axis SpawnPoint
$Heading = 0; #Heading of the players car at Spawnpoint

$UCID = GetCurrentPlayerVar("UCID"); #Connection unique ID
$PLID = 0; #GetCurrentPlayerVar("PLID"); #Player's unique ID

###$PLID MUST BE 0 TO USE JOIN REQUEST###
#$JRRAction = 0; # Reject join request.
$JRRAction = 1; # Allow join request.

joinrequest($X_Axis ,$Y_Axis ,$Z_Axis ,$Flags ,$Heading ,$UCID ,$PLID ,$JRRAction); #Send Data to LFS
*/
EndEvent


=================================================
Updates:
=================================================

01: Changed hardcoded visible records in Toplist/UserTop/Drifttop from 24 to 10000

$list = GetListTop( getConfigVar( DefaultTopCar ), 0, 0 );
Note: Users must edit theire script to see the max visible Records. This can be done with a FOR loop: ( $i=0;$i<25;$i=$i+1)


=================================================
Fixes:
=================================================
01: Removed GLobalmsg(); in Layoutlist.LPR. Spammed the chat after paging up or down
02: Didnt retreive RaceInfo from LFS after rebooting Lapper

Attached images
laplogo_05_small.jpg
Attached files
LFSLapper V7.0.4.10.zip - 2.9 MB - 1627 views
Tested the most imported scripts I have/made and they are all working as intended.
Only thing I noticed is the file "LFSLapper.lpr" in the 'BIN' folder, that wasn't there in 7.0.4.8 and earlier but is there in the last versions (7.0.4.9 and 7.0.4.10), while there don't seem to be a need for that file there.
Thank you for testing and your report
New testversion available. Grab the version in the first post

New features added and 1 fix

Thanks to LakynVonLegendaus, Lapper supports now fully JoinRequest system.
See info below.

New event: OnNewJoinRequest # Player event (Thanks to LakynVonLegendaus)

#######################################
#Player sends a join request (Shift+J)#
#######################################
NOTE:
#To enable OnNewJoinRequest event, $ReceiveJoinRequest has to be set to 1.
#If enabled, LFS waits (cca 1 second) for a response from the Lapper on each join request.
#To respond to a join request - use joinrequest() function.
#The Player's unique ID (PLID Must be 0 to use the join request system)
#If no response is sent, LFS spawns the car normally (with a delay [because LFS waits for the join request response]).
#For more info see ..\LFS\docs\InSim.txt

$ReceiveJoinRequest = -1; #Enable (1) or disable (-1) for Receive JoinRequest.

Event OnNewJoinRequest( $userName ) # Player event
/*
$Flags = 0; #Move car (128) else (0)
$X_Axis = 0; #X axis SpawnPoint
$Y_Axis = 0; #Y axis SpawnPoint
$Z_Axis = 0; #Z axis SpawnPoint
$Heading = 0; #Heading of the players car at Spawnpoint

$UCID = GetCurrentPlayerVar("UCID"); #Connection unique ID
$PLID = 0; #GetCurrentPlayerVar("PLID"); #Player's unique ID

###$PLID MUST BE 0 TO USE JOIN REQUEST###
#$JRRAction = 0; # Reject join request.
$JRRAction = 1; # Allow join request.

joinrequest($X_Axis ,$Y_Axis ,$Z_Axis ,$Flags ,$Heading ,$UCID ,$PLID ,$JRRAction); #Send Data to LFS
*/
EndEvent

#New Lappervar:
-lapperversion //Returns the current version of LFSLapper.
(could be used to protect your script against older lapperversions).



I may have missed it, but was has been fixed? Smile
uhmm right. Nothing special. deleted a line from layoutlist.lpr
New PublicTest version is available:

Rebuilded this version again from 7.0.4.8 after some old features did not work properly.
Compiled multiple times and tested the .exe to be sure that the old and new events are working.

-Added some debug messages for GetListOfPlayers() in the console.
-Added 2 extra Lappervars : LFSVersion and LFSMode
-Added testversion/state of Lapper in Title of the console.

####### GetListOfPlayers() TEST############

If you have more than 11 players in the server, please make a screenshot of the Lapperconsole.

Also use this code to get the usernames of the current players in the server. And also make a screenshot of the results.

You can use this code in a command of sub or in the onconnect event

$Number = 1;
$Racers = GetListOfPlayers("U");
FOREACH( $Var IN $Racers ) #For each player in the server
privmsg("^3[".$Number."] ^7".$Var["value"]); #Current Number + UserName of Player
$Number = $Number + 1;
ENDFOREACH

Some feedback after testing whould be appreciated.

Thank you.
Version seems to work fine as far as I can tell by testing it with 1 player.
There's one odd thing, every time Lapper is started (doesn't make a difference if you start the EXE or do !reload), this event from my Pitboard is executed:


<?php 
Sub OnRaceStart_Pitboard
() # Lapper event
    
IF ($start_window_1 == "")
    
THEN
      cmdLFS
"/rcm ^3Clean racing and have fun :-)" );
    ELSE
      
cmdLFS"/rcm ^7Pitwindow is set to: ^2" $start_window_1 " ^7- ^1" $end_window_1 );
    ENDIF
    
cmdLFS"/rcm_all" );

    
$mList GetListOfPlayers("N");
    
$mCount arrayCount$mList );
    
$plyNum=0;

    WHILE (
$plyNum $mCount)
        
$uName $mList[$plyNum];
        
SetPlayerVar$uName,"nbr_stops_window_1",$number_of_stops_w1 );
        
SetPlayerVar$uName,"nbr_stops_window_2",$number_of_stops_w2 );
        
SetPlayerVar$uName,"nbr_stops_window_3",$number_of_stops_w3 );
        
SetPlayerVar$uName,"player_status",);
        
SetPlayerVar$uName,"player_call_to_pitlane_exit",);
        
SetPlayerVar$uName,"player_call_to_start_qualify",);
        
SetPlayerVar$uName,"player_call_to_start_qualify",);
        
SetPlayerVar$uName,"user_fl_changed",);
        
SetPlayerVar$uName,"user_fr_changed",);
        
SetPlayerVar$uName,"user_rl_changed",);
        
SetPlayerVar$uName,"user_rr_changed",);
        
$plyNum=$plyNum+1;
    ENDWHILE

    
### Set $qualify to off ###
    
$qualify="off";
    
### End ###

EndSub
?>


It has never done this before and there's no need to run an RaceStart event, just when Lapper is launched.
Maybe it has something to do with debugging being active, but it seems to be a weird one to me.
Okay, to be a bit more specific, the above happens when a race is completed and then Lapper is stopped/started or restarted with a car (but probably with more as well) being on track.
Uhm oke this is odd.

I have add a debug message in the Race Restart packet, and it seems its still executing when Lapper is reloaded/started after the race is finished. Not sure if this is normal Schwitz

Fixed: Failed RST_Insim packet request.
Attached images
RaceFinished.jpg
Turned out the GetListOfPlayers() testcode didnt work well after some tests.
Because of Arrays in Lapper. Always an enjoyment to work with arrays in Lapper.

New testversion available: PublicTest_04 . Without the testcode for GetListOfPlayers().
Official Release of version V7.0.4.10 available.

Grab the version in the first post.

Thanks to everyone who tested lapper and the feedbacks during testing.
And thanks to you for keeping this project going.
It's great working with you, wether it's bug hunting or bouncing off ideas to each other.
Keep up the good work Thumbs up
apparently, i left some debugmessages in this version.

You can delete these messages in LFSLapper.LPR
See attachment for more info.

And for the people that doesnt know.
SAVE THE FILE!!!

Sorry for my mistake.

Attached images
DebugMessages.jpg

FGED GREDG RDFGDR GSFDG