The online racing simulator
Searching in All forums
(446 results)
Krayy
S2 licensed
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:
http("http://www.lfsnz.com?user=$userName&raceseries=$currSeries");

Then it will return a yes or no based on whether the racer is allowed to join that series
Krayy
S2 licensed
I've updated the userGroup.cs file to do the listing in sorted order, so heres the whole file:
Krayy
S2 licensed
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:

CASE "!ban":
IF ( UserIsAdmin( $userName ) == 1 )
THEN
privMsg ( langEngine( "%{main_ban}%", GetCurrentPlayerVar( "Nickname" ), GetPlayerVar( $argv, "Nickname" ) ) );
cmdLFS ( "/ban " . $argv . " 1" );
ENDIF
BREAK;

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.
Last edited by Krayy, .
Krayy
S2 licensed
Quote from lysergic :

9/20/2009 12:58:07 AM -> Param var $MaxCarResets do on file : "LFSLapper.lpr" at line #1597
9/20/2009 12:58:12 AM -> Syntax error in cfg file "LFSLapper.lpr" at line #333
'initaddons' is not a Lapper function
Function 'onlapperstart' script aborted

500server version is 5.843 not 5.845

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:

include( "./includes/addonsused.lpr");

Krayy
S2 licensed
Quote from Fire_optikz001 :i thought u said i could do it with

<?php 
$HandicapCars 
"$car:$mass:$intake"
?>

if i can where do i put that line?

In the main Lapper config file. Search the file to find the sample lines that are alreay in there.
Krayy
S2 licensed
At the moment, only in the lapper config file. I will try and update the !hc command to allow for car/track/user handicaps in the near future
Krayy
S2 licensed
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
Krayy
S2 licensed
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") ) != )
    
THEN
        privMsg 
("You are not authorised to race on this server );
        cmdLFS ( "
/kick " . GetCurrentPlayerVar("UserName") );
    ENDIF
    ...
?>


Krayy
S2 licensed
Quote from Fire_optikz001 :can u help me

9/17/2009 9:12:17 PM -> Unexpected end function in event :MA_KB1 on file : "LFSLapper.SC" at line #1112

Try changine the Sub defines to:

Sub MA_KB1()
openPrivButton( "2man212",52,130,5,25,1,12,32,"12");
openPrivButton( "2man212a",32,130,20,10,1,12,32,"12A");
DelayedCommand( 3, MA_KB2 );
EndSub

Sub MA_KB2( $KeyFlags, $id )
openPrivButton( "2man212a",52,130,20,10,1,9,32,"12A");
DelayedCommand( 3, MA_KB3 );
EndSub

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.
Krayy
S2 licensed
Quote from Fire_optikz001 :so if i wanted to use this for my race sys it would be...


<?php 
$HandicapCars 
"$car:$mass:$intake";

?>

?

Yep
Krayy
S2 licensed
Quote from Fire_optikz001 :a waht?

Like this:

krayy,mypass,blah

then use the split function to access the 3 diferent parts of the string using a comma to split on
Krayy
S2 licensed
Quote from Fire_optikz001 :actually its to help keep relatives from using your account and it is also part of my user report sys

Then if you store the info as a comma delimited string, you could store in the storedvalues.db
Krayy
S2 licensed
Quote from Fire_optikz001 :well i want it to make a $userName.txt

in it it will have
login = (User selected login)
Pass = (user selected password)
report = (user genarated report of !Report (username)[this would be The username on the txt file] (report)

something like this
the $username.txt is so people cant login to other people accounts

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?
Krayy
S2 licensed
Quote from Fire_optikz001 :ye but i want it to be reset after the race so would i do $handicaps = " "?

Yes, an empty string ("") clears the handicaps
Krayy
S2 licensed
Quote from Fire_optikz001 :im thinking of a new kind of login sys and ur thing does not crate files:S

Explain how you system would work and I'll see what I can do.
Krayy
S2 licensed
That's all good...but what the heck does it mean??
Krayy
S2 licensed
In the main lapper file:


<?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.
Krayy
S2 licensed
Well the code I put up for writing out usergroups would do it, but why would you want to store passwords too?
Krayy
S2 licensed
Quote from lysergic :Everybody wants a racepoint system.

@any programmer: How much money do You want?

Just 'cos you asked nicely, I'll do it for free

Watch this space...but not too closely or you'll go blind.
Krayy
S2 licensed
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:

Event OnResult( $flagConfirm )
writeline ( langEngine( "%{main_on_result}%" ,GetCurrentPlayerVar("FinishedPos") ) );
SWITCH(GetCurrentPlayerVar("FinishedPos") )
CASE "1":
globalMsg(GetCurrentPlayerVar( "NickName" . "gets 10 points")
BREAK;
CASE "2":
globalMsg(GetCurrentPlayerVar( "NickName" . "gets 9 points")
BREAK;
etc...
ENDSWITCH
EndEvent

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.
Krayy
S2 licensed
Quote from Fire_optikz001 :9/13/2009 4:07:44 PM -> Syntax error in cfg file "LFSLapper.SC" at line #1775
Token not catched
Function 'printusergroup' script aborted...

Can you cut & paste line 1775 from the LFSLapper.SC file as well as about 20 lines above and below it?
Krayy
S2 licensed
Quote from Fire_optikz001 :9/12/2009 9:27:00 PM -> Syntax error in cfg file "LFSLapper.lpr" at line #1745
Token not catched
Function 'printusergroup' script aborted

Try this .exe and see if that works for you.
Krayy
S2 licensed
Quote from Fire_optikz001 :Is it possible to make addusertogroup to actually add a user to the file ex lets say i wanted to make a command like !hireadmin fire_optikz001 it will actually add me to the admin.txt file and also removuserfromgroup actually remove the user frome it ex. !fireadmin fire_optikz001

Done... http://www.lfsforum.net/showthread.php?t=61328
Krayy
S2 licensed
Quote from Bass-Driver :k done
good news the code works
bad news : it doesnt save the users and i need to login everytime when i start lapper .i did putt myself manualy in the UserAdmin file. but still i need to login as admin when i start lapper.

What version of lapper are you using?

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?
Krayy
S2 licensed
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.
FGED GREDG RDFGDR GSFDG