The online racing simulator
Searching in All forums
(882 results)
Bass-Driver
S3 licensed
I have made something quick.

Be aware. This script isnt tested and may be unstable.

This script uses the new function i have implemented a while ago in LFSLapper.

<?php 
getlistoflayouts
($Filter,$Sort,$TypeSort);
?>

This retreives all the layouts of the current loaded track. From a layoutfolder you have set.
The list with layouts must also exist in the default layoutfolder of your LFS directory.

Download the script below and change the extension of the file to .LPR and add the following line in addonsused.lpr in your 'includes' folder


<?php 
# UserToplist
include( "./AutoLayoutChanger.lpr");
?>

See the code below


<?php 
$LayoutFolder 
"";      #LFSLapper must be on the same machine as the LFS Server.
                        #Set Path to the layoutfolder of your LFSServer
                        #$LayoutFolder = ""; #Example : C:\LFS_0.6R\data\layout
                        #The layouts in your Layoutfolder must also exist in the default Layoutfolder of your LFS directory.

CatchEvent OnLapperStart()

    
GlobalVar $Timelimit$Timelimit 90;      #This is the time in minutes
    
GlobalVar $ElapsedTime$ElapsedTime 0;    #Reset Value to (re)start the timer.
    
GlobalVar $NrOfLayout$NrOfLayout 1;        #Reset Value to start from the top of the layout list.
    
    #ss mm hh dayOfWeek dd MM YYYY
    
RegisterScheduleAction"0 * * * * * *"RSA_Time ); #Execute this action each minute
    
EndCatchEvent
                        
Sub RSA_Time
() # Lapper Event
    
$ElapsedTime $ElapsedTime 1;
    
    
#IF $ElapsedTime is bigger or equal than the timelimit
    #Reset $ElapsedTime and goto Load layout sub
    
IF ($ElapsedTime >= $TimelimitTHEN
        $ElapsedTime 
0;
        
LoadLayout();
    ENDIF
EndSub

Sub LoadLayout
()
#The vars below are needed to retreive the layout from the layoutfolder
    
$Filter "";
    
$Sort "LAYOUTNAME";
    
$TypeSort "ASC";

    
#Try to retreive the layouts from the layoutfolder you have set above
    
$layoutlist getlistoflayouts($Filter,$Sort,$TypeSort);
    
    
#Get numberoflayouts from the current track
    
$MaxNumberOfLayouts $layoutlist["NumberOfLayouts"];

    
#Load the layout
    
privmsg("Loading Layout:".$layoutlist[$NrOfLayout,"LayoutName"]);
    
cmdLFS("/axload ".$layoutlist[$NrOfLayout,"LayoutName"]);
    
    
#Set numberoflayout for the next action
    
$NrOfLayout $NrOfLayout 1;
    
#IF $NrOfLayout is bigger or equal than the number of layouts in your layoutfolder
    #Reset $NrOfLayout
    
IF ($NrOfLayout >= $MaxNumberOfLayoutsTHEN
        $NrOfLayout 
1;
    ENDIF
EndSub                        
?>


Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
The official version of LFSLapper V7.0.5.0 has been released.
Grab the version in the first post.

Credits:

LakynVonLegendaus: For adding/editing code
Iceman121: Reporting bugs and testing.
Bass-Driver
S3 licensed
This is the 2nd time in 3 years, i have been DDoSsed by a LFS player.
It just destroys the joy of other players and i couldnt access my network :S.

Luckily the attack didnt took long.
Bass-Driver
S3 licensed
ATM we experienced a DDOS attack.

We banned a player with the name: fahad khalid

And now he seems to ddossing us.
Bass-Driver
S3 licensed
New PublicTest version available: 7.0.5.0 PublicTest_7. Check first post to download the new TestVersion.

Thanks to LakynVonLegendaus for making this Testversion:

Heres a summery of changes what he has done.


=================================================
Updates:
=================================================
01: Add/Removeobject: Non-floating input values will now be converted into floating values
02: Lapper no longer returns $userName converted to lowercase format
03: UserGroupToFile no longer converts usernames to lowercase format


Bass-Driver
S3 licensed
A tutorial about Usergroups whould be Usefull.
Will see, if i have time for to make one.
Bass-Driver
S3 licensed
New PublicTest version available: 7.0.5.0 PublicTest_6A

AddObject()/RemoveObject(): Values of the object incorrect when one the Axis values are negative.

Thanks Iceman121 for the report.
Bass-Driver
S3 licensed
Thanks you Yisc for the kind words. I still like it to work on it. And i see more people using Lapper.
Bass-Driver
S3 licensed
New PublicTest version available. Grab the testversion in the first post.

Thanks to everyone for testing.

=================================================
Updates:
=================================================
01: It is now possible to not allow AI drivers to join race. MANY THANKS TO LakynVonLegendaus
####################
#Disable AI drivers#
####################
# Enable (1) or disable (-1) $DisableAI option
# If enabled, LFS will not allow AI drivers to join race (/ai) and all AI drives that are already on
track will be spectated on Lapper start/reload
$DisableAI = -1;

02: Add/Removeobject: Floating values for X / Y / Z axis are now possible
ExampleCode:

GlobalVar $GateOpen; $GateOpen = "19.38:-654.38:0.75:208:175:-70";
GlobalVar $GateClosed; $GateClosed = "21.38:-654.38:0.75:5:174:-70";

=================================================
Fixes:
=================================================

01: Add/Removeobject: Heading value wasnt calculated correctly. And negative values werent possible.

Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
New PublicTest version available. Go to first post to grab the new testversion.

Changes:


=================================================
New:
=================================================
01: New Lappervar: 'Lapperstate'
-Check which state your lapper is. Stable or experimental etc

=================================================
Updates:
=================================================
01: Update TrackList.cfg . Thanks Sinanju :)
02: Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Type,$InDex,$Heading) # Player event
//Added new value for $Action
//Get GroundLevel ZByte.
=================================================
Fix:
=================================================
01: (Priv/Host)Delayedcommand: Cannot be executed when settime is not equal with the current time.
The Delayedcommand task stays in the list and will never be executed.
Continues loops could hang. And had to be resetted manually.

