The online racing simulator
Searching in All forums
(879 results)
Bass-Driver
S3 licensed
Online at :
VM.Infected
Lucky the insim they are using is LFSLapper. And LFSLapper doesnt contain the insimpacket that get IP data from joined players (IS_NCI // New Conn Info).
Server Team Kaboos TC
Bass-Driver
S3 licensed
Online at :
VM.Infected
Hello,

Maybe this an useless thread. If it is , please delete this thread.

Today i joined one of the "Server Team Kaboos TC" servers.

And a message popped up when i joined the server about that the server is being hacked or something. Maybe this is a joke or not. And dont get rid of the messages, so it is not very player friendly.

I have tried to find a website or something about this team but couldnt find anything.

See the attachment of the messages i got.
Last edited by Bass-Driver, .
OnLapperStart()
Bass-Driver
S3 licensed
Online at :
VM.Infected
OnLapperStart(); Event triggered when LFSLapper starts

In this event you set GlobalVars, these vars will be static and you use them for all your Lapperscripts, until you change them.


<?php 
=====================================
#Examplecode: using GlobalVars
=====================================
Event OnLapperStart();

    
GlobalVar $UserNotWelcome;
    
$UserNotWelcome "Bass-Driver";

EndEvent

#Event when a player joined the server (this event will be explained in a another post)
Event OnConnect$userName ); #Player joined the server

    
IF ($userName == $UserNotWelcome
    
THEN

      privmsg
("^1You are not welcome in this server!"); #Send private message to user
      
privmsg(GetPlayerVar($UserNotWelcome,"NickName")."^8(".$UserNotWelcome.") ^1is not welcome in this server!"); #Send message to everyone
      
cmdLFS("/kick "  $UserNotWelcome ); #kick user from the server

    
ELSE

      
privmsg("Welcome ".GetPlayerVar($userName,"NickName")); #Send private message to user

    
ENDIF

EndEvent
?>


LFSLapper List of Events
Bass-Driver
S3 licensed
Online at :
VM.Infected
This thread is work in progress

In this Thread you will find examplecodes for each event in LFSLapper

You can request more code examples in this subforum: https://www.lfs.net/forum/455-General-Support


# This file contains a list of events that are triggered from within LFSLapper . Start with (CATCH)EVENT and it end with (CATCH)ENDEVENT
# ALL of these events MUST have at least 1 Event handler in the LFSLapper.lpr configuration file, otherwise it will cause an error on load.
=========================================================================================

########################################################
#Event triggered when LFSLapper starts Goto post
########################################################

<?php 
    OnLapperStart
();
?>

########################################################
#Connect & Disconnect ,Join & Leaving the race goto post
########################################################

<?php 
    
    OnConnect
$userName ); #Player joined the server
    
OnNewJoinRequest$userName ); #Player request to join the track
    
OnNewPlayerJoin$userName ); #Player joined the race
    
OnDisConnect$userName$reason ); #Player left the server
    
OnLeaveRace$userName ); #Player left the race (Spectate or Pit)
?>

########################################################
#Acceleration progress
########################################################

<?php 
    OnAcceleration
$userName );
    
OnAcceleration2$userName );
?>

########################################################
#Pit events
########################################################

<?php 
    OnPit
$userName );
    
OnEndPit$userName );
    
OnEndPitWindow$userName );
    
OnEnterPitLane$userName$reason );
    
OnExitPitLane(  $userName );
    
OnFastDriveOnPitL1$userName );
    
OnFastDriveOnPitL2$userName );
    
OnMaxFastDriveOnPit$userName );
    
OnNotPitWindow$userName );
    
OnPlayerSelectCar($userName,$Car,$Time); #Player select a car in the garage
    
OnChangeTyres$userName$FL_Changed$FR_Changed$RL_Changed$RR_Changed );
?>

########################################################
#Qualification
########################################################

<?php 
    OnPBQual
$userName );
    
OnPracStart$numP );
    
OnQualStart$NumP );
?>

########################################################
#Race starts
########################################################

<?php 
    OnREO 
$NumP$ReqI$GridOrder );
    
