The online racing simulator
Searching in All forums
(893 results)
Bass-Driver
S3 licensed
I do have a Moza R12 with a GT wheel and formula wheel.

I clicked on 'Configure' in the Moza Pithouse Software, but nothing is really happening.
Bass-Driver
S3 licensed
What does the errorlog tells you.

Beside that, i do see one issue already with the events
All

Event OnMSO should be CatchEvent OnMSO, this is for all external scripts outside the default lfslapper.lpr

so
Event
EndEvent

must be

CatchEvent
EndCatchEvent


CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");

IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF

SWITCH( $command )

CASE "!brief":
IF ( UserIsAdmin( $userName ) == 1 )
THEN
DelayedCommand( 5,rivi2 );

ELSE
privMsg("Only for admin!");
ENDIF
BREAK;
ENDSWITCH
EndCatchEvent


Sub rivi1 ()
cmdLFS("/msg" );
DelayedCommand( 10,rivi2 );
EndSub

Sub rivi2 ()
globalmsg("^7We now start the DRIVERS BRIEFING.");
DelayedCommand( 10,rivi3 );
EndSub

Sub rivi3 ()
globalmsg("^7Keep the game chat empty for competition leader messages.");
DelayedCommand( 10,rivi4 );
EndSub

Sub rivi4 ()
globalmsg("^7Do not write anything to the game chat during the QUALIFY and TOP20 bracket.");
DelayedCommand( 10,rivi5 );
EndSub

Sub rivi5 ()
globalmsg("^7You can follow competition by opening www.sladimasters.com/scoreboard ");
DelayedCommand( 10,rivi6 );
EndSub

Bass-Driver
S3 licensed
Never used InSim relay really.
I do use the LFS API for all my LFSLapper projects.
Probably other LFSLapper users use it aswell, because it fairly easy to set-up.

I whould like to see other parameters within the API, like server/player information
Bass-Driver
S3 licensed
Minor detail:

The title in the Unlock screen says: User Name and Password
Shouldnt this be User Name and Unlockcode?
Bass-Driver
S3 licensed
-Do you get any other error messages.
-Is there other code you edited/created.

Looking at the error message, it seems that the faulty code is at Event OnConnect($userName)
But normally it points to the error in one of your scripts and not to the sourcecode.

example what i got today.

-----------------------------------------------------------------------------
7/4/2025 6:57:27 PM -> Error: Unclosed string on file: ".\default\.\includes\.\RallySystem\Scripts\Test\Convert.LPR" at line #6
-----------------------------------------------------------------------------
7/4/2025 6:57:29 PM

Lapper Instance 188.122.74.156/55264 abort!

Object reference not set to an instance of an object.
LFSLapper
at LFSLapper.LFSClient.managePacket(NCN newConnection)
at LFSLapper.LFSClient.Loop(Connect insimConnection)
at LFSLapper.LFSClient.doloop()
at LapperInstances.LapperInstance.doConnection()
Void managePacket(NCN)
Closing Instance...

You can add me in discord: DutchShadow
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Which version of LFSLapper did you download.
Can you show us the code.

Edit: previous post has been deleted for some reason.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Try the following, it works for me and others.
Took me a while to figure it out aswell, since the information about the RestAPI is minimum.

example: https://www.lfs.net/forum/thread/98341
  • -Set Redirect URL to https://www.lfs.net
  • -unmark 'Single Page application'
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
The key should be in the same folder as your lfslapper files.

API keys should be placed in : C:\LFS\LFSLapper\bin\<NameofServer>\includes\myInc.lpr
Your script: C:\LFS\LFSLapper\bin\<NameofServer>\includes\OPEN_drifting_server.lpr
Bass-Driver
S3 licensed
This is pretty easy to do.
For the array you add an extra argument to the array with the shorttrackname.

Example:
# X , Y , Z, Flag (do not change), Heading of vehicle
$SpawnLocation[1,KY2R] = "390.24,-463.08,11.89,128,140";

$SpawnLocation[1,BL1X] = "100.30,-410.18,11.89,128,140";

etc....

