#RegisterZoneAction("Track" , X , Y , Width of Zone, EnterZone, LeaveZone);
RegisterZoneAction( "WE1X" , 24 , 30 , 1 , SE_snow4,"" );
Event OnConnect($userName)
SetPlayerVar($userName,"Health",100);
EndEvent
-Choose your type of character: I ,| or dots or whatever you like:
-Colorscheme is easy to adjust,
-Length of the bar ( length of the characters you used).
-Download the script:
-Rename the file to HealthBar.LPR with 'notepad' or other textediting applications
-Place the file in 'include' folder (Bin\Default\Includes)
-Add the following line in 'AddonsUsed.LPR' (Bin\Default\Includes\Addonsused.LPR)
include( "./HealthBar.LPR");
-Type command !hb <0-100> Example: !hb 25
<?php
#==================================================================================#
#Scriptname: HealthBar.LPR
#Author: Bass-Driver
#Version: 1.0
#VersionDate: 25-12-2017
#Description: HealthBar, With automatic colored chars calculation
#==================================================================================#
CatchEvent OnMSO( $userName, $text ) # Player event
$text = Tolower( $text );
$idxOfFirstSpace = indexOf( $text, " ");
IF( $idxOfFirstSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirstSpace );
$argv = trim( subStr( $text,$idxOfFirstSpace ) );
ENDIF
SWITCH( $command )
CASE "!hb":
#Check is Argv is a numeric value
IF (IsNum($argv) == 1) THEN
$Health = $argv;
$HealthBar = "IIIIIIIIIIIIIIIIIIII"; #Kind of chars for the bar (count even chars) 10/20/40/50/100)
$CurrentHealth = "".CalculateHealth($Health,$HealthBar);#Get Calculated string
#IF health is equal or below 15% , it will blink.
IF (ToNum($Health) <= 15) THEN
openButton($userName,"statusbar",178,100,22,4,5,-1,80,"^0Health: ".$HealthBar." ^0(".$Health."%) %at%^0Health: ".$CurrentHealth." ^0(".$Health."%)");
ELSE
openButton($userName,"statusbar",178,100,22,4,5,-1,80,"^0Health: ".$CurrentHealth." (".$Health."%)");
ENDIF
ENDIF
BREAK;
ENDSWITCH
EndCatchEvent
Sub CalculateHealth($Health,$HealthBar)
#Get length of the healthbar
#Calcalate how many chars need be colored ((LenghtOfChars/100%) * Health)
$LengthOfBar = StrLen( $HealthBar );
$GetStatus = ToNum(Round((($LengthOfBar/100)*$Health),0));
#Get length of string that need to be colored.
$GetString = substr( $HealthBar,0,$GetStatus );
#And rhe rest of the string
$GetOtherChars = substr( $HealthBar,$GetStatus,$LengthOfBar-$GetStatus );
#Which color need the calculate string have at a particular Health%
IF (ToNum($Health) >= 50) THEN
$NewHealth = "^2".$GetString;
ENDIF
IF (ToNum($Health) >= 20 && ToNum($Health) < 50) THEN
$NewHealth = "^3".$GetString;
ENDIF
IF (ToNum($Health) < 20) THEN
$NewHealth = "^1".$GetString;
ENDIF
#Calculate how many chars are colored , the rest will be black. Total chars = 20, Health = 50% = 10 colored chars, rest of the 10 chars will be black.
$GetLength = StrLen( $NewHealth );
$NewHealthBar = Insert($NewHealth,$GetLength,"^0".$GetOtherChars);
#Create new string when health is below 5 %
IF (ToNum($Health) < 5) THEN
$NewHealthBar = "^1".$HealthBar;
ENDIF
#Return value/string.
Return($NewHealthBar."");
EndSub
?>
+---------------------------------+
|Changes from 7.0.4.10 to 7.0.5.0|
+---------------------------------+
-New Function
-New Events
-Several BugFixes
=================================================
New:
=================================================
=================================================
NEW EVENTS:
=================================================
01: New Event: Event OnTakeOverCar($Player_Old,$Player_New,$Car)
Event executes when someone takes over someone cars.
02: New Event: Event OnLapValidation( $userName,$HVLC,$Time )
Reports when a player hits a wall, goes off track, goes Out of Bounds, Speeds in the pitlane
#Output of $HVLC
# 0 : Off Track
# 1 : Hits Wall
# 4 : Speeding in pitlane
# 5 : Out of Bounds
03: New Event: OnInterfaceMode() VERSION LFS 0.6R12 required!!!!!
-Reports in which menu the Player is.
-Also report when a admin is editing an object in Shift+U mode
Event OnInterfaceMode($userName,$Mode,$SubMode,$SelObject,$Time) # Player event
#YourcodeHere
EndEvent
=================================================
NEW FUNCTIONS:
=================================================
01: New Function: GetAngle(); See attachment
-Get the angle of location or player , depends on your Cars Heading.
$Angle = GetAngle($userName,$userName);
$Angle = GetAngle($TheLocation,$userName);
$Angle = GetAngle($userName,$TheLocation);
$Angle = GetAngle($TheLocation,$TheLocation);
$Angle = GetAngle("-150:26","-150:26"); #(X:Y,x:y)
02: 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.
03: New Lapperoption: DebugSettings , in LFSLapper.LPR
-When set one of the 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 your console.
04: New Function: FileExist();
-Check if a file exist.
$Folder = "C:\Users\Danny\Desktop";
$FileName = "Testfile";
$Extension = ".txt";
IF (FileExist( $Folder,$FileName,$Extension ) == 1) THEN
privmsg("File Exist");
ELSE
privmsg("File does not Exist");
ENDIF
05: New Function: GetListOfFiles();
$Folder = "C:\Users\Danny\Desktop\CruiseFolder";
#Get an array of files from the folder
$ListOfFiles = getlistoffiles($Folder);
$NumberOfFileInFolder = 0; #This is the first file in the folder
#Values you can get from each file.
$FileNumber = $ListOfFiles[$NumberOfFileInFolder,"FileNumber"];
$FileName = $ListOfFiles[$NumberOfFileInFolder,"FileName"];
$CreationDate = $ListOfFiles[$NumberOfFileInFolder,"FileCreated"];
$ModifiedDate = $ListOfFiles[$NumberOfFileInFolder,"FileModified"];
$FileSize = $ListOfFiles[$NumberOfFileInFolder,"FileSize"];
06: New Lappervar: 'Lapperstate'
-Check which state your lapper is. Stable or experimental etc
=================================================
Updates:
=================================================
01: Lapper Console: Message/command length increased from 30 characters to 80 characters
02: Lapper Console: Message/command sendtime decreased from 1000 milliseconds to 100 milliseconds
03: Lapper Console: Server Connecting messages.
04: WriteLine(); Possible to use colortags ^0 - ^8 See attachment
05: Write(); Possible to use colortags ^0 - ^8
06: Sqlite Database libraryfiles. (not mono yet)
07: Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Type,$InDex,$Heading) # Player event
//Added new value for $Action
//Get GroundLevel ZByte.
08: LFSLapper.LPR main scriptfile.
09: Update TrackList.cfg . Thanks Sinanju :)
10: Possible to not allow AI on track. THANKS LakynVonLegendaus
####################
#Disable AI drivers# (Can be found in LFSLapper.LPR below $DefaultTopCar 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; # Enable (1) or disable (-1)
11: Add/Removeobject: Floating values for X / Y / Z axis are now possible
12: Add/Removeobject: Non-floating input values will now be converted into floating values
13: Lapper no longer returns $userName converted to lowercase format
14: UserGroupToFile no longer converts usernames to lowercase format
=================================================
Fix:
=================================================
01: FO8 characterbug in SetAllowedCars();
02: F08 characterbug in AllowedPlayerCars();
03: Remove($String,$StartIndex,$NumberOfChars) : Error when StartIndex is lower than 1.
04: Addobject(): Lapper crash when X and Y values are floating (comma) numbers (0,00).
05: Addobject(): Lapper crash when Heading value is negative.
06: Removeobject(): Lapper crash when X and Y values are floating (comma) numbers (0,00).
07: Removeobject(): Lapper crash when Heading value is negative.
08: EditFile(): Lappercrash caused by a wrong hardcoded errormessage.
09: Lapper Console: Lapperserver 'stopped' message while starting a lapperserver.
10: Hosts also executed Flooding Events.
11: No error messages for StartLightControl.
12: joinrequest: Lapper crash when CarHeading is lower than 0.
13: (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.
14: Add/Removeobject: Heading value wasnt calculated correctly. And negative values werent possible.
15: Random UCO insimpacket crashes
16: AFKTimer/IdleTimer PlayerVars
Example:
-Downloaded the script.
-Placed the script in the 'includes' folder (Bin/Default/Includes)
etc...
- Free and Simple: Let your computer on for 24/7. (Except powercosts etc)
- Less expensive: Let someone else run Lapper for you. But i think it whould cost you money.
- Most expensive: Buy a VPS (Virtual private server) at a hosting company.
Open default_1.ini (LFSLapper directory/Bin/default/default_1.ini)
-Set the Server-AdminPass: $password = "adminpass";
| Server/PC IP |Insimport
DEF1|gr1|xxx.xxx.xxx.xxx|xxxxx|./default|default_1.ini|autowork
<?php
#==================================================================================#
#Scriptname: SplitString.LPR
#Author: Bass-Driver
#Version: 1.0
#VersionDate: 09-12-2017
#Description: Split a string with a max amount of characters in 2 strings.
# Choose between return a Global or a Private Message.
# Split a string by the choosen delimiter.
#==================================================================================#
CatchEvent OnLapperStart()
GlobalVar $MaxLen; $MaxLen = 120; #Max length of first string.
GlobalVar $StartIndex; $StartIndex = 0; #StartIndex to read the firststring or total text
GlobalVar $ReadMaxCharsForDelimiter; $ReadMaxCharsForDelimiter = 5; #How many chars to read back from the first string. (IF delimiterchar is set)
EndCatchEvent
CatchEvent OnMSO( $userName, $text ) # Player event
$text = Tolower( $text );
$idxOfFirstSpace = indexOf( $text, " ");
IF( $idxOfFirstSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirstSpace );
$argv = trim( subStr( $text,$idxOfFirstSpace ) );
ENDIF
SWITCH( $command )
CASE "!spst":
CASE "!splitstring":
$Privmsg = 1; #Set return message in a privatemessage = 1 or a globalmsg = 0;
$Player = $userName; #Set username if you have set a private message
$Text = $argv; #Text
$Delimiter = ","; #Set a char that will split the string for more precision.
#Keep empty to split the text after a maximum of chars.
#Call Sub
SplitText($Privmsg,$Player,$Text,$Delimiter);
BREAK;
ENDSWITCH
EndCatchEvent
Sub SplitText($privmsg,$userName,$Text,$Delimiter)
#SplitText variables
$LoT = StrLen($Text); #Get Length of total text
#When Textlength is higher than Maximumlength
IF ($LoT > $MaxLen) THEN
$FirstString = substr( $Text, $StartIndex, $MaxLen);
$SecondString = substr( $Text,$MaxLen,$LoT-$MaxLen );
#Find Delimiters variables
IF (($Delimiter != "")&&(contains($FirstString,$Delimiter) == 1)) THEN
#From where to start read string to find delimiter
$IndexOfDelimiterCheck = $MaxLen - $ReadMaxCharsForDelimiter;
#Get String between MaxLength of first string and StartFind delimiter
$StringDelimiterCheck = substr( $FirstString, $IndexOfDelimiterCheck, $ReadMaxCharsForDelimiter);
#Get Index of Delimiter
$IndexOfDelimiter = indexOf( $StringDelimiterCheck, $Delimiter);
#Delimiter is found
IF ($IndexOfDelimiter != -1) THEN
#Calculate the startindex of second string
$StartIndexSecondString = ($MaxLen - $ReadMaxCharsForDelimiter) + ($IndexOfDelimiter+1);
#Calculate the length of the second string
$LenghtOfSecondString = $LoT-$StartIndexSecondString;
#Get First string and Second string
$SecondString = substr( $Text, $StartIndexSecondString, $LenghtOfSecondString );
$FirstString = substr( $Text, $StartIndex, $StartIndexSecondString-1); #$StartIndexSecondString-1 = Remove Delimiter
ENDIF
ENDIF
#Return message is a privatemessage or a globalmessage
IF ($privmsg == 1) THEN
privmsg( $userName,"" . $FirstString );
privmsg( $userName,"" . $SecondString );
ELSE
globalmsg("" . $FirstString );
globalmsg("" . $SecondString );
ENDIF
#Text doesnt exceed textlength limit
ELSE
#Return message is a privatemessage or a globalmessage
IF ($privmsg == 1) THEN
privmsg( $userName, "" . $Text );
ELSE
globalmsg("" . $Text);
ENDIF
ENDIF
EndSub
?>
#==================================================
#EXAMPLES
#==================================================
Settings: (max length is 10)
$Privmsg = 1;
$Player = $userName;
$Text = $argv;
$Delimiter = "";
Input:
!spst hellohello
Output:
hellohello
Input:
!spst hellohelloblah
Output:
hellohello
blah
#==================================================
$Privmsg = 1;
$Player = $userName;
$Text = $argv;
$Delimiter = ",";
Input:
!spst hellohello
Output:
hellohello
Input:
!spst hello,helloblah
Output:
hello
helloblah
Input:
!spst h,ellohelloblah
Output:
hellohello
blah