OnRaceStart$NumP );
    
OnFalseStartL1$userName );
    
OnFalseStartL2$userName );
?>

########################################################
#During Race
########################################################

<?php 
    OnLap
$userName );
    
OnMaxAllowedLapTime1$userName );
    
OnMaxAllowedLapTime2$userName );
    
OnNewGapPlayerBefore$userName$split );
    
OnNewGapPlayerBehind$userName$split );
    
OnChangePos($userName$lastPos$currPos);
    
OnPB$userName );
    
OnMaxSessionLaps$userName );
?>

########################################################
#Splittimes
########################################################

<?php 
    OnSpbLast
$userName );
    
OnSpbSplit1$userName );
    
OnSpbSplit2$userName );
    
OnSpbSplit3$userName );
    
OnSplit1$userName );
    
OnSplit2$userName );
    
OnSplit3$userName );
?>

########################################################
#Finishline
########################################################

<?php 
    OnResult
$userName,$flagConfirm );
    
OnFinish$userName );
?>

########################################################
#Race Ends
########################################################

<?php 
    OnRaceEnd
( );
?>

########################################################
#Driven Distance
########################################################

<?php 
    OnDistDone
$userName );
?>

########################################################
#Drifting
########################################################

<?php 
    OnDriftLap
$userName );
    
OnDriftPB$userName );
    
OnDriftResetScore$userName );
    
OnDriftScore$userName );
    
OnDriftTooLow$userName );
    
OnGoodDrift$userName );
?>

########################################################
#Votesystem
########################################################

<?php 
    OnVoteEndChange
($PlayerOnTrack$Vote$Need);
    
OnVoteEndReach($PlayerOnTrack$Vote$Need);
    
OnVoteEndZero();
    
OnVoteQualifyChange($PlayerOnTrack$Vote$Need);
    
OnVoteQualifyReach($PlayerOnTrack$Vote$Need);
    
OnVoteQualifyZero();
    
OnVoteRestartChange($PlayerOnTrack$Vote$Need);
    
OnVoteRestartReach($PlayerOnTrack$Vote$Need);
    
OnVoteRestartZero();
?>

########################################################
#Idlesystem
########################################################

<?php 
    OnIdle1
$userName );
    
OnIdle2$userName );
?>

########################################################
#Spin/Crash Detection
########################################################

<?php 
    OnAngleVelocity
$userName );        
    
OnMaxNbInStunt$userName );
?>

########################################################
#Car Reset
########################################################

<?php 
    OnCarReset
$userName );
    
OnMaxCarResets$userName );
?>

########################################################
#Text Messages
########################################################

<?php 
    OnHostMSO
($Text,$Time)
    
OnMSO$userName$text );
    
OnFlood$userName );
?>

########################################################
#Authorization
########################################################

<?php 
    OnNotMatchFlags
$userName );
    
OnAuthAllowed$userName );
    
OnAuthNotAllowed$userName );
    
OnAuthReached$userName,$level );
?>

########################################################
#Handicaps
########################################################

<?php 
    OnToLowHandicap
$userName );
?>

########################################################
#Swearword detection
########################################################

<?php 
    OnSwearWords1
$userName );
    
OnSwearWords2$userName );
?>

########################################################
#Changing nickname
########################################################

<?php 
    OnNameChange
($userName$oldNickName$newNickName);
?>

########################################################
#Car/Track Rotation
########################################################

<?php 
 
    OnRotateCar
();
    
OnRotateTrack();
?>

########################################################
#ButtonAction (Shift+I en Shift+B)
########################################################

<?php 
    OnButtonFunction
($userName$SubT);
?>

########################################################
#CarContact
########################################################

<?php 
 
    OnCarContact
($PlayerA,$PlayerB,$PlayerA_Speed,$PlayerB_Speed,$PlayerA_X,$PlayerB_X,$PlayerA_Y,$PlayerB_Y);
?>

########################################################
#Hit objects
########################################################

<?php 
    OnObjectHit
($userName,$ObjectFlag,$ObjectHitTime,$Object_X,$Object_Y,$Object_Z,$ObjectType,$ObjectInDex);
    