Bass-Driver
S3 licensed
Thanks Sinanju,

I've updated trackList.cfg.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Well never had this problem before, so its strange that this happend on the R12 TestPatch. Just to be sure that it is a server issue, i visit other servers . It seems they do not have these kind of issues. So i think its a ISP issue or computer issue on the hostside.
Bass-Driver
S3 licensed
Update: Currently receiving issues with (Host)(Priv)DelayedCommand functions();

Info about the DelayedCommands:

Which could stop when the SetTime of the delayedcommand() not equals with the current time. Lapper cannot execute the DelayedCommand anymore.

i'm looking into the sourcecode to see, if anything could be done without making the delayed command not compatible with older scripts.
Bass-Driver
S3 licensed
small update about my post above.
https://www.lfs.net/forum/post/1936306#post1936306

I was in the same server. And it took me atleast 1 minute to join the race.
and atleast 10 seconds to spectate.

Once joined , i couldnt see my car. After spectating and trying to join the race it said: Name is already used.

Even the insim with some player packets didnt work anymore.
I guess it has something todo with my post above.

The host is located in Jordan. And my ping is around 170ms stable. This shouldnt be a problem so far.
Could this be a connection/ping issue. Because this is very odd TBH.

EDIT: Have tried UDP/TCP positionpackets , still the same.
EDIT_02: Changing playername took 14 seconds.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Not sure if this is TestPatch related, but i never have seen this before.

Host is R12 , client is R12 aswell.

Packet from unknown UCID 19:

Could someone explain what this is?

EDIT: Receive the "Unknown UCID" message before someone connects to the server.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
No there isnt. But whats wrong with this Addon for Lapper?
Load the script into lapper and start Lapper. Because Lapper is also a executable?
Bass-Driver
S3 licensed
Moved the thread to 'Scripting Help' forum , as the other that Iceman121 has created.
Bass-Driver
S3 licensed
New PublicTest version available: PublicTest_04

