If a player is driving the checkpoint time of e.g. 7.146 and an other player drives the exact time a little bit later, then the player who was driving the time earlier should be still displayed.
Currently that's not the case, now the second player is shown. To change that you have to change the function from
Code: Select all
public function onPlayerCheckpoint($aseco, $params)
{
$player = $aseco->server->players->getPlayerByLogin($params['login']);
if (!$player) return;
$time = $params['lap_time'];
$cpId = $params['checkpoint_in_race'];
if (!array_key_exists($cpId, $this->checkpoints)) {
$this->checkpoints[$cpId] = new RecordsCheckpoint($cpId, $time, $player);
}
$checkpoint = $this->checkpoints[$cpId];
if ($checkpoint->getTime() >= $time) {
$checkpoint->setNewBest($time, $player);
$this->updateWidget($aseco);
}
}
to
Code: Select all
public function onPlayerCheckpoint($aseco, $params)
{
$player = $aseco->server->players->getPlayerByLogin($params['login']);
if (!$player) return;
$time = $params['lap_time'];
$cpId = $params['checkpoint_in_race'];
$force_update = false;
if (!array_key_exists($cpId, $this->checkpoints)) {
$this->checkpoints[$cpId] = new RecordsCheckpoint($cpId, $time, $player);
$force_update = true;
}
$checkpoint = $this->checkpoints[$cpId];
if ($checkpoint->getTime() > $time || $force_update === true ) {
$checkpoint->setNewBest($time, $player);
$this->updateWidget($aseco);
}
}
Also the file "plugin.checkpoint_records.ext.php" isn't required to be external, you could include the content into "plugin.checkpoint_records.php" after the end of the class "PluginCheckpointRecords".
Example structure:
Code: Select all
<?php
$_PLUGIN = new PluginCheckpointRecords();
class PluginCheckpointRecords extends Plugin {
// Code here
}
class RecordsCheckpoint extends Checkpoint {
// Code here
}
?>
That makes the handling/install much easier.
EDIT: I changed the plugin by myself, you can download the changed plugin at UASECO plugin repository:
https://www.uaseco.org/plugins/details.php?id=2