I don't think because i don't know in advance if the result is too big from stored file to put in arraylist. This risk to freeze LFSLapper.
I don't understand why you can't use userStoredValue. Can you explain me more and why private delayed command. Maybe there is an another solution to your problem if you explain it accurately.
It's just like I already said, I actually have used the userStoredValue and experienced a problem with that.
It's like this: in order to award a point to the racer that did the fastest racelap, I saved the laptime and username everytime someone completed a lap and was faster than the previously saved laptime.
Because I couldn't determine the player that drove the fastest racelap when the first one finished (after that one there still could finish a player with a new fastest lap), I had to use a delayed command with a delay of about a laplength.
I used a PrivDelayedCommand for that purpose, storing the points-info in the fi_user_value, this PrivDelayedCommand was launched at the OnResult for the first finished player (finishedpos = 1).
The problem that occured was that when this first finished player was in the pitbox at the time the delayed command was due to be executed, nothing happened, i.e. this command wasn't executed. Did this player get out of the pitbox before the expiry of the delaytime, everything resumed as planned. But not when being IN the box...
After that I also tried to use a DelayedCommand in stead of a PrivDelayedCommand, using SetUserStoredValue with the usage of the userName-option, but that didn't work because that was only usable in a playerevent, whilest the DelayedCommand issued a lapperevent.
And that forced me to store the data in the fi_stored table..
This however could create a possible solution I guess, when this command would also be usable in a lapperevent.Since you have to provide the userName, it would be perfectly suited to be used in a non-playerevent..
If that could be made possible (or if this pitbox-issue could be easily resolved/avoided, of course) that would make me very happy.
Store the users PBs each lap similar to this (note that thgis is for one of my addons, so will require you to muck about with var names, initial settings etc):
<?php CatchEvent OnLap( $userName ) # Player event # Update the PB if the current lap is faster than the PB $EventLapPB = GetUserStoredValue ("EventLapPB"); $CurrLapTime = GetCurrentPlayerVar ("LapTime"); IF ( ToNum($EventLapPB) < 1 || ToNum($CurrLapTime) < ToNum($EventLapPB) ) THEN SetUserStoredValue ( "EventLapPB", $CurrLapTime); ENDIF EndCatchEvent ?>
As part of the OnResult function, do something like this:
Now the stored var RacePB will contain the PB and username, seperated with a semi-colon. Now you can query that to display the fastest time when doing a race restart or other event.
NB: As mentioned, this code is hacky since I'm at work and don't have much time, but thats essentially the eway I'm doing it.
That definitely would work for determining the fastest racelap and the player that drove it, but it's not quite what I need..
This determination should be followed by adding a point to this player's score, which is stored in the database. And that won't be possible in a following lapperevent like the next racestart, when using the SetUserStoredValue.
For that to work one should know who's the last finisher in order to make the fastest-racelap final, and that's a bit hard to determine.
That's the reason I chose to use a delayed command..
Using a delayed event would never work as a player might just stop halfway around or crash etc and never finish. You either need to choose an arbitrary point such as a restart to apply points (what CTRA did), or you can go the whole hog and use a counter. As the race starts, use the NumP to set the number of racers. Increase the counter by 1 when a new player joins (but not after the first person has finished). When a player finishes (OnResult), decrease the counter. When it hits 0, the race is over.
PS: I use the SetStoredValue instead of setUserToredValue, as this will exists even when a user has disconnected
If you have player username, lapPB, you can use setUserStoredValue with this value in a delayed command. SetUserStoredValue can take an optional value that was the username and in this case you can use it in delayed Command. Use setUserStoredValue is the good storage you need if you want use topuser
That's not a problem.. This delayed command is only launched by the first player that crosses the finishline, or rather: that is getting a result. The fastest lap is saved per lap, so that's still available at the moment the delay expires.
The delay started at the moment the first result comes in, provides for that. A restart wouldn't be a good point, I think, because there might not be one. If everyone logs off after finishing the race, for instance..
Loads of work.. Also disconnects, spectates, pit etc. should be taken in account then.
Me too, but that one has the drawback that no easy !top-like list can be derived of that. And that's exactly the reason for my question..
Been there, done that.. ;-)
I've tried this before and that would be my preferred call, but Lapper tells me the setUserStoredValue can't be used in a lapper-event..
i'm try to make a code , that lapper makes a new file for each new player in the server.
the code works but when the user disconnect and it comes back it still says : Username Is a new Driver in this server
i think the bug is : IF( UserInGroup( "Drivers" , "$userName.txt" ) == 1 )
but see the code below :
k ill see the reasonmessage for eachreport now, but the time is still wrong
btw its create 1 file for each reported user and not for example 10 files for 1 reported user
and about the files that was not a question thats what i made.
if the reported user already exist then write the reportreason in the same file.
if it the reported user not exist then made a new file incl the reportreason.