OnObjectCollision($userName,$ObjectFlag,$ObjectHitTime,$Object_X,$Object_Y,$Object_Z,$ObjectType);
    
OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex);
?>

Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Online at :
VM.Infected
up to the 500 runs Tongue
Bass-Driver
S3 licensed
Online at :
VM.Infected
Well you are right.
Copy-Paste error LOL
Release : LFSLapper V7.0.4.5
Bass-Driver
S3 licensed
Online at :
VM.Infected
Hello Lapperusers.

I present to you a new version of LFSLapper.

LFSLapper version : 7.0.4.5

This version contains new Lapperfunctions and 1 new event that need to be tested.

+-------------------------------+
|Changes from 7.0.4.4 to 7.0.4.5|
+-------------------------------+
=================================================
New:
=================================================


01 - New Function: Add/Remove Objects

It is possible to add/remove objects up to 30 objects at once

Check the Objectslist.txt in the attachments for the objectslist
Type = Type of object

$Object_One = "19:-654:3:208:175:64"; #X:Y:Z:Flag:Type:Heading
$Object_Two = "20:-654:3:208:175:64"; #X:Y:Z:Flag:Type:Heading

addobject($Object_One,$Object_Two);
removeobject($Object_One,$Object_Two);

If one of the parameters of the object is incorrect, function will abort its action.
In the errorfiles you can see which object is incorrect.



02 - New Function: Distance Measurement between Player <> Player / Player <> Object / Object <> Object

trackuserdistance();

With this function you can display the distance between 2 players or between a other location and a player.
See some examples below.
$TheLocation = "-150:26"; #Var must be a string > "", and X and Y axis must be seperated by a ':'
trackuserdistance($userName,$userName);
trackuserdistance($TheLocation,$userName);
trackuserdistance($userName,$TheLocation);
trackuserdistance($TheLocation,$TheLocation);
trackuserdistance("-150:26","-150:26"); #(X:Y,x:y)

03 - New Event : Get info about the objects you add/removed by autocross editor


$DisplayObjectInfo = -1; #Set -1 to disable this event
Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Flags,$Type,$InDex,$Heading) # Player event
privmsg("^7LayoutAction: ^8".$Action);
privmsg("^7Number of Objects: ^8".$NumO);
privmsg("^7X/Y/Z: ^8".$X."/".$Y."/".$Z);
privmsg("^7Index & Type of Object ^8".$InDex."/".$Type);
privmsg("^7ObjectFlag ^8".$Flags);
privmsg("^7Heading of Object ^8".$Heading);
EndEvent

Feedback whould be nice


NOTE: Since Version 7.0.4.4 contains changes for the RegisterNodeAction() & RegisterNodeAction() Sub Callbacks
==========================================================

<?php 
RegisterNodeAction
TESTIDgetLapperVar"ShortTrackName" ) , getCurrentPlayerVar("CurrNode") , test,"" );

Sub test($UserName,$ZoneID)
    
privmsg("ID=".$ZoneID); #output is TESTID
EndSub 
?>


==========================================================


Have fun.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Online at :
VM.Infected
First testvideo about simulating a gate by add/removing objects in LFSLapper

This weekend i will release a testversion.



The code that i used:

EDIT: EDITED CODE to newest version


<?php 
CatchEvent OnLapperStart
()
    
    
#X:Y:Z:Flag:Type:Heading
    
GlobalVar $GateOpen$GateOpen "19:-654:3:208:175:64";
    
GlobalVar $GateClosed$GateClosed "21:-654:3:5:174:64";
    
EndCatchEvent

CatchEvent OnCrossingChecker
($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex)
        
#Go to YellowLight sub when driving throught the insimcircle with index=25
        
IF (($CircleIndex == 25)&&($Flags == 0)) THEN
            YellowLight
(); #Goto YellowLight Sub            
        
ENDIF
        
#Go to Closegate sub to close the gate when driving throught the insimcircle with index=26
        
IF (($CircleIndex == 26)&&($Flags == 0)) THEN
            CloseGate