You must download LFS testpatch R12 or higher to run this testversion.

Feel free to give feedback.

===================================
Summary of changes + Example code
===================================

04: New Function: FileExist();
-Check if a file exist.

<?php 
$ExamplePath 
"C:\Users\Danny\Desktop\Testfile.txt";
    IF (
FileExist$ExamplePath ) == 1THEN
        privmsg
("File Exist");
    ELSE
        
privmsg("File does not Exist");    
    ENDIF
?>

05: New Function: GetListOfFiles();
-Get all files from a existing folder

<?php 
    
###################################################
    #Example CODE
    ###################################################
    ### Command ###
    
CASE "!fl":
        
FileList();
    BREAK;
    
   
### Subcall ###    
    
Sub FileList()
    
$UserName getCurrentPlayerVar"UserName" );
    
$Folder "C:\Users\Danny\Desktop\CruiseFolder"
    
$ListOfFiles getlistoffiles($Folder);
    
$FileListButClose "";
    
$RunLoop "TRUE";
    
$FileNumber 1;
    
    
$initTop 40#Startheight
    
$P_H 5;    #Height of button
    
$P_T $initTop + ($P_H); 
    
#================================================
#Background/Title/CloseButton/Filter
#================================================
    
    
openPrivButton("FileList_bgd",39,$initTop-8,108,110,10,-1,16,"");
    
openPrivButton("FileList_title",40,$initTop-7,106,6,10,-1,160,"^7List of Files(".$ListOfFiles["NumberOfFiles"].")");
    
openPrivButton("FileListFolder_title",40,$initTop-7,106,6,10,-1,64,"^7".$Folder);

    
openPrivButton("FileListFNUM_title",40,$initTop-1,6,5,10,-1,32,"^6Nr");
    
openPrivButton("FileListFNAME_title",46,$initTop-1,40,5,10,-1,32,"^6FileName");
    
openPrivButton("FileListFCREATE_title",86,$initTop-1,20,5,10,-1,32,"^6CreationDate");
    
openPrivButton("FileListFMOD_title",106,$initTop-1,20,5,10,-1,32,"^6ModificationDate");
    
openPrivButton("FileListFSIZE_title",126,$initTop-1,20,5,10,-1,32,"^6FileSize");
    
    
openPrivButton("FileList_close",40,$initTop+95,106,6,10,-1,32,"^3Close List",CloseFileList);
    
    WHILE (
$RunLoop == "TRUE")
        IF (
$ListOfFiles[$FileNumber,"FileName"] != "")  THEN    
            $colnumber 
$ListOfFiles[$FileNumber,"FileNumber"];
            
$colname $ListOfFiles[$FileNumber,"FileName"];
            
$colcreationdate $ListOfFiles[$FileNumber,"FileCreated"];
            
$colmodifydate $ListOfFiles[$FileNumber,"FileModified"];
            
$colsize $ListOfFiles[$FileNumber,"FileSize"];    
                
            
openPrivButton("colpos_".$FileNumber,40$P_T6$P_H$P_H, -116 ISB_C2 ISB_C4 $colnumber);
            
openPrivButton("colfilename_".$FileNumber46$P_T40$P_H$P_H, -116 ISB_LEFT"^7".$colname);    
            
openPrivButton("colcreationdate_".$FileNumber86$P_T20$P_H$P_H, -116"^0" .$colcreationdate "");
            
openPrivButton("colmodifydate_".$FileNumber106$P_T20$P_H$P_H, -116"^0" .$colmodifydate "");
            
openPrivButton("colsize_".$FileNumber126$P_T20$P_H$P_H, -116"^0" .$colsize " Bytes");
            
$P_T $P_T 5;
                
            
$FileListButClose $FileListButClose "&colpos_".$FileNumber."&colfilename_".$FileNumber."&colmodifydate_".$FileNumber."&colcreationdate_".$FileNumber."&colsize_".$FileNumber;
            
SetPlayerVar($UserNameFileListClose$FileListButClose);
            
            
$FileNumber $FileNumber 1;
        ELSE
            
$RunLoop "FALSE";
        ENDIF
    ENDWHILE    
