##########################################################
#Actions to do when Car's State is changed#
##########################################################
#When $StateOfCar(bits) returns a value
#CSC_STOP, //0 Car stopped
#CSC_START, //1 Car started moving
Event OnCarStateChanged($userName,$StateOfCar)
/*
IF($StateOfCar == 0)THEN
globalmsg(getplayervar($userName,"NickName")."^7 Stopped the car!");
ENDIF
IF($StateOfCar == 1)THEN
globalmsg(getplayervar($userName,"NickName")."^7 Start driving!");
ENDIF
*/
EndEvent
CatchEvent OnLapperStart()
RegisterzoneAction( "BL1" , -60,106,4, CarShop, "");
#-60 = X-Coordinate
#106 = Y-Coordinate
#4 = width of your location
EndCatchEvent
Sub CarShop($userName)
IF (BLABLA) THEN
#Write your code here
ENDIF
EndSub
CASE "!addcheckpoint":
$X1=GetCurrentPlayerVar("X"); #Own X coordinate
$Y1=GetCurrentPlayerVar("Y"); #Own Y coordinate
$X2= -60; #CarShop Location X coordinate
$Y2= 106; #CarShop Location Y coordinate
$distX = $X1 - $X2;
$distY = $Y1 - $Y2;
$distuser = ($distX*$distX) + ($distY*$distY); #Calculate distance between You and The CarShop.
privmsg("^8Distance between you and the location: ^3" .$distuser. "^8 Meters");
BREAK;
CASE "!addcheckpoint":
$CPX = GetCurrentPlayerVar("X"); #Get X-axis from player
$CPY = GetCurrentPlayerVar("Y"); #Get Y-axis from player
cmdLFS("/msg ^6›^7New Checkpoint is : ^0(^2X= ".$CPX."^7/^2Y= ".$CPY."^0)" );
RegisterzoneAction( getLapperVar( "ShortTrackName" ), $CPX,$CPY,4, FoundCheckPoint, "");
BREAK;
Sub FoundCheckPoint( $userName )
#Your code when a player drives throught the zone.
EndSub
$X1=GetPlayerVar( $Player1, "X" ); #Own X coordinate
$Y1=GetPlayerVar( $Player1, "Y" ); #Own Y coordinate
$X2=GetPlayerVar( $Player2, "X" ); #User2 X coordinate
$Y2=GetPlayerVar( $Player2, "Y" ); #User2 Y coordinate
$distX = $X1 - $X2;
$distY = $Y1 - $Y2;
$distuser = ($distX*$distX) + ($distY*$distY); #Calculate distance between user
+-------------------------------+
|Changes from 7.0.3.0 to 7.0.4.0|
+-------------------------------+
1. New Lapperfunction:
startlightcontrol(5,149,1,1); #Control AutoX StartLights // More info in 'Control StartLights.txt' in 'Docs' folder. includes Examplecode
2. Renamed/added Objects for $DetectHitobject var.
Changed: All_Railings' renamed to 'All_Armco
Add: Railing
[Add]OCO Packet(Startlight Control) (Test)
[Change]ObjectHit: All_Railings' renamed to 'All_Armco'
startlightcontrol(5,149,1,1);
startlightcontrol($LightAction,$LightIndex,$LightIndentifier,$LightColor);
Be sure those vars are GlobalVars.
#4 = OCO_LIGHTS_RESET, // give up control of all lights
#5 = OCO_LIGHTS_SET, // use Data byte to set the bulbs
#6 = OCO_LIGHTS_UNSET, // give up control of the specified lights
AXO_START_LIGHTS (149) or STARTLIGHTS_TRACK (240)
STARTLIGHTS_TRACK(240) AXO_START_LIGHTS(149)
0 = off 0 = off
1 = red1 1 = red
2 = red2 2 = amber
4 = red3 -
8 = green 8 = green
if (newCfg.varsLapper.DetectHitObject.Contains("TrackSide_Objects") && (obh.Index == 0)) //(Scenery Objects)
+-------------------------------+
|Changes from 7.0.1.0 to 7.0.3.0|
+-------------------------------+
1. LapperInsimVersion changed to Version 7 (Thanks to Yisc[NL])
2. New Events:
Event OnCarContact($PlayerA,$PlayerB,$PlayerA_Speed,$PlayerB_Speed,$PlayerA_X,$PlayerB_X,$PlayerA_Y,$PlayerB_Y) # Player event
Event OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex) # Player event
3.New PlayerVar:
Z, //Height of player on track
+-------------------------------+
|Changes from v6.014 to 7.0.1.0 |
+-------------------------------+
1. New player vars (case sensitive):
ObjectContactSpeed, //Speed of player when hitting a object
ObjectContactHead, //Heading of player when hitting a object
ObjectContactDir, //Direction of player when hitting a object
AccelerationStartSpeed2, // Min value for the acceleration feature relative to user unit km or mph
AccelerationEndSpeed2, // Max value for the acceleration feature relative to user unit km or mph
AccelerationTime2, // Acceleration time achieved from start to end speed
2. New Lapper Vars
$AccelerationStartSpeed2 = 100; # At which speed to start measuring time. In km/h
$AccelerationEndSpeed2 = 160; # At which speed to stop measuring time. In km/h
$AccelerationStartSpeedMph2 = 60; # At which speed to start measuring time. In Mph
$AccelerationEndSpeedMph2 = 100; # At which speed to stop measuring time. In Mph
$AccelerationPrivateMaxTime2 = 10; # Maximum acceleration time in seconds to show message
$DetectHitObject = ""; #To get objectstrings for detection look at docs/ObjectHit.txt
3. New Events:
Event OnAcceleration2( $userName ) # Player event
Event OnObjectHit($userName,$ObjectFlag,$ObjectHitTime,$Object_X,$Object_Y,$Object_Z,$ObjectType) # Player event
Update: -Add Circleindex to OnCrossingChecker event.
-Version numbering is changed. Last number is now for small codechanges like bugfixes etc.
byte[] inSimInit = myEncoder.ISI(adminPassword, 0, 0, nameApp, isLocal);
try
{
this.Send(inSimInit, inSimInit.Length);
}
/////////////////////////////////////////////////////////////////////////////////////
public byte[] ISI(string adminPass, int portNum, byte mciSeconds, string nameApp, bool local)
{
byte[] packet = new byte[44];
packet[0] = 44;
packet[1] = (byte)TypePack.ISP_ISI;
packet[2] = 1;
packet[3] = 0;
// Port
packet[4] = (byte)(portNum % 256); // LSB
packet[5] = (byte)(portNum / 256); // MSB
// Flags
if (local)
packet[6] = (byte)ISF.MCI | (byte)ISF.LOCAL | (byte)ISF.OBH | (byte)ISF.CON; // LSB
else
packet[6] = (byte)ISF.MCI | (byte)ISF.OBH | (byte)ISF.CON; // LSB
packet[7] = 7; //Insim Version
packet[8] = 0;
packet[9] = (byte)'!';
// Number of milli seconds between NLP or MCI packets (0=none)
packet[10] = 100; // LSB
packet[11] = 0; // MSB
System.Text.Encoding.ASCII.GetBytes(adminPass, 0, Math.Min(adminPass.Length, 16), packet, 12);
System.Text.Encoding.ASCII.GetBytes(nameApp, 0, Math.Min(nameApp.Length, 16), packet, 28);
return packet;
}
//request version Not Need in insim 4, because ISI send This
// byte[] verreq = InSim.Encoder.VER();
// this.Send(verreq, verreq.Length);
//retr version info
$DetectHitObject = ""; #To get objectstrings for detection look at docs/ObjectHit.txt
$MaxCarResets = 0;
privmsg("Your Text here"); # Send text to player
globalMsg("Text Here");#Send text to all players