I was thinking about this problem overnight, and I think what we'l do with our website/lapper integration is to use the "http" lapper function. This sends an http request to a web server and returns the result. The good news here is that you can pass a set of parameters to a cgi function using something like:
http("http://www.lfsnz.com?user=$userName");
and use the return value as the authorisation code. We're looking at scheduling races and using race codes to identify a series that the user will race in, so the modified call would be:
Found a slight bug which was enough to stuff up my car reset stuff.
In the ListPlayers.cs file, there is a function called "RaceRestart" which is meant to zero out a number of race related values for each player. Some values aren't included in the reset code like the ones below:
(currInfoPlayer as infoPlayer).bestSpeed = 0; (currInfoPlayer as infoPlayer).currSplit = 0; (currInfoPlayer as infoPlayer).currVote = (int)InSim.vtn.VOTE_NONE; (currInfoPlayer as infoPlayer).drivethroughcount = 0; (currInfoPlayer as infoPlayer).finishedPos = 0; (currInfoPlayer as infoPlayer).lapTime = 0; (currInfoPlayer as infoPlayer).lastSplitTime = -1; (currInfoPlayer as infoPlayer).maxLapSpeed = 0; (currInfoPlayer as infoPlayer).pitTime = 0; (currInfoPlayer as infoPlayer).racePBTime = 0; (currInfoPlayer as infoPlayer).raceTotalTime = 0;
Also, the patch below will update the parseEvents.cs file to always return a valiue for the "finishedpos" variable (as peviously it only returned a value if the user had actually finsihed a race), and also adds a new GL function "userisadmin". This is to allow all admin functions to work if the UCID of the user is 0, which is the host. To use this, replace any IF clause in your lapper file that uses 'UserinGroup("admin", $userName)', with 'UserIsAdmin($userName)', Like this:
PS: If you do use this function to determine Admin status, you can then comment out the UserGroupFromFile( "admin", "./admin.txt" ); function in the oNmso event so that you're not reading in that file and populating the admin group stuff every time you do any Lapper command.
The initaddons function is defined in an external file called addonsused.lpr. Make sure that the following line is in the Lapper config file where the other includes are:
Good point re the delayedcommand...maybe if you create a countdown button with 3 secs on it, but make it clear with no text, then it will act as a close/open timer
Unfortunately I think you're trying to overcomplicate things. Like I said before, only the registed user will have the login name, and if their relatives are racing, I wouldn't care much.
If you are after stopping unauthorised racers, then add registered users to a file called "RegisteredUsers.txt", then modify the OnConnect function like this:
<?php Event OnConnect() # Player event UserGroupFromFile( "RegisteredUsers", "./RegisteredUsers.txt" ); IF( UserInGroup( "RegisteredUsers",GetCurrentPlayerVar("UserName") ) != 1 ) THEN privMsg ("You are not authorised to race on this server ); cmdLFS ( "/kick " . GetCurrentPlayerVar("UserName") ); ENDIF ... ?>
Sub MA_KB3 ( $KeyFlags, $id ) openPrivButton( "2man212a",52,130,20,10,1,14,32,"12A"); EndSub
Any Sub called from a button requires the 2 parameters KeyFlags and id. The first one doesnt need them as it would be called as a fucntion from a command, not a button.
Hmmm...How would they log in using another username? LFS licensing takes care of that for you. I.e you can pretty much guarantee that anyone connecting to the server as "Krayy" is me, because LFS won't allow anyone else to use the name.
Is this for a system to report offenive behaviours or bad driving?
<?php #Syntax : # #$HandicapCarsTracks = "car/track:mass:irest,car/track:mass:irest,...,car/track:mass:irest"; # #car : LFS short car name #track : LFS short track name #mass : mass handicap in kg #irest : Air intake restriction in percent
$HandicapCars = "UFR:0:30,XFR:0:30";
?>
So the last line in our lappr file puts a 30% restriction on UFRs and XFRs with no weight penalty. I'm looking at expanding my Handicapping code to include car restrictions too. Will let you know how I get on.
I'm working on a complex one which won't be ready for a week or so, but until then, add a SWITCH/CASE statement in the LFSLapper.lpr file in the OnResult function like this here:
The problem here is that you need to change iit by hand if your points system chnages. I'll address that in the complex one, and allow you to write the results out to a file. We're going to use XML to allow imports into a stats web site.
Also, I'm not sure why you're using "UserAdmin" instead of "admin" as the group, as Lapper has quite a few functions that require you to be in the "admin" group. (Unless you did a global search/replace of course). Or is there a specific function that the UserAdmin group does?
You don't need to debug it, just hit F6 to compile it.
BUT...when you open the LFSLapper.csproj file, go to the Project->LFSLapper Properties menu, go to the Debug tab and set the path to ..\LFSLapperBin\Release\ (you may need to create this directory). Set the Ouput Path in the Build tab to the same.