LFS allows for a REOrder packet to be sent to the server to reorder the grid any way that you want. We started to implement this code but ran out of steam before it got fully implemented. May get around to it if S3 comes out.
I've been away from LFS for a while and at the behest of some others, I've finally updated the code to hopefully support the TCP queuing that was introduced in Insim 6, thanks to Gai's 220.127.116.11 release. I've alose removed the code that was planned to do contact detection as it is not compatible with Lapper internals.
My regular group has stopped racing LFS so I have been unable to test it with more than 2 connections which seemed fine, so could people running 6014 please update the binaries and let me know how you get on.
One thing I can say is that with lapper scripts you really need to do a lot of bounds testing, such as when you do the GetPlayerVar(Pointsrun1), you need to be very sure that you test the output to make sure that it returned a valid Number, othersie the DBTotal additions will fail. You can use the IsNum function to test that.
<?php WHILE($PointsMax >= 1) $Racers = getListOfPlayers("N"); FOREACH( $maVar IN $Racers ) IF (GetPlayerVar($maVar["value"],"JoinedDerby") == "1") THEN $thisPointsrun = GetPlayerVar($maVar["value"],"Pointsrun1"); IF ( IsNum($thisPointsrun) == TRUE ) THEN IF ($thisPointsrun == $PointsMax) THEN $DBTotal = GetUserStoredNum($maVar["value"], "DPTotal"); $DBTotal = $DBTotal+$PointsMax; SetUserStoredValue($maVar["value"], "DPTotal" , $DBTotal);
use getStoredNum (defaults to -1 if doesnt exists ) instead of getStoredvalue (returns a NULL) to ensure that you are returning a valid numeric. e.g.
<?php CASE "!dplist": # Get default value if not already defined $DPTotal = GetStoredNum($userName. "DPTotal"); IF( $DPTotal == -1 ) THEN $DPTotal = 5; ENDIF # Now set it in player $DPTotal = $DPTotal + 5;
Timers are tricky in Lapper because the app is running indepedantly of the LFS server and also only displays information to you as buttons on the client.
This induces a certain period of lag, as any timer needs to first calculate the time to display then cycle through all connections one by one updating the button used to display that timer. Each client will have a particular response time (say 20ms to 200ms) that adds to the time each update takes.
This is why sometimes with you use the %cnt% variable in a text button it will count down but may skip a number...it is taking more than 1 second to cycle through all of the clients.
Technically a function to create a button and update it with a timer, time of day etc, but there is no guarantee that it would be smooth.
maybe in the next version of InSim they will add functions that can do a simultaneous write or button update to all connections, which would solve the problem, but until then i could have a look but it would not be 100% accurate or smooth.
BTW, what sort of time do you want to display, race time, time of day?
Lapper crashed when the server pasword was wrong, so I have now change the default ini file to have a blank password and when lapper sees a lapper instance with a blank password it will show an error in the console. So when doing the initial install, run LFSLapper which will cerate the default directory, then you will need to close Lapper, edit the default_ini file with the server password and then restart.
Added the "NumberPlate" player var which is populated when a player joins a race or renames their Plate...use like this:
Most obviously is that you are not assigning the value anywhere. If you have alook for the value Plate in the InSim5.txt file (which details all of the insim functions), you will see that the Plate variable exists in the NPL (New Player), RES (Result) and CPR (Connection player rename) so what you will need to do is set the Players Plate variable in the relevant function in the managepacket.cs file i.e.:
Now you have a value that you can use in your script. I might as well throw this into the codebase as it may come in useful.
P.S. Just put it in and tested it and it all works correctly. Note that the plate will not be valid until the player joins a race, as that's when the NPL InSim packet is sent, not when they connect which is NCN. I also treid renaming my plate (which returns a CPR packet) and that worked as well.
Yes. You could put that command in the OnConnect function to force the default language to Russian. This will override any configuration tha tteh user has done using the !myconfig command though, so only do that if you are certain it will only be people who speak Russian who log into the server.
Actually I can move all of the config options in !myconfig into a Lapper script and store it in the database, then you could do a "GetStoredValue("IdLang") and if its not set explicitly, then default to RU. I'll do that soon.
I quite like this feature although I put it in optional as it isn't feature complete yet. A few suggested features would be to allow the speed traps to be set in game and stored in an .ini file for ease of transport to other servers.
Also seing what traps are there and removing them if needed, otherwise it might get very chatty.
Typo...damn. Only the !mins command supports the extra parameter for the amount of extra laps. !kms is absolute as it uses the track length to determine the amount of laps to do to satisfy the required distance.