#getplayerinfo(); : Get playerinfo:
#SetPlayerVar(); : Set PlayerVars:
#GetPlayerVar(); : Get PlayerVars:
#setcurrentplayervar(); : Set PlayerVar
#getcurrentplayervar(); : Get PlayerVar
PrivDelayedCommand();
Sub cl($keyflags)
Endsub
Sub cl2($keyflags)
EndSub
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 "!1":
IF ( UserIsAdmin( $userName ) == 1 )
THEN
startlightcontrol (5,149,1,1);
HostDelayedCommand( 3,cl);
ENDIF
BREAK;
ENDSWITCH
EndEvent
Sub cl()
openGlobalButton( "winner_title",78,137,63,19,4,3,3,"READY ");
startlightcontrol (5,149,1,2);
HostDelayedCommand( 3,cl2);
EndSub
Sub cl2()
openGlobalButton( "winner_title2",78,137,63,19,4,3,3,"GO ");
startlightcontrol(5,149,1,8);
EndSub
trackuserdistance($userName,$userName);
trackuserdistance($TheLocation,$userName);
trackuserdistance($userName,$TheLocation);
trackuserdistance($TheLocation,$TheLocation);
trackuserdistance("-150:26","-150:26"); #(X:Y,x:y)
<?php
CASE "!tud":
$TheLocation = "-150:26"; # X : Y (BL1 at the parking behind the pitlane)
privmsg("^8Distance between ^3The location^8 & ^3" .$userName."^8 = ^2". trackuserdistance($TheLocation,$userName). " ^8meters");
BREAK;
?>
<?php
addobject($X,$Y,$Z,$Flag,$Type,$Heading, #object 01
$X,$Y,$Z,$Flag,$Type,$Heading, #object 02
?>
<?php
$Cone= $X.":".$Y.":".$Z.":".$Flag.":".$Type.":".$Heading;
$Cone_two= $X.":".$Y.":".$Z.":".$Flag.":".$Type.":".$Heading;
$Cone_three= $X.":".$Y.":".$Z.":".$Flag.":".$Type.":".$Heading;
addobject($Cone,$Cone_two,$Cone_three);
?>
<?php
==================================================
#Track distance between players.
TrackUserDistance($userName,$userName);
#Track distance between objects or object<>player
$CarShop = "-465:234" #(X | Y)
TrackUserDistance($CarShop,$userName);
#Lets say the distance between the player and the carshop is 10 meters
privmsg("Distance between you and the carshop:" .TrackUserDistance($CarShop,$userName). " meters");
output: Distance between you and the carshop: 10 meters
==================================================
?>
<?php
##################################################
#getplayerinfo() : Get playerinfo:
#You can use this in an Event or a Sub:Sub subname($userName)
##################################################
$currPly = getplayerinfo($userName );
$currPly[ idOfVar ];
==================================================
$CurrPly = GetPlayerInfo( $userName ); # Set var to get playerinfo
IF( $CurrPly["userName"] != "" ) THEN # Retrieves data from the player.
#Retrieves player Var Nickname and Username
privmsg("Nickname: ". $CurrPly["nickName"]."/ Username:(".$CurrPly["userName"].")" );
#Output
output: Nickname: Nickname/ Username:(Username)
#Set PlayerVar
$CurrPly["playervar_one"] = 12; # Set a player Var
privmsg("Playervar: ".$CurrPly["playervar_one"]);
#Output
output: Playervar: 12
ELSE
privmsg("Player is not in the server");
ENDIF
==================================================
##################################################
#SetPlayerVar() : Set PlayerVars:
#GetPlayerVar() : Get PlayerVars:
##################################################
SetPlayerVar($username ,"idOfVar", $Value);
GetPlayerVar($username ,"idOfVar");
==================================================
SetPlayerVar($username ,"VarOne", 23);
privmsg("Value of this playervar: ".GetPlayerVar($username ,"VarOne"));
output: Value of this playervar: 23
==================================================
##################################################
#setcurrentplayervar(); Set PlayerVar
#getcurrentplayervar(); Get PlayerVar
##################################################
Setcurrentplayervar("idOfVar", $Value);
Getcurrentplayervar("idOfVar");
==================================================
Setcurrentplayervar("VarOne", 20);
privmsg("Value of current playervar: ".Getcurrentplayervar("VarOne"));
output: Value of current playervar: 20
==================================================
?>
========================================
#List of LFSLapper functions
========================================
<?php
================================================================================
#File Functions
================================================================================
#Create a file
CreateFile( $FileName, $Directory, $Action);
#Read File (Creates a array)
ReadFile( $FileName, $Directory, $Extension);
$LinesofFile = ReadFile( $FileName, $Directory, $Extension);
$NrOfLines = $LinesofFile["NumberOfLines"];
FOR ( $i = 0; $i < $NrOfLines ; $i = $i + 1)
$Lin = $LinesofFile[$i,"Line"];
ENDFOR
#Delete File
DeleteFile( $Filename, $Directory, $BackupFolder, $Extension);
#Edit File
EditFile( $FileName, $Directory, $Text, $LineToEdit, $Extension);
#File Exist
IF ( FileExist( $Directory, $FileName, $Extension) == 1) THEN
#Your code when file exist
ENDIF
?>
<?php
=========================================================
# OnConnect( $userName )
=========================================================
Event OnConnect( $userName ) #Player joined the server
privmsg("^3Welcome ".GetPlayerVar($userName,"NickName")." ^8(".$userName.")"); #Send private message to user
globalmsg("^3>".GetPlayerVar($userName,"NickName")." ^8(".$userName.") ^7joined the server"); #Send private message to user
EndEvent
=========================================================
# OnDisConnect( $userName, $reason )
=========================================================
#It is not possible to show the nickname in the OnDisConnect event. That because the user is already disconnected before the event is executed
Event OnDisConnect( $userName, $reason ) #Player left the server
IF( $reason == LEAVR_DISCO ) THEN #Normal Disconnect
globalmsg("^7User disconnected: ".$userName); #Globalmsg()
ENDIF
IF( $reason == LEAVR_LOSTCONN ) THEN #Lost connection
globalmsg("^7User lost connection: ".$userName);
ENDIF
IF( $reason == LEAVR_KICKED ) THEN #User Kicked from server
globalmsg("^7User kicked: ".$userName);
ENDIF
IF( $reason == LEAVR_BANNED ) THEN #User Banned from server
#Blah
ENDIF
IF( $reason == LEAVR_TIMEOUT ) THEN #Lost connection (Lag)
#Blah
ENDIF
IF( $reason == LEAVR_SECURITY ) THEN #Cheat protection
#Blah
ENDIF
IF( $reason == LEAVR_CPW ) THEN #Cheat protection
#Blah
ENDIF
IF( $reason == LEAVR_OOS ) THEN #Out of Sync With Host (mods)
#Blah
ENDIF
IF( $reason == LEAVR_JOOS ) THEN #join OOS (initial sync failed)
#Blah
ENDIF
IF( $reason == LEAVR_HACK ) THEN #Invalid Packets
#Blah
ENDIF
EndEvent
=========================================================
# OnNewPlayerJoin( $userName )
=========================================================
Event OnNewPlayerJoin( $userName ) #Player joined the race
globalmsg("^3>".GetPlayerVar($userName,"NickName")." ^7joined the track with ^8(".GetPlayerVar($userName,"Car").")");#Display message about the car of the user
EndEvent
=========================================================
# OnLeaveRace( $userName )
=========================================================
Event OnLeaveRace( $userName ) #Player left the race (Spectate or Pit)
globalmsg("^3>".GetPlayerVar($userName,"NickName")." ^7left the race");
EndEvent
?>
Event OnConnect( $userName ); #Player joined the server
EndEvent
$Cars = XFG+XRG+FBM; #Cars that will be allowed for this user.
AllowedPlayerCars($UserName,$Cars); #Function that set the allowed cars for this user
<?php
Event OnConnect( $userName ); #Player joined the server
$Cars = XFG+XRG+FBM; #Cars that will be allowed for this user.
AllowedPlayerCars($UserName,$Cars); #Function that set the allowed cars for this user
EndEvent
?>
======================================
Version: 0.01
======================================
-Judgebox
- Select between Qualification and 1vs1 mode
- Check username if he/she is in the server.
- Open judgebox with pass (!judgebox <pass>)
- Extra check to see if you have been set as judge
- Set the run/round
- Set Add/remove points for driver 1 and driver 2
- Refresh button when other judge changed something
-DriversBar (1vs1 mode for now)
-2 Drivers
-Drivers Nicknames
-Points for each drivers.
-Global
-List with commands
-Add a judge !addjudge <username> (Only for judges)
-Commands to enable/disable "1vs1comp" mode (looking for a better name for this addon)
======================================
#Version: 0.02
======================================
-Judgebox
-Saving 2 drivers
-Few checks to load the next pair of drivers ( Save score/Next run/Next driver + "Are you sure" question)
-Driver Reset Button
-DriversBar
-Also Available in qualify mode
-Minor design change
-QualifyingList
-Converting from SignUp List (TextFile) to qualifying list (TextFile)
-PlayerInfo from qualifyinglist( Car/Points/Name etc) loaded into Array (For faster loading)
-Each new driver will be added to the list.
-Check online/offline playerstatus
-File saved when Lapper reboots or crashed.
-Global
-Minor bugfixes
#######################
#TODO LIST
#######################
-Admin:
-Change Layouts(Extra LFSLapper sourcecode)
-Select Run scores (max of 3/avg of 3/total of 3)
-Judgebox
-Click on driver instead of entering username
-Load username automaticlly from Qualify
-QualifyingList
-Updating info
-Ranking
-SignUp window
-Best 16 calculation: Pick best 16 players with the highest scores from Qualifyinglist.
-Sqlite3 connecting to website No idea how.
<?php
=====================================
#Examplecode: using GlobalVars
=====================================
Event OnLapperStart();
GlobalVar $UserNotWelcome;
$UserNotWelcome = "Bass-Driver";
EndEvent
#Event when a player joined the server (this event will be explained in a another post)
Event OnConnect( $userName ); #Player joined the server
IF ($userName == $UserNotWelcome)
THEN
privmsg("^1You are not welcome in this server!"); #Send private message to user
privmsg(GetPlayerVar($UserNotWelcome,"NickName")."^8(".$UserNotWelcome.") ^1is not welcome in this server!"); #Send message to everyone
cmdLFS("/kick " . $UserNotWelcome ); #kick user from the server
ELSE
privmsg("Welcome ".GetPlayerVar($userName,"NickName")); #Send private message to user
ENDIF
EndEvent
?>