+--------------------------------+
|Changes from 7.0.4.8 to 7.0.4.10| #7.0.4.9 is skipped, caused by a big sourcecode bug
+--------------------------------+
-New Lappervars added
-New Events/InsimPackets added : OnPlayerFlags , OnAdminCommandReport
=================================================
New:
=================================================
01: New lappervars added: (retrieve values from LFS)
mustpit //MustPit is enabled on the server ( Returns 0 or 1)
canvote //Guest may vote kick/ban ( Returns 0 or 1)
canselect //Guest may select track/car ( Returns 0 or 1)
canreset //Guest may reset theire car ( Returns 0 or 1)
midracejoin //Guest may join during a race ( Returns 0 or 1)
cruise //Guest is allowed to drive the wrong way (Returns 0 or 1)
forcedcockpitview //Forced cockpitview ( Returns 0 or 1)
nbofcheckpoints //Number of checkpoints ( Returns 0, 1, 2 or 3) Also works on layouts (Insim checkpoints doesnt count)
timing //Type of Timing:
-Returns 0 : Open config without use checkpoints
-Returns 1 : Normal laptiming ( normal circuit)
-Returns 2 : Custom/AutoX laptiming ( userplaced checkpoints/finishline)
lapperversion //Returns only the lapperversion
lfsversion //Returns version of lfsserver. currently 0.6R
lfsmode //Returns mode of LFSServer (Demo/S1/S2/S3)
02: New Event: OnPlayerFlags (Detects Yellow/Blue flags and Lag/Missing packets)
##########################################################################################
#Action on Event when player receives a Flag (Yellow/Blue flags and Lag/Missing packets).
##########################################################################################
#The Flags below returns 1 or 0 depends on which flag is received by the user
#$YellowFlag: Player receives a YellowFlag
#$BlueFlag : Player recieves a BlueFlag
#$LagFlag : Player is lagging or is missing carpackets
#$Time : ShortTimeFormat,same as GetLapperVar("ShortTime");
##########################################################################################
$PlayerFlagEvent = -1; #Enable Event 1 = ON / -1 = OFF
Event OnPlayerFlags($userName,$YellowFlag,$BlueFlag,$LagFlag,$Time) # Player event
/*
IF( $YellowFlag == 1) THEN
privmsg("^3YELLOW FLAG");
ENDIF
IF( $BlueFlag == 1) THEN
privmsg("^4BLUE FLAG");
ENDIF
IF( $LagFlag == 1) THEN
privmsg("^5LAG");
ENDIF
*/
EndEvent
03: New Event: OnAdminCommandReport (Report admincommands)
######################################################
#Action on entering a admincommand ( "/ commands" )
######################################################
#$userName = username of the player who typed the admincommand.
#$IsAdmin = Is player a admin ( 0 = no admin / 1 = is an admin)
#$Status = Status of command ( 1 - processed / 2 - rejected / 3 - unknown command)
#$Command = Entered command by player
#$Time = Date/Time of action
######################################################
Event OnAdminCommandReport( $userName,$IsAdmin,$Status,$Command,$Time ) # Player event
#Yourcode
EndEvent
04: New Function: InArray(), Check if a value already exist in the current array.
#Array = $TESTARRAY[]
#Value = 7
IF( inarray($TESTARRAY,"7") == 1) THEN
privmsg("^2Does exist");
ELSE
privmsg("^1Does not exist");
ENDIF
05: New Function: Remove(), Remove chars from a string. Old way: Trim( SubStr ());
There are 2 ways to use the function
Remove amount of characters from the string from StartIndex
1 : $NewString = remove($OldString,$StartIndex,$Charstoremove)
or
Remove everything from StartIndex
2 : $NewString = remove($OldString,$StartIndex)
06: New event: OnHostMSO($Text,$Time) (Thanks to LakynVonLegendaus)
#Every messages by the host will be sent to this event.
#DO NOT USE GlobalMsg()!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Event OnHostMSO($Text,$Time)
#YourCode
EndEvent
07: New event: OnPlayerSelectCar($userName,$Car,$Time) # Player event
#This event will execute when a player select a car in the garage
Event OnPlayerSelectCar($userName,$Car,$Time)
#YourCode
EndEvent
08: New event: OnNewJoinRequest # Player event (Thanks to LakynVonLegendaus)
#######################################
#Player sends a join request (Shift+J)#
#######################################
NOTE:
#To enable OnNewJoinRequest event, $ReceiveJoinRequest has to be set to 1.
#If enabled, LFS waits (cca 1 second) for a response from the Lapper on each join request.
#To respond to a join request - use joinrequest() function.
#The Player's unique ID (PLID Must be 0 to use the join request system)
#If no response is sent, LFS spawns the car normally (with a delay [because LFS waits for the join request response]).
#For more info see ..\LFS\docs\InSim.txt
$ReceiveJoinRequest = -1; #Enable (1) or disable (-1) for Receive JoinRequest.
Event OnNewJoinRequest( $userName ) # Player event
/*
$Flags = 0; #Move car (128) else (0)
$X_Axis = 0; #X axis SpawnPoint
$Y_Axis = 0; #Y axis SpawnPoint
$Z_Axis = 0; #Z axis SpawnPoint
$Heading = 0; #Heading of the players car at Spawnpoint
$UCID = GetCurrentPlayerVar("UCID"); #Connection unique ID
$PLID = 0; #GetCurrentPlayerVar("PLID"); #Player's unique ID
###$PLID MUST BE 0 TO USE JOIN REQUEST###
#$JRRAction = 0; # Reject join request.
$JRRAction = 1; # Allow join request.
joinrequest($X_Axis ,$Y_Axis ,$Z_Axis ,$Flags ,$Heading ,$UCID ,$PLID ,$JRRAction); #Send Data to LFS
*/
EndEvent
=================================================
Updates:
=================================================
01: Changed hardcoded visible records in Toplist/UserTop/Drifttop from 24 to 10000
$list = GetListTop( getConfigVar( DefaultTopCar ), 0, 0 );
Note: Users must edit theire script to see the max visible Records. This can be done with a FOR loop: ( $i=0;$i<25;$i=$i+1)
=================================================
Fixes:
=================================================
01: Removed GLobalmsg(); in Layoutlist.LPR. Spammed the chat after paging up or down
02: Didnt retreive RaceInfo from LFS after rebooting Lapper
+-------------------------------+
|Changes from 7.0.4.7 to 7.0.4.8|
+-------------------------------+
-Sort Arrays function
-Several functions to edit strings
-Delete stored values from the database
-Delete userstored values from the database
-New Lappervars
-Set/Get allowed cars on the server.
-Create/Edit/Read/Delete Textfiles.
-Old RemoveZoneAction() bugfix.
-Other Fixes.
-Small updates on errormessages
-Small Sourcecode cleanup.
=================================================
New:
=================================================
01: New Function: Sort() Sort Arrays
Sort(Var,"TypOfSort") Sort Arrays , TypOfSort = DESC or ASC: Sort values descending or ascending
$testArray[0] = A;
$testArray[1] = B;
$testArray[2] = C;
$testArray[3] = D;
$Sortedarray = Sort($testArray,$TypOfSort);
FOR ( $i = 0; $i < 4 ; $i = $i + 1)
privMsg( "^3" . $Sortedarray[$i] );
ENDFOR
02: Delete Stored (Player) Vars from database
DeleteUserStoredValue($userName,"Value"); #Delete user stored values from the database
DeleteStoredValue("Value"); #Delete stored values from the database
03: New Function: SetAllowedCars() Set Allowed cars on the server. (This is not the same as setallowedPlayerCars($username,$Cars))
$Cars = UF1+XRT+UFR;
SetAllowedCars($Cars);
04: New lappervars added: (retrieve values from LFS)
-Wind (returns 0,1 or 2)
-Weather (returns 1,2 or 3)
-RaceLaps (returns number of Laps) Returns 0 IF Hours is set
-RaceHours (return number of Hours) Returns 0 IF Laps is set
-allowedcars (Returns string of cars : UF1+XRT+XFG for example)
05: New function: Contains() Returns 1 or 0
$String = "teststring";
IF (Contains($String,"test") == 1) THEN
#yourcode
ENDIF
06: New function: Replace() Replace chars in a string
$oldstring = "LFSLapper String Test";
privmsg("Old String: ".$oldstring);
$newstring = Replace($oldstring,"","_");
privmsg("New String: ".$newstring);
07: New function: Insert() Insert chars in a string.
$oldstring = "LFSLapper String Test";
privmsg("Old String: ".$oldstring);
$newstring = Insert($oldstring,21," [Extra String]");
privmsg("New String: ".$newstring);
08: Created $TimeFormat var for 12 or 24hour format. used for the following LapperVars
GetLapperVar("ShortTime");
GetLapperVar("LongTime");
//The code below can be found in LFSLapper.LPR
$LongTimeFormat = "HH:mm:ss tt";
$ShortTimeFormat = "HH:mm";
# Used for GetLapperVar("LongTime") and GetLapperVar("ShortTime")
# HH = Hour in 0-23 format
# hh = Hour in 0-12 format
# mm = Minute
# ss = Seconds
# t = A/P "hh:mm:ss t"
# tt = AM/PM "hh:mm:ss tt"
09: Create/Read/Delete Textfiles
#===================================================
#Create textfiles (Include FileExist options) (only .txt extension)
#===================================================
$FileName = "Filename";
$NameofDirectory = "C:\Users\User\Desktop";
$FileExistOption = 0;
What todo if file exist:
0 = no action
1 = overwrite file
2 = overwrite file + create backup file.
CreateFile($FileName,$NameofDirectory,$FileExistOption);
#===================================================
#Delete textfiles (Include copy file option)
#===================================================
$FileName = "Filename";
$NameofDirectory = "C:\Users\User\Desktop";
$NameofCopyDirectory = "C:\Users\User\Desktop\Copy"; #or $NameofCopyDirectory = "";
$Extension = ".txt";
DeleteFile($FileName,$NameofDirectory,$NameofCopyDirectory,$Extension);
#===================================================
#Read file (Possible to read various Filetypes: .log/.txt/.ini/.cfg.lpr)
#===================================================
$LinesofFile = Readfile($Filename,$Folder);
What info you get from file.
-FileSize in bytes
-CreationDate/Time
-ModificationDate/Time
-Number Of lines
-LineNumber
-Text from each line
!!!!EXAMPLE CODE!!!!
$Filename = "TestFile";
$Folder = "C:\Users\Danny\Desktop";
$Extension = ".txt";
$LinesofFile = Readfile($Filename,$Folder,$Extension);
$NrOfLines = ToNum($LinesofFile["NumberOfLines"]);
$FileCreationDate = $LinesofFile["TimeOfCreation"];
$FileModificationTime = $LinesofFile["TimeOfModification"];
$FileSize = $LinesofFile["FileSize"];
privmsg("Reading file: " . $Filename . "" .$Extension);
privmsg("NumberOfLines: " . $NrOfLines . "");
privmsg("Size of file: " . $FileSize . " bytes");
privmsg("Creation time: " . $FileCreationDate . "");
privmsg("Modify time: " . $FileModificationTime . "");
FOR ( $i = 0; $i <= $NrOfLines-1 ; $i = $i + 1)
$linenr = $LinesofFile[$i,"LineNumber"];
$line = $LinesofFile[$i,"Line"];
privmsg("[".$linenr."]: ".$line);
ENDFOR
!!!!!!!!!! USE THE FOR/WHILE LOOP, ONLY FOR THE LINES YOU WANT TO BE DISPLAYED ON YOUR SCREEN !!!!!!!!!!!!!!!!!!!
#===================================================
#Edit file (Possible to edit various Filetypes: .log/.txt/.ini/.cfg/.lpr)
#===================================================
$Filename = "TestFile";
$Folder = "C:\Users\Danny\Desktop";
$NewText = "TESTTEST";
$LineToEdit = -1; # -1 to create a extra line
$Extension = ".txt";
EditFile($Filename,$Folder,$NewText,$LineToEdit,$Extension);
=================================================
Updates:
=================================================
01: Files with LapperVars and LapperConfigvars updated.
02: Deleted !powered command: command became obsolete
03: Few errormessages updates (typo's & imcomplete info).
=================================================
Fixes:
=================================================
01: ToNum(); Wrong error message when PlayerVar is empty.
02: Several RemoveZoneAction() fixes:
-Leave Subroutine still active after removing zone.
-Lappercrash when deleting Zone in not particular order.
03: Several fixes on ErrorMessages (some caused lappercrashes)
04: Error on !ver command. caused by a invalid URL in webcommand
05: Incorrect tracknames from lapper when ShortTrackName contains more than 4 characters.
06: Lappercrash on subStr ($string, 4, 1); when Startindex is larger than the length of the string.
07: Incorrect errormessages for RegisterScheduleAction();
-Returns an errormessage when ID or Sub routine value is empty.
-Returns an errormessage when the time/date field is incorrect.
<?php
CatchEvent OnLapperStart()
#Zone/Node actions in OnLapperStart event
#ZoneID,Track,Node,EnterNode,LeaveNode
RegisterNodeAction( "MyNode", "BL1" , 0 , SA_Test_1, "" );
#ZoneID,Track,X,Y,EnterZone,LeaveZone
RegisterZoneAction( "MyZone", "BL1" , 0,100 , SA_Test_1, "" );
EndCatchEvent
?>
<?php
CatchEvent OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex) # Player event
IF($CircleIndex == 1) THEN
privmsg("Blahblah");
ENDIF
EndCatchEvent
?>
+-------------------------------+
|Changes from 7.0.4.6 to 7.0.4.7|
+-------------------------------+
-Editable DriftTop script !drf
-Editable UserTop script !usertop
-Delete Driftscore from database
-Delete Laptimes from database
-Create streets and get info of current street ID
-Updated Errormessages (ERR Files)
-Location Databases changed
-Deleted some old hardcoded functions
-Retrieve list of layouts from server
-RealTime DriftScore
-Several Fixes: LFSlapper Crashes,Typos,Old Bugs
=================================================
New:
=================================================
01: Driftscore table is now editable. // drifttop.lpr
$list = getlisttopdrift( $argv,$flagQual,$flagNear ); #Get List from database
!drf command in LFSLapper.lpr
02: Usertop table is now editable. // usertop.lpr
$list = getlisttopuser( $value,$flagdesc,$flagNear,$filter ); #Get List from stored database
!usertop command in LFSLapper.lpr
03: New functions. Delete records from database (single one or all)
deletedriftrecords(); #Delete driftscores from current track
deletelaptimerecords(); #Delete laptime records from current track
Options:
-Delete a single record from current track: deletelaptimerecords(Username,Car)
-Delete a specific car from current track: deletelaptimerecords(-,Car)
-Delete a specific username from current track: deletelaptimerecords(username,-)
Commands can be found in: utils.lpr Bin/default/includes/utils.lpr
!dellr = Delete laptime record.
!deldr = Delete driftscore record.
04: New Function: Register Street Action
RegisterStreetAction( name of street,trackname,width of street,coordinates of street(separated by commas), callbackfunctionOnEnter,callbackfunctionOnLeave );
Callback command is executed when a street is entered or left by a player
Example:
RegisterStreetAction( Pitlane boulevard,WE1X,7,-201,233,-201,266,-202,316,-202,353,-202,389,-202,439,-202,487,-202,536,-201,561, EnterStreet, LeaveStreet );
On track WE1X, When Coordinate -201,233 is Reached the Sub EnterStreet is executed.
On track WE1X, When Coordinate -201,561 is Reached the Sub LeaveStreet is executed.
Patch for this function is created by Nick Axworthy.
05: New Playervars: according to the the new function above
currstreet
idcurrstreet
06: Load Layout system
###How to get list of layouts###
-LFSLapper MUST be on the same machine as your LFSServer
-Set Path of layoutfolder in LFSLapper.LPR (Line 207) Example: $LayoutFolder = "C:\LFS_0.6R\data\layout";
-Type !LayoutList (in Utils.LPR) to open the list.
-Click
#Features#
-List with layouts that are currently available on the server.
-No need to be a serveradmin anymore to load a layout(admin management)
-Number of layouts for current track
-LayoutName
-Modification Date
-Creation Date
-Editable script like Usertop/DriftTop
###Script idea's##
-Possible to create a Layout rotator system.
-Create a favo layout window.
-Layout Vote system
07: Realtime Driftscore option
$RealTimeDriftScore = -1; Set 1 to enable this feature.
-This may have effect on Lapper performance with many player in the server.
-Do not use this with the buildin DriftMeter Scripts.
=================================================
Update:
=================================================
01: ErrorMessages updated.
Some examples:
OLD: "Incorrect args number in function: Functionname".
NEW: "Incorrect number of parameters in function: Functionname".
OLD: "Need int in 2nd parameter of: Functionname".
NEW: "2nd parameter of function: Functionname. is not a valid Integer value".
02: Location Databases changed.
-Created a map for the Grip & Drift & StoredValue Databases. You can find them in the 'Databases' folder (Bin/default/Databases)
03: Changed hardcoded visible records in Toplist/UserTop/Drifttop from 18 to 24
=================================================
Fix:
=================================================
01: Lappercrash when LeaveZone/LeaveNode sub-routine is enabled.
02: Lappercrash when adminpass is wrong.
03: Typo in Playervars: GetPlayerVar();
OLD: IPAdress
NEW: IPAddress
OLD: DecimalIPAdress
NEW: DecimalIPAddress
04: Added few non-documented PlayerVars to the PlayerVar list
-NumberPlate
-IsHost
05: Undocumented Lapperfunction
-IsNum(); Check if a Playervar or other variable is a numeric value. (Returns 0 or 1)
#Function Fixes:
06: Round(Var,2) : Weird Errormessage when using it with stored Playervars from the database.
07: RemovePrivDelayedcommand() : Weird errormessage when using this function in the OnDisconnect Event.
=================================================
Removed:
=================================================
01: Several Old hardcoded functions for DriftScoreTable and Usertop
closetop();
top();
near();
topqual();
nearqual();
topuser();
nearuser();
drf();
drfqual();
drfnearqual();
drfnear();
CASE "!plate":
privMsg("^7Your Numberplate: ".GetPlayerVar($userName,"NumberPlate"));
BREAK;
GetCurrentPlayerVar("Plate");
GetPlayerVar( $userName,"Plate" );