CASE "!jrr":
$X_Axis = getcurrentplayervar("X"); #X axis SpawnPoint
$Y_Axis = getcurrentplayervar("Y"); #Y axis SpawnPoint
$Z_Axis = getcurrentplayervar("Z"); #Z axis SpawnPoint
$Flags = 128; #Move/Reset car (128) else (0)
$Heading = 0; #Heading of the players car at Spawnpoint
$UCID = 0; #Connection's unique id (0 = host)
$PLID = getcurrentplayervar("PLID"); #Player's unique id
$JRRAction = 4;
IF(GetPlayerVar($userName,"OnTrack") == 1)
THEN
IF ( GetCurrentPlayerVar( "InstantSpeed" ) < 1 )
THEN
$Message = " ```fix\n (". GetCurrentPlayerVar("UserName").") aracını yeniledi. >> (". GetLapperVar ( "LongTime" ) .") ``` ";
$DiscordChannel = "1206604043112157214";
sendmessagetodiscord($DiscordChannel,$Message);
privMsg( GetCurrentPlayerVar("NickName") . " ^7Araç yenileme başarılı.");
joinrequest($X_Axis , $Y_Axis , $Z_Axis , $Flags ,$Heading , $UCID , $PLID ,$JRRAction); #Send Data to LFS
ELSE
privmsg("^3Command abort: Stop the car!");
ENDIF
ELSE
privmsg("^1You cannot use this command in spectatormode");
ENDIF
BREAK;
2/13/2024 7:30:00 PM -> Syntax error: in file ".\default\.\includes\.\RallySystem\Scripts\NewTimes.LPR" at line #212
ERROR on Function: 'EditFile', ERROR on Function: 'EditFile', File is empty: [0] lines detected, you cant edit any lines.
Function 'writetofile' script aborted
Sub WriteToFile()
$SaveStageCount = arrayCount($SaveStageTimesStage);
Globalmsg("^4DEBUG: ^8Start WriteToFile() With ^3".$SaveStageCount." ^8Veh/Stage Combo's");
IF($SaveStageCount > 0) THEN
FOR ( $x = 0; $x < ToNum($SaveStageCount) ; $x = $x + 1)
$SaveTimeStage = $SaveStageTimesStage[ToNum($x)];
$SaveTimeVeh = $SaveStageTimesVeh[ToNum($x)];
Globalmsg("^2DEBUG: ^8[".$x."] ^8Vehicle: ".$SaveTimeVeh." / Stage: ". $SaveTimeStage);
IF(($SaveTimeStage != "") && ($SaveTimeVeh != "")) THEN
#Globalmsg("^3DEBUG: ^8WriteToFile() Loop ".$SaveTimeStage." / ".$SaveTimeVeh." || ^3".$CountTimesOfCar[ToNum($SaveTimeStage),$SaveTimeVeh]);
$StageDir = $StageTimes_Dir . "/Stage_" . $SaveTimeStage; #RallySystem\StageData\TrackConfig\NameOfTimeTable\Stage_X
#Verify if vehiclefile for current stage exist
IF (FileExist($StageDir,$SaveTimeVeh,".txt") == 1) THEN
#Get information about the vehicle file.
$TimeInfoFromFile = ReadFile($SaveTimeVeh,$StageDir,".txt");
$MaxFileRecords = $TimeInfoFromFile["NumberOfLines"];
$ArrayCount = ToNum($CountTimesOfCar[ToNum($SaveTimeStage),$SaveTimeVeh]);
globalmsg("^3DEBUG: Records in File [Stage ".$SaveTimeStage."/".$SaveTimeVeh."]: ^3".$MaxFileRecords." ^0/ ^6".$ArrayCount);
$RecordsWritten = 0;
$Deletedlines = 0;
FOR ( $Pos = 0; $Pos < ToNum($ArrayCount); $Pos = $Pos + 1)
$GetRecordInfo = $TimeOfCar[ToNum($Pos),ToNum($SaveTimeStage),$SaveTimeVeh,"Info"]."";
#Ignore if $getRecordInfo is empty. This line wont be saved to the timefile
IF($GetRecordInfo != "") THEN
$RecordsWritten = $RecordsWritten + 1;
globalmsg("^3DEBUG: WriteToFile() Write/Array ".$RecordsWritten." <> ".$MaxFileRecords);
IF(ToNum($RecordsWritten) > ToNum($MaxFileRecords))THEN
#If current list of records is larger than the list of records from current timefile, create a new line.
EditFile($SaveTimeVeh,$StageDir,$GetRecordInfo,-1,".txt"); #NewLine
globalmsg("^3DEBUG: ^8New Record ");
ELSE
#Overwrite every record.
EditFile($SaveTimeVeh,$StageDir,$GetRecordInfo,$RecordsWritten,".txt"); #NewLine
globalmsg("^3DEBUG: ^8Record Overwritten");
ENDIF
ELSE
globalmsg("^3DEBUG: Warning >> ^8NO DATA: ".$SaveTimeVeh." / ".$SaveTimeStage." / ".$Pos);
ENDIF
ENDFOR
IF( $RecordsWritten > 0) THEN
#Delete Records that exceed the maximum records for the current vehicle/stage combo (Records can be deleted by player in !times)
IF(ToNum($RecordsWritten) < ToNum($ArrayCount)) THEN
FOR ( $Line = $ArrayCount-1; $Line >= ToNum($TotalRecordsWritten) ; $Line = $Line - 1)
EditFile($SaveTimeVeh,$StageDir,-1,$Line,".txt"); #NewLine
$Deletedlines = $Deletedlines + 1;
ENDFOR
ENDIF
ENDIF
Globalmsg("^3DEBUG: ^8Total Lines Written/Deleted [Stage ".$SaveTimeStage."/".$SaveTimeVeh."]: ^2".$RecordsWritten."^0/^1".$Deletedlines);
ELSE
Globalmsg("^3ERROR: ^8Cannot save stagetime: ^3[Stage ".$SaveTimeStage."/".$SaveTimeVeh."], ^7Contact admin!");
ENDIF
ENDIF
ENDFOR
Globalmsg("^3DEBUG: ^8Clear/Reset $SaveStageTimesStage & $SaveStageTimesVeh Array + Counter");
UnSet($SaveStageTimesStage);
UnSet($SaveStageTimesVeh);
$SaveStageTimesCounter = 0;
#LogSystem
$ConvertShortDate = Replace(GetLapperVar( "ShortDate" ),"/","-");
$NewLine = StripLFSColor("".GetLapperVar( "ShortDate" )."-".GetLapperVar( "ShortTime" ) ."|TIMES| Scheduled task to save stagetimes to file");
EditFile($ConvertShortDate,$Insim_Log_Dir,$NewLine,-1,".txt"); #NewLine
#Globalmsg("^3DEBUG: ^8WriteToFile() Finished");
ENDIF
EndSub
at LFSLapper.LFSClient.cmdlfs(unionVal val, ArrayList args) = cmdLFS() function
at LFSLapper.LFSClient.managePacket(NCN newConnection) = Event OnConnect
IF(GetPlayerVar($userName,OnTrack) == 1)
THEN
#Player on track
ELSE
#Player NOT on Track
ENDIF
CASE "!pm":
IF( $argv != "" ) THEN
$idxSpace = indexOf( $argv, " ");
IF( $idxSpace != -1 ) THEN
$User = subStr( $argv,0,$idxSpace );
#Check if Player is online on the server.
$currPly = getPlayerInfo($User);
IF( $currPly != "" ) THEN
$Message = trim( subStr( $argv,$idxSpace ) );
privMsg( $User , "^1[PM] ^7". $userName . " ^0>> ^3" . $Message);
privMsg("^1[Private Message] ^7". $User . " ^0>> ^3" . $Message);
ELSE
privMsg ( "^7Player does not exist");
ENDIF
ELSE
privMsg ( "^7Incomplete command: !pm <username> <Message>" );
ENDIF
ELSE
privMsg ( "^7Incomplete command: !pm <username> <Message>" );
ENDIF
BREAK;
Soundoption for globalmsg(); / privmsg();
NOTE: is compatible with older scripts.
0 = No Sound
1 = Message Sound
2 = SystemMessage Sound
3 = InvalidKey Sound
4 = ERROR Sound
5 = NUM Sound
-Possible options for globalmsg() :
globalmsg("BLAHBLAH");
globalmsg("BLAHBLAH",0);
-Possible options for privmsg() :
privmsg("BLAHBLAH");
privmsg("BLAHBLAH",0);
privmsg($userName,"BLAHBLAH");
privmsg($userName,"BLAHBLAH",0);
IF($argv != "") THEN
#Getlistofplayers
$ListOfPlayers = GetListOfPlayers();
FOREACH ($Player in $ListOfPlayers)
$User = $Player["value"];
###Send message if a user is an admin
IF( UserisAdmin($User) == 1 )THEN
privmsg($User,"-----------------------------------");
privmsg($User,$userName." send a adminmessage");
privmsg($User,$argv);
privmsg($User,"-----------------------------------");
ENDIF
ENDFOREACH
ELSE
privmsg("Message not detected, correct syntax: !a <message>");
ENDIF
BREAK;