In the TeleportPlayer Sub you request the current (short) trackname

$CurrTrack = GetLapperVar("ShortTrackName");
$SplittedValues = SplitToArray($SpawnLocation[$locIndex,$CurrTrack],",");

Bass-Driver
S3 licensed
Thx for testing.
So that means the sourcecode need to be updated.
Bass-Driver
S3 licensed
Very good question. Should test that someday.
When were those classes added?
Bass-Driver
S3 licensed
The list of variables you can use with $modinfo = GetModInfo($userName);

list of variables:
status,id,name,descriptionshort,description,userid,username,wip
publishedat,numdownloads,currusage,rating,numratings,staffpick
tweakmod,version,lastdownloadedat,class,ev
icecc,icenumcylinders,icelayout,evredLine,drive,shifttype
power,maxpowerrpm,mass,bhp,powerweightratio,bhpton,fueltanksize

To get info about the Drivetrain is $modinfo["drive"] or $modinfo["drivetrains"]
Let me know if you get any information out of it. Because i might see a small typo in the sourcecode.

you might want to look to this example aswell. To see what kind of variable you can get.
https://www.lfs.net/forum/post/1980359#post1980359

public enum Class
{
Object, //0: Object
Touring_Car, //1: Touring car
Saloon_Car, //2: Saloon car
Buggy, //3: Buggy
Formula, //4: Formula
GT, //5: GT
Kart, //6: Kart
Bike, //7: Bike
Van, //8: Van
Truck, //9: Truck
Formula_1, //10: Formula 1
Formula_SAE //11: Formula SAE
};

public enum iceLayout
{
Inline, //0: inline
Flat, //1: flat
V //2: V Shape
};

public enum drivetrains
{
None, //0: None
Rear_Wheel_Drive_RWD, //1: Rear-Wheel Drive
Front_Wheel_Drive_FWD, //2: Front-Wheel Drive
All_Wheel_Drive_AWD, //3: All-Wheel Drive
Four_Wheel_Drive_4WD //4: Four Wheel Drive
};

public enum shiftType
{
None, //0: None
H_Pattern, //1: H-pattern gearbox
Motorbike, //2: Motorbike
Sequential, //3: Sequential
Sequential_with_ignition_cut, //4: Sequential with ignition cut
Paddle, //5: Paddle
Electric_Motor, //6: Electric motor
Centrifugal_Clutch //7: Centrifugal clutch
};

Last edited by Bass-Driver, . Reason : changed getmoddedcarinfo($userName); to GetModInfo($userName);
Bass-Driver
S3 licensed
Change $modinfo to $modinfo["class"]
So in your case:

<?php 
##IF the player does not meet the required vehicleclass.
IF(($modinfo["class"] != "GT" ) && ($modinfo["class"] != "Saloon_Car") && ($modinfo["class"] != "Touring_Car"))
THEN
cmdLFS
( "/spec " . GetCurrentPlayerVar("UserName") );
openPrivButton( "classspec",50,35,100,15,5,15,32, "^7You have been moved to spectators because your ^1car ^7does not meet the server ^1requirements.");
openPrivButton( "classchange",50,50,100,15,5,15,32, "^7Allowed vehicles ^7on the server are ^3Saloon, Touring Car, or GT" );
ENDIF
?>
List of correct names of vehicleclasses
Object, //0: Object
Touring_Car, //1: Touring car
Saloon_Car, //2: Saloon car
Buggy, //3: Buggy
Formula, //4: Formula
GT, //5: GT
Kart, //6: Kart
Bike, //7: Bike
Van, //8: Van
Truck, //9: Truck
Formula_1, //10: Formula 1
Formula_SAE //11: Formula SAE

Bass-Driver
S3 licensed
If you are using LFSLapper, you can request vehicleinformation from a player (Player must be on track)

To request vehicleinformation: getmoddedcarinfo($userName);

$modinfo = getmoddedcarinfo($userName);
privmsg("".$modinfo["class"]);