$KeyFlags );            
        ENDIF
EndCatchEvent

Sub YellowLight
()
            
startlightcontrol(5,149,10,2); #Yellow Startlight, Lightindentifier = 10
            
HostDelayedCommand2OpenGate); #Go to Open Gate sub after 2 seconds
EndSub

Sub OpenGate
$KeyFlags )
            
globalmsg("Gate is open");
            
startlightcontrol(5,149,10,8); #Green Startlight,  Lightindentifier = 10
            
removeobject($GateClosed);     #Remove "closed gate" object
            
addobject($GateOpen); #GateClose
EndSub

Sub CloseGate
$KeyFlags )
            
globalmsg("Gate is closed");
            
startlightcontrol(5,149,10,1); #Red Startlight,  Lightindentifier = 10
            
removeobject($GateOpen);#Remove "open gate" object 
            
addobject($GateClosed); #Add object to simulate a closed gate
EndSub
?>


Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Online at :
VM.Infected
What kind of error do you got.

Place the error in here.
Errors can be found in the 'logs' folder (Bin/Default/Logs)
Bass-Driver
S3 licensed
Online at :
VM.Infected
Quote from FurkanBaglibel :CASE "!distance":
CASE "!dt":
privmsg( "Current Distance: " . Round(ToNum(GetCurrentPlayerVar("TotDistMeter") / 1000),1));
privmsg( "Total Distance: " . Round(ToNum(GetCurrentPlayerVar( "KM" ) + GetCurrentPlayerVar("TotDistMeter") / 1000 ),1));
BREAK;


SetCurrentPlayerVar( "Dist", ToNum(GetCurrentPlayerVar( "KM" ) + GetCurrentPlayerVar("TotDistMeter") ) / 1000);
setUserStoredValue( "Dist", GetCurrentPlayerVar( "KM" ) );


You are almost there.

Place The 2 last lines in 'OnDistDone' event. And see if it works. If it doesnt, check the errorfiles.
You will find them in the 'logs' folder(bin/default/logs)
Bass-Driver
S3 licensed
Online at :
VM.Infected
You have to understand, it wont help you , if i give you a working code.
To learn/understand LFSLapper. You have to try to create scripts yourself.

In my post i give you a good example how to display the total distance.
Now it is up to you to build something. Once you understand how it works. It will be more easily to make more scripts.

Also check out other "(un)finished" scripts aswell. Those scripts are a good way to learn creating scripts in LFSLapper.
Bass-Driver
S3 licensed
Online at :
VM.Infected
Few examples with explanation:

Create a button:
openPrivButton( "lang_en",30,30,4,4,5,-1,32, "^3EN" ,SetLanguage);

When the player click on the button it calls a sub named 'SetLanguage'.


<?php 
Sub SetLanguage
$KeyFlags,$ButtonID  )
   
#Cut the first 5 chars of the buttonID , result = 'en'
   
$language trimsubStr$ButtonID,) );

   
#When the value/string of $language is equal to 'en'
   
IF($language == "en")THEN
      SetCurrentPlayerVar
("IdLang","en"); #Set player language to English
   
ENDIF
EndSub
?>


Create a button for the LFSLapperlanguage_engine
openPrivButton( "example",75,111,50,10,5,-1,ISB_DARK, langEngine("%{example}%"));

To define "example" in english.

Lang "EN"
example = "This text is an exampletext";
EndLang

Bass-Driver
S3 licensed
Online at :
VM.Infected
There is an event in LFSLapper named :

<?php 
#################################################
#Action when a predefined dist is done by player#
# Minimum dist is 100 meters
# -1 deactivate this feature
#################################################
$distToDo 100;
Event OnDistDone$userName # Player event
EndEvent
?>


This event executes every time after every 100 meters the driver has driven.

To count the total distance see the examplecode below.
Examplecode:
SetPlayervar($userName,"DistXFG",(GetPlayerVar($userName,"DistXFG")+$distToDo));

To store the values
What you must do is to create an PlayerVar that will be saved in the LFSLapper database.
You could use these functions

Global var functions (fi_stored):