EndSub
?>


Bass-Driver
S3 licensed
It seems that the current Publictest version: PublicTest_03_R12 works without crashing.

If there's a new PublicTest version. You MUST download the latest LFS TestPatch. Otherwise some features wont work.
Bass-Driver
S3 licensed
I have found a example somewhere on the lapperforum. There is not proper tutorial made for this.

But the code below, is an explaination how the Splittoarray() function works.
See if it is usefull or not. Tongue



<?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
            
Val one
            Val 
two
            Val 
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
            
########################################################
?>

Bass-Driver
S3 licensed
Hello,

The devs released a another testpatch with a few insim changes.
One of them is a new insimpacket, which i have implemented in the new PublicTest version of lapper.

Requirements!

YOU MUST DOWNLOAD LFS 0.6R12 TO USE THIS NEW INSIMPACKET.

Check out the first post for the new publictest version. LFSLapper V7.0.4.11_PublicTest_03_R12

Find the event in LFSLapper.LPR


<?php 
##########################################################################################
#Action on Event when a players changed interface mode
##########################################################################################

/*
#### $Mode ####
NORMAL,            // 0 - not in a special mode
OPTIONS,        // 1
HOST_OPTIONS,    // 2
GARAGE,            // 3
CAR_SELECT,        // 4
TRACK_SELECT,    // 5
SHIFTU,            // 6 - free view mode
NUM

#### $SubMode : When a player edit a Object ####
PLAIN,            // 0    no buttons displayed
BUTTONS,        // 1    buttons displayed (not editing)
EDIT_CHALK,        // 4
EDIT_CONES,        // 5
EDIT_TYRES,        // 6
EDIT_MARKERS,    // 7
EDIT_OTHER,        // 8
EDIT_CONCRETE,    // 9
EDIT_CONTROL,    // 10
EDIT_MARSH,        // 11

#### $SelObject: When $SubMode = 11 (EDIT_MARSH) ####

MARSH_IS_CP        = 252; // insim checkpoint
MARSH_IS_AREA    = 253; // insim circle
MARSH_MARSHALL    = 254; // restricted area
MARSH_ROUTE        = 255; // route checker
*/

Event OnInterfaceMode($userName,$Mode,$SubMode,$SelObject,$Time# Player event
/*
    privmsg("UserName: ".$userName);
    privmsg("Mode: ".$Mode);
    privmsg("SubMode: ".$SubMode);
    privmsg("Selected Object: ".$SelObject);
    privmsg("Time: ".$Time);
*/
EndEvent
?>


Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
New PublicTest version available. See first post for download

Summary of changes.

=================================================
New:
=================================================

01: New Function: CarSwitches(); //More info in Docs/CarSwitches
-Set switches of your car lights,horn,siren,flash,signals
NOTE: You must be a host to enable this function.

02: New Lapperoption: DebugSettings , in LFSLapper.LPR
When setting one of these options below, it will displayed the executed subs/events/Loops in your Lapper console.
$DisplaySubs = 0; #Player created subs
$DisplayLoops = 0; #DelayedCommand functions,
$DisplayEvents = 0; #(Catch)Events

#Note: These settings are in a testfase, there is a chance that some subs not will be displayed in the console.

=================================================
Updates:
=================================================
01: Sqlite Database libraryfiles. (not mono yet)

Bass-Driver
S3 licensed
Event guests can execute that command.
Just for test. Create a command and place this function within that command.


Case "!loadlayout":
cmdLFS("/axload <Layoutname>");
BREAK;

Bass-Driver
S3 licensed
Hello S0S,

This is possible.
For a votesystem, you could use this script as a base.

For loading a layout, you could use this command/function in Lapper.

cmdLFS("/axload <Layoutname>");
Bass-Driver
S3 licensed
Have you seen the text?

Dear racers, our master server is currently experiencing DDoS attacks.
We are working towards a better protection, although that may take a few more days to get right.
We apologise for the inconvenience, but our services will be back in full force soon!
Your patience and support are and have always been greatly appreciated.

FGED GREDG RDFGDR GSFDG