+-------------------------------+
|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" );
Sub OnConnectCloseKick( $KeyFlags,$id )
closePrivButton("welc&pos&clos&ref");
cmdLFS("/kick " . GetCurrentPlayerVar("UserName") );
EndSub
<?php
###################################
#Event triggered when lapper start#
###################################
Event OnLapperStart()
#Create Global variables
Globalvar $Loop_On; $Loop_On = 0;
EndEvent
#################
#Command actions#
#################
Event 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 )
#Stop loop & close button for all players
CASE "!loopoff":
$Loop_On = 0;
#Get list of players sorted by Username
$Racers = GetListOfPlayers("U");
#FOREACH Loop
FOREACH( $Var IN $Racers )
closeButton( $Var["value"], "speed");
ENDFOREACH
BREAK;
#Start loop
CASE "!loopon":
$Loop_On = 1;
globalmsg("execute sub Set_Loop()");
Set_Loop(); #Goto Set_Loop Sub-routine
BREAK;
ENDSWITCH
EndEvent
Sub Set_Loop()
IF ($Loop_On == 1) THEN
#Get list of players sorted by Username
$Racers = GetListOfPlayers("U");
FOREACH( $Var IN $Racers ) #For each player in the server
#$Var["value"] = Username
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").")");
DelayedCommand( 1, Set_Loop); #1 second delay
ENDFOREACH
ENDIF
EndSub
?>