SetStoredValue("varname", $value) - sets a variable
GetStoredValue("varname") - returns variable as a string
GetStoredNum("varname") - returns variable as a numeric (or as -1 if it's not a number), so you don't need to do a ToNum($var) conversion if you're doing numeric comparisons

User var functions (fi_user_value):

SetUserStoredValue($username, "varname", $value) - Sets a variable
GetUserStoredValue($username, "varname") - returns variable as a string
GetUserStoredNum($username, "varname") - returns variable as a numeric

Button to display total distance.

openPrivButton( "totaldistance",75,111,50,10,5,-1,ISB_DARK, GetPlayerVar($userName,"DistXFG");

Have fun playing with it.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Online at :
VM.Infected
You think you can ask code without doing anything?

Few questions:

-Did you used the search function on this forum to search for examples?
-Have you build something in LFSLapper before? YES? like what.
-Do you know how to add Buttons in LFSLapper. (Show example)
-Could you post the code you have trouble with.

Give correct anwsers to these questions and we might help you.
Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Online at :
VM.Infected
This code does not work if you putt it in a Sub or command.

See my code few posts above and create an CASE command with these lines.
Bass-Driver
S3 licensed
Online at :
VM.Infected
Here is a small example code which you can Start/Stop a loop.
This loop is for everyone in the server. not for a specific player.

EDIT: Display speed & car


<?php 
###################################
#Event triggered when lapper start#
###################################
Event OnLapperStart()
    
Globalvar $Loop_On
        
$Loop_On 0;
EndEvent

#################
#Command actions#
#################
Event OnMSO$userName$text # Player event

    
$idxOfFirtsSpace indexOf$text" ");

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

        CASE 
"!loopoff":
            
$Loop_On 0;
            
$Racers GetListOfPlayers("U");                  
            FOREACH( 
$Var IN $Racers )
                
closeButton$Var["value"], "speed");
            ENDFOREACH
        BREAK;
        
        CASE 
"!loopon":
            
$Loop_On 1;
            
globalmsg("execute sub Set_Loop()");
            
Set_Loop();
        BREAK;

    ENDSWITCH
EndEvent

Sub Set_Loop
()
    IF (
$Loop_On == 1THEN 
        $Racers 
GetListOfPlayers("U");                  
        FOREACH( 
$Var IN $Racers #For each player in the server
            
openButton$Var["value"], "speed",175,124,25,5,5,2,96,"^7" GetPlayerVar$Var["value"], "InstantSpeed") . " " GetPlayerVar$Var["value"], "UnitSpeed")."^8 (".GetPlayerVar$Var["value"], "Car").")");
            
DelayedCommand1Set_Loop); #1 second delay
        
ENDFOREACH
    ENDIF
EndSub
?>


Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Online at :
VM.Infected
I like to share the Test code i'm using to simulate a gate that open and close.
i could it do manually by command or it automaticlly: by driving throught an insimchecker

I have created a new Scriptfile named: TestCode.LPR


<?php 
$DisplayObjectInfo 
1;
CatchEvent OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Flags,$Type,$InDex,$Heading# Player event
    
privmsg("^7LayoutAction: ^8".$Action);
    
privmsg("^7Number of Objects: ^8".$NumO);
    
privmsg("^7X/Y/Z: ^8".$X."/".$Y."/".$Z);
    
privmsg("^7Index & Type of Object ^8".$InDex."/".$Type);
    
privmsg("^7ObjectFlag ^8".$Flags);
    
privmsg("^7Heading of Object ^8".$Heading);
EndCatchEvent

CatchEvent OnMSO
$userName$text # Player event
 
$idxOfFirtsSpace indexOf$text" ");
 IF( 
$idxOfFirtsSpace == -THEN
   $command 
$text;
   
$argv "";
 ELSE
   
$command subStr$text,0,$idxOfFirtsSpace );
   
$argv trimsubStr$text,$idxOfFirtsSpace ) );
 ENDIF
 
#TEST COMMAND
    
SWITCH( $command )
        CASE 
"!opengate":
            
OpenGate();
        BREAK;
        CASE 
"!closegate":
            