More variables can be found in the changelog here: https://www.lfs.net/forum/post/1980849#post1980849
Bass-Driver
S3 licensed
Hello,
Can you try the code below, 'main_welc2' had 3 arguments which you didn't defined in Lang "EN". Maybe that coule be the reason

you had:
openPrivButton( "pos",25,80,150,10,8,-1,ISB_NONE, langEngine("%{main_welc2}%",$Posabs,$Posqual,$Groupqual ) );

i've changed it to
openPrivButton( "pos",25,80,150,10,8,-1,ISB_NONE, langEngine("%{main_welc2}%"));

And indeed what TxilyZ said, EndLang is missing in the code.
Try TxilyZ's solution first before you try mine Smile


Event OnConnect( $userName ) # Player event

$NickName = GetCurrentPlayerVar("NickName");
$Posabs = GetCurrentPlayerVar("PosAbs");
$Groupqual = GetCurrentPlayerVar("GroupQual");
openPrivButton( "welc",25,50,150,15,12,-1,ISB_NONE, langEngine("%{main_welc1}%", $NickName ) );
openPrivButton( "pos",25,80,150,10,8,-1,ISB_NONE, langEngine("%{main_welc2}%"));
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 );


$RaceTime = GetLapperVar("racetime");
EndEvent

Bass-Driver
S3 licensed
Thank you for the very kind words.

Nice to see a another LFSLapper user on the forum. Big grin

I'm happy that the "example script" was usefull and thank you for update. Maybe you update it even more and create an topic on the finished scripts forum.
Bass-Driver
S3 licensed
Hello

I've made an examplecode to this kind of system.
If you know the X and Y coordinates of the location, then you could edit the x and Y coords below.

This code doesnt have a close button.

CatchEvent OnLapperStart()
GlobalVar $SpawnLocation;

# X , Y , Z, Flag(do not change), Heading of vehicle
$SpawnLocation[1] = "286.25,-984.5,11.89,128,55";
$SpawnLocation[2] = "126.56,-1087.62,14.62,128,-101";
$SpawnLocation[3] = "283.81,-988.25,11.92,128,55";
$SpawnLocation[4] = "190.56,-80.74,7.64,128,20";
$SpawnLocation[5] = "-284.5,-295.81,21.77,128,-101";

EndCatchEvent


CatchEvent OnMSO( $userName, $text ) # Player event

$idxOfFirtsSpace = indexOf( $text, " ");


IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF

SWITCH( $command )
CASE "!teleport":
OpenTeleportWindow($userName);
BREAK;

ENDSWITCH
EndCatchEvent

Sub OpenTeleportWindow($userName)

#Background
OpenPrivButton("Teleportwindow_bgd",70,65,60,32,5,-1,32, "");

#Buttons of locations.

OpenPrivButton("Teleportwindow_Loc_1",71,66,58,6,5,-1,16, "^0Location 1",TeleportPlayer);
OpenPrivButton("Teleportwindow_Loc_2",71,72,58,6,5,-1,16, "^0Location 2",TeleportPlayer);
OpenPrivButton("Teleportwindow_Loc_3",71,78,58,6,5,-1,16, "^0Location 3",TeleportPlayer);
OpenPrivButton("Teleportwindow_Loc_4",71,84,58,6,5,-1,16, "^0Location 4",TeleportPlayer);
OpenPrivButton("Teleportwindow_Loc_5",71,90,58,6,5,-1,16, "^0Location 5",TeleportPlayer);
EndSub

Sub TeleportPlayer($keyflags,$id)

$userName = Getcurrentplayervar("UserName");

#trim the first 19 characters of the buttonID
$SelectedLocation = trim( subStr( $id,19 ));
$SplittedValues = SplitToArray($SpawnLocation[ToNum($SelectedLocation)],",");

#Give values of the array a readable name.
$X = $SplittedValues[0];
$Y = $SplittedValues[1];
$Z = $SplittedValues[2];
$Flag = $SplittedValues[3];
$Heading = $SplittedValues[4];

#JRR Spawn request.
joinrequest(ToNum($X),ToNum($Y),ToNum($Z),ToNum($Flag),ToNum($Heading),GetPlayerVar($userName,"UCID"),GetPlayerVar($userName,"PLID"),4); #Spawn Player to the selected location with vehiclereset
EndSub

