<?php
//Convert Short X into 2 bytes
packet[8] = (byte)(X >> 8); //Shift by 8 bits
packet[9] = (byte)(X & 255);
//Convert Short Y into 2 bytes
packet[10] = (byte)(Y >> 8); //Shift by 8 bits
packet[11] = (byte)(Y & 255);
?>
<?php
//Convert Short X into 2 bytes
packet[8] = (byte)((X * 16) & 255);
packet[9] = (byte)((X * 16) >> 8); //Shift by 8 bits
//Convert Short Y into 2 bytes
packet[10] = (byte)((Y * 16) & 255);
packet[11] = (byte)((Y * 16) >> 8); //Shift by 8 bits
?>
<?php
//Convert Short X into 2 bytes
packet[8] = (byte)((X >> 8)/16); //Divide by 16
packet[9] = (byte)((X & 255)/16); //Divide by 16
//Convert Short Y into 2 bytes
packet[10] = (byte)((Y >> 8)/16); //Divide by 16
packet[11] = (byte)((Y & 255)/16); //Divide by 16
?>
Input X/Y Axis >> Output
0-15 >> 0
16 >> 16
17-31 >> 16
32 >> 32
33-47 >> 32
48 >> 48
etc
<?php
$X_Axis = 1; #X axis SpawnPoint
$Y_Axis = 1; #Y axis SpawnPoint
$Z_Axis = 0; #Z axis SpawnPoint
$Flags = 128; #Move car (128) else (0)
$Heading = 30; #Heading of the players car at Spawnpoint
$UCID = 0; #Connection's unique id (0 = host)
$PLID = getcurrentplayervar("PLID"); #Player's unique id
$JRRAction = 5; #Type of action. Reset without repair
joinrequest($X_Axis , $Y_Axis , $Z_Axis , $Flags ,$Heading , $UCID , $PLID ,$JRRAction); #Send Data to LFS
?>
<?php
public void joinrequest(GLScript.unionVal val, ArrayList args)
{
//short X, short Y, byte Zbyte, byte Flags, byte Heading, byte UCID, byte PLID, byte JRRAction
byte[] jrr = myEncoder.JRR(short.Parse(args[0].ToString()), short.Parse(args[1].ToString()), byte.Parse(args[2].ToString()), byte.Parse(args[3].ToString()), byte.Parse(args[4].ToString()), byte.Parse(args[5].ToString()), byte.Parse(args[6].ToString()), byte.Parse(args[7].ToString()));
insimConnection.Send(jrr, jrr.Length);
}
?>
<?php
public byte[] JRR(short X, short Y, byte Zbyte, byte Flags, byte Heading, byte UCID, byte PLID, byte JRRAction) //Join Request Reply - send one of these back to LFS in response to a join request
{
byte[] packet = new byte[16];
packet[0] = 16;
packet[1] = (byte)TypePack.ISP_JRR;
packet[2] = 0;
packet[3] = PLID; //Player's unique id (if zero, use UCID) // ZERO when this is a reply to a join request - SET to move a car
packet[4] = UCID; //Connection's unique id (0 = host) // set when this is a reply to a join request - ignored when moving a car
packet[5] = JRRAction; //JRR Action
packet[6] = 0; //Spare
packet[7] = 0; //Spare
//Convert Short X into 2 bytes
packet[8] = (byte)(X >> 8);
packet[9] = (byte)(X & 255);
//Convert Short Y into 2 bytes
packet[10] = (byte)(Y >> 8);
packet[11] = (byte)(Y & 255);
packet[12] = Zbyte; //Z Pos
packet[13] = Flags; //Flags
packet[14] = 0; //Index
packet[15] = Heading; //Heading
//DebugMessages to see data for each packet (Console)
for (int i = 0; i < 16; i++)
{
Console.WriteLine("Packet: "+ i + " = " + packet[i]);
}
return packet; // send packet to lfs
}
?>
<?php
CASE "!jrr":
$X_Axis = 0; #X axis SpawnPoint
$Y_Axis = 0; #Y axis SpawnPoint
$Z_Axis = 0; #Z axis SpawnPoint
$Flags = 128; #Move 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 = 5; #Type of action.
joinrequest($X_Axis , $Y_Axis , $Z_Axis , $Flags ,$Heading , $UCID , $PLID ,$JRRAction); #Send Data to LFS
BREAK;
?>
########################################################
Fixed Typo's & Changing Pitworks in sourcefile Insim4.cs ( Thanks to Iceman121 for reporting the typo's and idea's)
-Mechanicals Damages >> Mechanical Damage
-Body Dammage >> Minor Damage
Major Damage
-Refuel >> Refuelling
-Wheels & Transmissions >> Wheels
########################################################
Characterlenght increased to 120 chars instead of 67 for the following functions:
Privmsg()
GlobalMsg()
########################################################
Sourcecode bugfix: in GLScript.cs ( Thanks to Yisc[NL] for reporting the bug)
Link of report: https://www.lfs.net/forum/post/1906238#post1906238
########################################################
Sourcecode bugfix (CSC) (CarState Packet) implemented in version 7.0.4.1
LFSLapper crashed after getting player without a username (HOST)
########################################################
Minor bugfixes in LFSLapper.lpr ( Thanks to Yisc[NL] for reporting the bug)
Link of report: https://www.lfs.net/forum/post/1906123#post1906123
GetCurrentPlayerVar( "InstantSpeed" );
CASE "!myspeed":
privmsg("My speed: ".GetCurrentPlayerVar( "InstantSpeed" ). " km/h");
BREAK;
May 13 15:47:52 HoraDoShowPorra^L connected (105DaLeste)
May 13 15:48:00 HoraDoShowPorra^L left the pits (XRG)
May 13 15:48:30 HoraDoShowPorra^L pitted
May 13 15:48:32 HoraDoShowPorra^L left the pits (XRG)
May 13 15:48:32 Modified car - guest disconnected
May 13 15:48:33 Leave @ 1136527 : HoraDoShowPorra
May 13 15:48:33 HoraDoShowPorra^L was kicked (105DaLeste) <<< This is what other guests/admin sees in the server.
<?php
CatchEvent OnLapperStart()
GlobalVar $Rule; #Have Set $Rule[1] - $Rule[16]
GlobalVar $CloseServerRulesOne; #ButtonRow 1
GlobalVar $CloseServerRulesTwo; #ButtonRow 2
$CloseServerRulesOne = "&Close";
$CloseServerRulesTwo = "&Close";
EndCatchEvent
Sub SetServerRules($keyflags,$id)
$AP_HT = 52; #Local Var
closeadminpanelother2(); #A close function
openPrivButton( "ServerRulesChangeTitle",70,$AP_HT+10,60,4,4,-1,96, "^2blablahblah %nl%^2WAAAW new line blablabnla!");
FOR($i=1;$i<17;$i=$i+1)
openPrivButton( "ServerRule_".$i,70,$AP_HT+18,55,4,5,-1,96, "^3".$i.". ".$Rule[ToNum($i)]); #Line of rule
openPrivTextButton( "ServerRuleSet_".$i,125,$AP_HT+18,5,4,5,16, "^3Set ServerRule","^0Set",60,ServerRuleSet); #Set button
$AP_HT=$AP_HT+4; #Buttonheight + 4
#closing vars
$CloseServerRulesOne = $CloseServerRulesOne . "&ServerRule_".$i;
$CloseServerRulesTwo = $CloseServerRulesTwo . "&ServerRuleSet_".$i;
ENDFOR
openPrivButton( "ServerRulesClose",70,$AP_HT+19,60,5,5,-1,16, "^3OK",AdminPanelOther2); #This doesnt work if you copy this code hahah
EndSub
Sub ServerRuleSet( $id, $argv )
$Rule[ToNum(trim(subStr( $id,14 )))] = $argv; #ToNum(trim(subStr( $id,14 ))) = trim first 14 chars and convert it to ToNum()
SetServerRules(0,0);
EndSub
?>
Event OnLapperStart()
#Syntax: ss mm hh dayofweek dd MM YYYY
RegisterScheduleAction( "0 * * * * * *", Timer_Sub ); #Timer each minute
EndEvent
Sub Timer_Sub()
$Players = GetListOfPlayers(); #Get list of all players in the server
FOREACH ($User IN $Players) #Check each player one by one.
setUserStoredValue($User["value"], "Cash", GetPlayerVar($User["value"],"Cash")); #Store Cash to database
ENDFOREACH
EndSub