CloseGate$KeyFlags );
        BREAK;            
 ENDSWITCH  
EndCatchEvent

CatchEvent OnCrossingChecker
($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex)
        IF ((
$CircleIndex == 25)&&($Flags == 0)) THEN
            OpenGate
();
            
HostDelayedCommand3CloseGate); #Go to Close gate sub
        
ENDIF
EndCatchEvent

Sub OpenGate
()
            
globalmsg("Gate is open");
            
startlightcontrol(5,149,10,8); #Green Startlight
            
$X 19$Y = -654$Z 3$TypeOfObject 175$HeadingOfObject 64$Flag 208#Info about object
            
removeobject(21,-654,3,5,174,195);     #Remove opengate   
            
addobject($X,$Y,$Z,$Flag,$TypeOfObject,$HeadingOfObject); #GateClosed
EndSub

Sub CloseGate
$KeyFlags )
            
globalmsg("Gate is closed");
            
startlightcontrol(5,149,10,1); #Red Startlight
            
$X 21$Y = -654$Z 3$TypeOfObject 174$HeadingOfObject 64$Flag 5#Info about object (Closed gate)vc
            
addobject($X,$Y,$Z,$Flag,$TypeOfObject,$HeadingOfObject); #Add object to simulate a closed gate
            
removeobject(19,-654,3,208,175,64);     #Remove "open gate "object 
EndSub
?>


Last edited by Bass-Driver, .
Bass-Driver
S3 licensed
Online at :
VM.Infected
There is currently not an option in LFSLapper to display the Speed in realtime. I have created an event in my personal lapper which i can display speed or other stuff Every 0.5 Seconds. I cannot release this in the public lapper because it must be further tested.
Bass-Driver
S3 licensed
Online at :
VM.Infected
Nice to see you around here in the LFSLapper forum.

Thanks for the Tracklist.cfg, which i need to update the current Tracklist.
Bass-Driver
S3 licensed
Online at :
VM.Infected
Nice small update: New Event

With this event you can dislay which object you have add or removed.

New Event:

$Action: 1 = Addobject / 2 = remove object
$NumO = Number of objects you have selected
$Index = Index Number ( See first post in attachment)
$Type = Type of Object ( See first post in attachment)


<?php 
$DisplayObjectInfo 
= -1;
Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Type,$InDex,$Heading# Player event
    
privmsg("^7LayoutAction: ^8".$Action);
    
privmsg("^7Number of Objects: ^8".$NumO);
    
privmsg("^7X/Y/Z: ^8".$X."/".$Y."/".$Z);
    
privmsg("^7Index & Type of Object ^8".$InDex."/".$Type);
    
privmsg("^7Heading of Object ^8".$Heading);
CatchEvent
?>


If you do not want the info everytime you add/move/remove an object. Set $DisplayObjectInfo to '-1';
It wont execute the event. To enable it you can set it to '1'

You may also use SetConfigVar("DisplayObjectInfo", 1); or SetConfigVar("DisplayObjectInfo", -1); in your scripts.
Bass-Driver
S3 licensed
Online at :
VM.Infected
Maybe i'm thinking to easy now but,
whould it be an idea to disable the "Unknown objects" by default. And enable it when Host/Insim sents a packet to the guest(s).

Sort like the "Siren" command.
Bass-Driver
S3 licensed
Online at :
VM.Infected
Quote from UnknownMaster21 :Maybe also the highway...

Dunno, I am already happy what this new blackwood can now benefit!

same here, but we (i) want more. xD
Bass-Driver
S3 licensed
Online at :
VM.Infected
Hi,
Scawen/Eric, this new Blackwood looks amazing. Looking forward for the new S3 tracks and might a another Track update.
But i have a small suggestion.

Is it possible to unlock The "red" area for the open configuration?

Thanks
Bass-Driver
S3 licensed
Online at :
VM.Infected
I like the new update Scawen. Sorry to read that you spent alot of time to create this update but i have to agree with UM21.

There are also rally servers with layouts on those area's.

So i hope you could think about a good fix for this.
FGED GREDG RDFGDR GSFDG