LFSLapper: MovePlayerMenu
Bass-Driver
S3 licensed
Hello,

I whould like to publish an script, i've created for my TimeAttack server.
I've been using it to create new spawnpoints for the stages which saved me alot of time.
So i whould like to share it with you.

Download MovePlayerMenu.txt and change the extention from .txt to .lpr.
Add the file into you 'includes' folder and add the script into addonsused.lpr


Required LFSLapper version: V7.0.9.0 and higher

Features:
  • -Simple UI, can be opened with: <!mpm / !moveplayermenu>
  • -ServerAdmins may move themself (default) or other players (Set new username in menu) to a different location on the map.
  • -Get current coordinates of the selected player
  • -Copy and set new coordinates for the selected player.
  • -Move players in shiftU mode.
How to make moving in shiftU mode work:
  • Admin must enable the feature with the command <!asu 1>. You can disable it with <!asu 0>
  • Set the correct player in the MovePlayerMenu <!mpm>
  • Enable ShiftU mode Press Shift+U
  • Be sure none of objects are selected.
  • Press letter O, and the selected player will be moved to the location of where your cursor is.
Have Fun.

Bass-Driver
S3 licensed
Sorry for the very late reply

!resettrafficloop should reset the loop.
Bass-Driver
S3 licensed
Maybe the loop stopped for some reason, you can reset the loop with !resettrafficloop

And thank you for the kind words.
Bass-Driver
S3 licensed
Try the following:
  • Create an intersection
  • Click EDIT
  • Select type intersection number 4 ( pedestrian-crossing)
  • Add two trafficlights
  • Edit the LightIDs: one must be the actual startlight ID you placed, and one lightID that isnt in use.
  • Automatic contol to AUTO
  • Enable the intersection

Bass-Driver
S3 licensed
Start/Configure the trafficlight script with the command!trafficlight
The code in this script is based on a loop that runs continuously.
So the trafficlight wont be activated by detection.

But looking at your question. you want to have the Red > Green > Yellow > Red sequence i think.

You can look a the code below the function
Sub TrafficLoop()

If you wan to create something yourself, here is a simple example.
Execute Sub Red_Yellow_light().
Caution: i havent tested this.

Sub Red_Yellow_light()
startlightcontrol(5,149,1,1); #LightID = 1
delayedcommand("GoToYellowLight",5,Yellow_Green_light); #duration 5 seconds
EndSub

Sub Yellow_Green_light()
startlightcontrol(5,149,1,2); #LightID = 1
delayedcommand("GoToGreenLight",2,Green_Yellow_Light); #duration 2 seconds
EndSub

Sub Green_Yellow_Light()
startlightcontrol(5,149,1,8); #LightID = 1
delayedcommand("GoToYellowLight",6,Yellow_Red_Light); #duration 6 seconds
EndSub

Sub Yellow_Red_Light()
startlightcontrol(5,149,1,2); #LightID = 1
delayedcommand("GoToRedLight",2,Red_Yellow_light); #duration 2 seconds
EndSub

Bass-Driver
S3 licensed
New layout on VM.Timeattack

We like to announce a semi new layout has been loaded on our TimeAttack server.
Our very first timeattack from 2019 has been rebuilt. This includes changes on the 3 existing stages and 2 new stages.
Due to the object limit, it wasn't possible to add a 6th stage.

Name: VM_TA_5S_2k25
Environment: Westhill
Config: WE1X
Stages: 5 (Stage 4 and 5 are accessible via the boxes or !s4/!s5)
Difficulty: Easy/Medium
Vehicles: All (Caution on stage 5 with larger vehicles)

Bass-Driver
S3 licensed
you can use arrays for this.

Globalvar $CarNames;
$CarNames["DF234F"] = "Full CarName 01";
$CarNames["BD8E56"] = "Full CarName 02";

Bass-Driver
S3 licensed
I've done all vehicle types Smile
sorry Schwitz

FGED GREDG RDFGDR GSFDG