The online racing simulator
Searching in All forums
(893 results)
Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
-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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
Thx for testing.
So that means the sourcecode need to be updated.
Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
Very good question. Should test that someday.
When were those classes added?
Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
Sorry for the very late reply

!resettrafficloop should reset the loop.
Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
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
Online at :
VM.TimeAttack
you can use arrays for this.

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

Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
I've done all vehicle types Smile
sorry Schwitz

Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
New infected Gamemode update

it contains a few adminpanel modifications.


Infected Gamemode V0.7.1 (15-02-2025)
Adminpanel Updates:
Add: Logging
-Chatlogging
-Adminpanel access
-Admin warn/kick/ban players
-Connected players

Add: Dashboard
-Last 10 connected players
-Number of joined player for current day
-Number of Unique joined players ( counting userstats files)

Edit: List of Players, when you click on a playerbutton
-Total joined server counter
-Total kick counter
-Total warned counter

Edit: Round Configurations
- Choose between 4 configs (if set)
- Edit the RoundTimer and Vehicles for each round
- Save and rewrite current Config with the new config.
- Scroll Functions.

-Track/Lyt editing will be blocked for now.

Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
New Infected Gamemode Update:

After keeping this LFSLapper script aside for a long time, it was time to update this script again.

An Adminpanel has been created to control the server a little bit easier for the admins.
New a new feature has been added to have actual rounds during an event.

Server: VM.Infected
Discord:https://www.discord.gg/7QhkfBJ


VM.Infected gamemode V0.7.0

New: Adminmenu (Admin/Host) Will be updated in the future with more features.
-Change roundtimer
-Change Cars / Preset Carlists
-Simple Player Management (kick/ban/warn)
-Turn on/off Game RestartTimer
-Gameround Settings.

New: Gamerounds Funcionality (Admin/Host)
-Set 1 to 40 rounds
-Edit (Textfile) with vehicles and roundtimer for each round.
-Edit list (Textfile) and load without rebooting insim.
-Auto Load next round config (toggle on/off in adminpanel)
-Rounds will reset/disable after last round ends.

New: Gamerestart timer
New: Player may use command !ri to delete their trapitem.
New: Admins may use command !rat to delete all trapitems.
New: Admins may use !nextround (!rn) to load the next round config ( If list is available, otherwise it wont keep the current config)

Update: [Helpmenu] Stats
-Added driven distance as a survivor
-Added driven distance as infected
-Added Trapitem used

Update: Insim will delete all trapitems after the game, that hasn't been deleted automatically.


Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
Quote from Gai-Luron :Hello...

Thank you very much Big grin
I learned alot during this process of updating LFSLapper. Experienced alot of headscratches and got great support from the LFS community. Because they are professional programmers, while i never touched C# or any other programming language, before updating LFSLapper.
Bass-Driver
S3 licensed
Online at :
VM.TimeAttack
Thanks for the explanation.
I do see the event in My Signups.

I think its a good idea. Atleast you know which events/leagues you have signed up for, even when its inactive.
You can remove the signup if you want to.
FGED GREDG RDFGDR GSFDG