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);
SetPlayerVar($maVar["value"], "JoinedDerby","0" );
openGlobalButton( "name_" . $maVar["value"],$point_L,$point_T+1,21,4,3,-1,96,"^7" . GetPlayerVar($maVar["value"],"NickName") );
openGlobalButton( "ontrack_" . $maVar["value"],$point_L+21,$point_T+1,6,4,3,-1,32,"^3" . GetPlayerVar($maVar["value"],"Pointsrun1"));
$point_T=$point_T+4;
ENDIF
ENDIF
ENDIF
ENDFOREACH
$PointsMax=$PointsMax-1;
ENDWHILE
?>