The online racing simulator
error in ondriftscore code
Hi! There is no problem when I am the only player on the server, the drift counter works, but when there are more than 6 members on the server, the drift counter does not work for some player. I also want to know the difference between catchevent and normal event.



<?php 
$DriftDatabase 
"Databases/DriftPB";
$RealTimeDriftScore 1#Turn on (1) /off (-1) realtime driftscoring . This may have effect on LFSLapper performance with many players on the server. (Default = -1)
$MinimumDriftSpeed 10# Minimum speed in km/h to maintain. Driving below that speed will reset score
$MinimumDriftAngle 15# Minimum angel to maintain. When angle is below value, score is resetx
$MaximumDriftAngle 100# Maximum angel to maintain. When angle is above value, score is reset

CatchEvent OnDriftScore$userName # Player event
    
openPrivButton"drfhud_DriftText",80,36,40,20,4,10,0,"^1DRIFT");
    
openPrivButton"drfhud_TotalScore",80,48,40,20,4,10,0,"^7"ToNum(GetCurrentPlayerVar("DriftScore")));
    
SetCurrentPlayerVar("DriftSC"ToNum(GetCurrentPlayerVar("DriftScore")));
EndCatchEvent

CatchEvent OnDriftResetScore
$userName # Player event
    
openPrivButton"drfhud_GetMoney",80,61,40,10,4,10,0,"^2+ Drift End");
    
privdelayedcommand(2closedrifthud);
EndCatchEvent

Sub closedrifthud
($KeyFlags)
    
closeprivbutton("drfhud_GetMoney&drfhud_TotalScore&drfhud_DriftText");
EndSub

?>


I am picking my brain as I think I had a similar issue with one of my scripts in the past.
Worked fine with a few players, but went wrong when the amount of players got above a certain point.
Need to dig around in my scripts, to see what script it was and how I fixed or debugged it.
Quote from Yisc[NL :;2065937"]I am picking my brain as I think I had a similar issue with one of my scripts in the past.
Worked fine with a few players, but went wrong when the amount of players got above a certain point.
Need to dig around in my scripts, to see what script it was and how I fixed or debugged it.

It would be nice if you find something, thank you for your effort.
Quote from Yisc[NL :;2065937"]I am picking my brain as I think I had a similar issue with one of my scripts in the past.
Worked fine with a few players, but went wrong when the amount of players got above a certain point.
Need to dig around in my scripts, to see what script it was and how I fixed or debugged it.

Did you find anything?
Quote from skorzz :...I also want to know the difference between catchevent and normal event...

Events are in the main LFSLapper.lpr file, but CatchEvents are used in additional scripts - sort of append these additional scripts to main file. Helps to keep things manageable.
Quote from skorzz :Did you find anything?

Finaly found the time to have a look.
My issue had to do with a problem with an array in a while-loop.
After many debugging, logging, etc. I changed it to a FOREACH-loop and the issue went away.
But bot loops are a not used in your code, so there must be some other issue.
Best thing to do is add a lot of logging and write that to a TXT file.
Then try to reproduce the issue and see what the logfile is showing.
Quote from Yisc[NL :;2066901"]Finaly found the time to have a look.
My issue had to do with a problem with an array in a while-loop.
After many debugging, logging, etc. I changed it to a FOREACH-loop and the issue went away.
But bot loops are a not used in your code, so there must be some other issue.
Best thing to do is add a lot of logging and write that to a TXT file.
Then try to reproduce the issue and see what the logfile is showing.

in doc/changes.txt "Changes from 7.0.8.1 to 7.0.9.0" Fix 4: "[Event]: Several Events like (OnDist, OnDriftScore) didnt execute when more than 8 players on the track

I found a section called "Caused by MCI packets when more than 8 players are on the track"
. When I opened this forum, the version I used was 7.0.8.0. Could this be the reason for the problem? But when I opened the forum, there were 4 players on my server when the problem occurred.
The problem I have with version 7.0.9.3 is that, for example, when I drift left and start drifting right, my driftscore does not increase.

FGED GREDG RDFGDR GSFDG