<?php
OnLapperStart();
?>
<?php
OnConnect( $userName ); #Player joined the server
OnNewJoinRequest( $userName ); #Player request to join the track
OnNewPlayerJoin( $userName ); #Player joined the race
OnDisConnect( $userName, $reason ); #Player left the server
OnLeaveRace( $userName ); #Player left the race (Spectate or Pit)
?>
<?php
OnAcceleration( $userName );
OnAcceleration2( $userName );
?>
<?php
OnPit( $userName );
OnEndPit( $userName );
OnEndPitWindow( $userName );
OnEnterPitLane( $userName, $reason );
OnExitPitLane( $userName );
OnFastDriveOnPitL1( $userName );
OnFastDriveOnPitL2( $userName );
OnMaxFastDriveOnPit( $userName );
OnNotPitWindow( $userName );
OnPlayerSelectCar($userName,$Car,$Time); #Player select a car in the garage
OnChangeTyres( $userName, $FL_Changed, $FR_Changed, $RL_Changed, $RR_Changed );
?>
<?php
OnPBQual( $userName );
OnPracStart( $numP );
OnQualStart( $NumP );
?>
<?php
OnREO ( $NumP, $ReqI, $GridOrder );
OnRaceStart( $NumP );
OnFalseStartL1( $userName );
OnFalseStartL2( $userName );
?>
<?php
OnLap( $userName );
OnMaxAllowedLapTime1( $userName );
OnMaxAllowedLapTime2( $userName );
OnNewGapPlayerBefore( $userName, $split );
OnNewGapPlayerBehind( $userName, $split );
OnChangePos($userName, $lastPos, $currPos);
OnPB( $userName );
OnMaxSessionLaps( $userName );
?>
<?php
OnSpbLast( $userName );
OnSpbSplit1( $userName );
OnSpbSplit2( $userName );
OnSpbSplit3( $userName );
OnSplit1( $userName );
OnSplit2( $userName );
OnSplit3( $userName );
?>
<?php
OnResult( $userName,$flagConfirm );
OnFinish( $userName );
?>
<?php
OnRaceEnd( );
?>
<?php
OnDistDone( $userName );
?>
<?php
OnDriftLap( $userName );
OnDriftPB( $userName );
OnDriftResetScore( $userName );
OnDriftScore( $userName );
OnDriftTooLow( $userName );
OnGoodDrift( $userName );
?>
<?php
OnVoteEndChange($PlayerOnTrack, $Vote, $Need);
OnVoteEndReach($PlayerOnTrack, $Vote, $Need);
OnVoteEndZero();
OnVoteQualifyChange($PlayerOnTrack, $Vote, $Need);
OnVoteQualifyReach($PlayerOnTrack, $Vote, $Need);
OnVoteQualifyZero();
OnVoteRestartChange($PlayerOnTrack, $Vote, $Need);
OnVoteRestartReach($PlayerOnTrack, $Vote, $Need);
OnVoteRestartZero();
?>
<?php
OnIdle1( $userName );
OnIdle2( $userName );
?>
<?php
OnAngleVelocity( $userName );
OnMaxNbInStunt( $userName );
?>
<?php
OnCarReset( $userName );
OnMaxCarResets( $userName );
?>
<?php
OnHostMSO($Text,$Time)
OnMSO( $userName, $text );
OnFlood( $userName );
?>
<?php
OnNotMatchFlags( $userName );
OnAuthAllowed( $userName );
OnAuthNotAllowed( $userName );
OnAuthReached( $userName,$level );
?>
<?php
OnToLowHandicap( $userName );
?>
<?php
OnSwearWords1( $userName );
OnSwearWords2( $userName );
?>
<?php
OnNameChange($userName, $oldNickName, $newNickName);
?>
<?php
OnRotateCar();
OnRotateTrack();
?>
<?php
OnButtonFunction($userName, $SubT);
?>
<?php
OnCarContact($PlayerA,$PlayerB,$PlayerA_Speed,$PlayerB_Speed,$PlayerA_X,$PlayerB_X,$PlayerA_Y,$PlayerB_Y);
?>
<?php
OnObjectHit($userName,$ObjectFlag,$ObjectHitTime,$Object_X,$Object_Y,$Object_Z,$ObjectType,$ObjectInDex);
OnObjectCollision($userName,$ObjectFlag,$ObjectHitTime,$Object_X,$Object_Y,$Object_Z,$ObjectType);
OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex);
?>
+-------------------------------+
|Changes from 7.0.4.4 to 7.0.4.5|
+-------------------------------+
=================================================
New:
=================================================
01 - New Function: Add/Remove Objects
It is possible to add/remove objects up to 30 objects at once
Check the Objectslist.txt in the attachments for the objectslist
Type = Type of object
$Object_One = "19:-654:3:208:175:64"; #X:Y:Z:Flag:Type:Heading
$Object_Two = "20:-654:3:208:175:64"; #X:Y:Z:Flag:Type:Heading
addobject($Object_One,$Object_Two);
removeobject($Object_One,$Object_Two);
If one of the parameters of the object is incorrect, function will abort its action.
In the errorfiles you can see which object is incorrect.
02 - New Function: Distance Measurement between Player <> Player / Player <> Object / Object <> Object
trackuserdistance();
With this function you can display the distance between 2 players or between a other location and a player.
See some examples below.
$TheLocation = "-150:26"; #Var must be a string > "", and X and Y axis must be seperated by a ':'
trackuserdistance($userName,$userName);
trackuserdistance($TheLocation,$userName);
trackuserdistance($userName,$TheLocation);
trackuserdistance($TheLocation,$TheLocation);
trackuserdistance("-150:26","-150:26"); #(X:Y,x:y)
03 - New Event : Get info about the objects you add/removed by autocross editor
$DisplayObjectInfo = -1; #Set -1 to disable this event
Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Flags,$Type,$InDex,$Heading) # Player event
privmsg("^7LayoutAction: ^8".$Action);
privmsg("^7Number of Objects: ^8".$NumO);
privmsg("^7X/Y/Z: ^8".$X."/".$Y."/".$Z);
privmsg("^7Index & Type of Object ^8".$InDex."/".$Type);
privmsg("^7ObjectFlag ^8".$Flags);
privmsg("^7Heading of Object ^8".$Heading);
EndEvent
<?php
RegisterNodeAction( TESTID, getLapperVar( "ShortTrackName" ) , getCurrentPlayerVar("CurrNode") , test,"" );
Sub test($UserName,$ZoneID)
privmsg("ID=".$ZoneID); #output is TESTID
EndSub
?>
<?php
CatchEvent OnLapperStart()
#X:Y:Z:Flag:Type:Heading
GlobalVar $GateOpen; $GateOpen = "19:-654:3:208:175:64";
GlobalVar $GateClosed; $GateClosed = "21:-654:3:5:174:64";
EndCatchEvent
CatchEvent OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex)
#Go to YellowLight sub when driving throught the insimcircle with index=25
IF (($CircleIndex == 25)&&($Flags == 0)) THEN
YellowLight(); #Goto YellowLight Sub
ENDIF
#Go to Closegate sub to close the gate when driving throught the insimcircle with index=26
IF (($CircleIndex == 26)&&($Flags == 0)) THEN
CloseGate( $KeyFlags );
ENDIF
EndCatchEvent
Sub YellowLight()
startlightcontrol(5,149,10,2); #Yellow Startlight, Lightindentifier = 10
HostDelayedCommand( 2, OpenGate); #Go to Open Gate sub after 2 seconds
EndSub
Sub OpenGate( $KeyFlags )
globalmsg("Gate is open");
startlightcontrol(5,149,10,8); #Green Startlight, Lightindentifier = 10
removeobject($GateClosed); #Remove "closed gate" object
addobject($GateOpen); #GateClose
EndSub
Sub CloseGate( $KeyFlags )
globalmsg("Gate is closed");
startlightcontrol(5,149,10,1); #Red Startlight, Lightindentifier = 10
removeobject($GateOpen);#Remove "open gate" object
addobject($GateClosed); #Add object to simulate a closed gate
EndSub
?>
openPrivButton( "lang_en",30,30,4,4,5,-1,32, "^3EN" ,SetLanguage);
<?php
Sub SetLanguage( $KeyFlags,$ButtonID )
#Cut the first 5 chars of the buttonID , result = 'en'
$language = trim( subStr( $ButtonID,5 ) );
#When the value/string of $language is equal to 'en'
IF($language == "en")THEN
SetCurrentPlayerVar("IdLang","en"); #Set player language to English
ENDIF
EndSub
?>
openPrivButton( "example",75,111,50,10,5,-1,ISB_DARK, langEngine("%{example}%"));
Lang "EN"
example = "This text is an exampletext";
EndLang
<?php
#################################################
#Action when a predefined dist is done by player#
# Minimum dist is 100 meters
# -1 deactivate this feature
#################################################
$distToDo = 100;
Event OnDistDone( $userName ) # Player event
EndEvent
?>
SetPlayervar($userName,"DistXFG",(GetPlayerVar($userName,"DistXFG")+$distToDo));
SetStoredValue("varname", $value) - sets a variable
GetStoredValue("varname") - returns variable as a string
GetStoredNum("varname") - returns variable as a numeric (or as -1 if it's not a number), so you don't need to do a ToNum($var) conversion if you're doing numeric comparisons
SetUserStoredValue($username, "varname", $value) - Sets a variable
GetUserStoredValue($username, "varname") - returns variable as a string
GetUserStoredNum($username, "varname") - returns variable as a numeric
openPrivButton( "totaldistance",75,111,50,10,5,-1,ISB_DARK, GetPlayerVar($userName,"DistXFG");
<?php
###################################
#Event triggered when lapper start#
###################################
Event OnLapperStart()
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 )
CASE "!loopoff":
$Loop_On = 0;
$Racers = GetListOfPlayers("U");
FOREACH( $Var IN $Racers )
closeButton( $Var["value"], "speed");
ENDFOREACH
BREAK;
CASE "!loopon":
$Loop_On = 1;
globalmsg("execute sub Set_Loop()");
Set_Loop();
BREAK;
ENDSWITCH
EndEvent
Sub Set_Loop()
IF ($Loop_On == 1) THEN
$Racers = GetListOfPlayers("U");
FOREACH( $Var IN $Racers ) #For each player in the server
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
?>
<?php
$DisplayObjectInfo = 1;
CatchEvent OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Flags,$Type,$InDex,$Heading) # Player event
privmsg("^7LayoutAction: ^8".$Action);
privmsg("^7Number of Objects: ^8".$NumO);
privmsg("^7X/Y/Z: ^8".$X."/".$Y."/".$Z);
privmsg("^7Index & Type of Object ^8".$InDex."/".$Type);
privmsg("^7ObjectFlag ^8".$Flags);
privmsg("^7Heading of Object ^8".$Heading);
EndCatchEvent
CatchEvent 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
#TEST COMMAND
SWITCH( $command )
CASE "!opengate":
OpenGate();
BREAK;
CASE "!closegate":
CloseGate( $KeyFlags );
BREAK;
ENDSWITCH
EndCatchEvent
CatchEvent OnCrossingChecker($userName,$Flags,$Time,$Object,$UserSpeed,$CircleIndex)
IF (($CircleIndex == 25)&&($Flags == 0)) THEN
OpenGate();
HostDelayedCommand( 3, CloseGate); #Go to Close gate sub
ENDIF
EndCatchEvent
Sub OpenGate()
globalmsg("Gate is open");
startlightcontrol(5,149,10,8); #Green Startlight
$X = 19; $Y = -654; $Z = 3; $TypeOfObject = 175; $HeadingOfObject = 64; $Flag = 208; #Info about object
removeobject(21,-654,3,5,174,195); #Remove opengate
addobject($X,$Y,$Z,$Flag,$TypeOfObject,$HeadingOfObject); #GateClosed
EndSub
Sub CloseGate( $KeyFlags )
globalmsg("Gate is closed");
startlightcontrol(5,149,10,1); #Red Startlight
$X = 21; $Y = -654; $Z = 3; $TypeOfObject = 174; $HeadingOfObject = 64; $Flag = 5; #Info about object (Closed gate)vc
addobject($X,$Y,$Z,$Flag,$TypeOfObject,$HeadingOfObject); #Add object to simulate a closed gate
removeobject(19,-654,3,208,175,64); #Remove "open gate "object
EndSub
?>
$Action: 1 = Addobject / 2 = remove object
$NumO = Number of objects you have selected
$Index = Index Number ( See first post in attachment)
$Type = Type of Object ( See first post in attachment)
<?php
$DisplayObjectInfo = -1;
Event OnObjectInfo($userName,$NumO,$Action,$X,$Y,$Z,$Type,$InDex,$Heading) # Player event
privmsg("^7LayoutAction: ^8".$Action);
privmsg("^7Number of Objects: ^8".$NumO);
privmsg("^7X/Y/Z: ^8".$X."/".$Y."/".$Z);
privmsg("^7Index & Type of Object ^8".$InDex."/".$Type);
privmsg("^7Heading of Object ^8".$Heading);
CatchEvent
?>
addobject($X,$Y,$Z,$TypeOfObject,$HeadingOfObject);
removeobject($X,$Y,$Z,$TypeOfObject,$HeadingOfObject);
<?php
################################
#Adding objects example
################################
$X = getcurrentplayervar("X");
$Y = getcurrentplayervar("Y");
$Z = getcurrentplayervar("Z");
$TypeOfObject = 128; #type of Object (Long Bump)
$HeadingOfObject = 130;
#Up to 30 objects
addobject($X,$Y,$Z,$TypeOfObject,$HeadingOfObject, #object 01
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject, #object 02
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject, #object 03
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject, #object 04
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject, #etc
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject);
################################
#delete objects example
################################
NOTE: To remove an object you must know the location and type of the object.
$X = getcurrentplayervar("X");
$Y = getcurrentplayervar("Y");
$Z = getcurrentplayervar("Z");
$TypeOfObject = 128; #type of Object (Long Bump)
$HeadingOfObject = 130;
#Up to 30 objects
removeobject($X,$Y,$Z,$TypeOfObject,$HeadingOfObject, #object 01
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject, #object 02
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject, #object 03
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject, #object 04
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject, #etc
$X=$X+2,$Y,$Z,$TypeOfObject,$HeadingOfObject);
?>