<?php
public void TestFunction(GLScript.unionVal val, ArrayList args)
{
infoPlayer currInfoPlayer = newCfg.getCurrInfoPlayer();
string ident = val.nameFunction;
string text = "^J☆";
SendMsgToConnection(currInfoPlayer.UCID, text);
//SendMsg(args[0].ToString());
}
void SendMsgToConnection(int UCID, string msg)
{
if (msg.Length > 0)
{
if (UCID != -1)
{
byte[] outMsg = myEncoder.MTC(UCID, 0, msg);
insimConnection.Send(outMsg, outMsg.Length);
}
}
}
?>
<?php
#Normal plain text from the sourcecode
SendMsgToConnection(currInfoPlayer.UCID, "Blah Blah");
#Get Player info that is saved.
SendMsgToConnection(currInfoPlayer.UCID, currInfoPlayer.nickName);
void SendMsgToConnection(int UCID, string msg)
{
if (msg.Length > 0)
{
if (UCID != -1)
{
byte[] outMsg = myEncoder.MTC(UCID, 0, msg);
insimConnection.Send(outMsg, outMsg.Length);
}
}
}
?>
//0x8199(HEX) 0x2606(DEC) #WHITE STAR
privmsg(GetPlayerVar($userName,"NickName"));
<?php
public byte[] MTC(int UCID, int PLID, string msg)
{
int msgLen = msg.Length > 127 ? 127 : msg.Length;
byte[] packet = new byte[136];
packet[0] = 136;
packet[1] = (byte)TypePack.ISP_MTC;
packet[2] = 0;
packet[3] = 0;
packet[4] = (byte)UCID;
packet[5] = (byte)PLID;
packet[6] = 0;
packet[7] = 0;
InSim.CodePage.GetBytes(msg, 0, System.Math.Min(127, msg.Length), packet, 8);
return packet;
}
?>
//Get last char of shorttrackname
string GetShortNameTrack = track.Substring(cp.Length - 1, 1);
//Read last char
if ((GetShortNameTrack == "X") || (GetShortNameTrack == "R") || (GetShortNameTrack == "Y"))
GetTrack = track.Substring(0, cp.Length - 1);
else
GetTrack = track.ToUpper();
$Number = 1;
$Racers = GetListOfPlayers("U");
FOREACH( $Var IN $Racers ) #For each player in the server
privmsg("^3[".$Number."] ^7".$Var["value"]); #Current Number + UserName of Player
$Number = $Number + 1;
ENDFOREACH
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
#New Lappervar:
-lapperversion //Returns the current version of LFSLapper.
(could be used to protect your script against older lapperversions).
+--------------------------------+
|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