[Plugin] Checkpoint Records

UASECO is a fork of the XAseco2/1.03 controller for Trackmania and has been overhauled to support the Modescript Gamemodes of Trackmania².

Moderators: undef.de, NADEO

iziboi
Posts: 5
Joined: 20 Mar 2018, 04:59

Re: [Plugin] Checkpoint Records

Post by iziboi » 02 Apr 2018, 06:53

Awesome plugin, thanks for sharing!

But, how to setup it for "Rounds" to do not rester checkpoint stats every round?

EDIT:

Fixed by removing:

Code: Select all

    /**
     * Called when a round ends
     * @param $aseco
     * @param $count
     */
    public function onEndRound($aseco, $count)
    {
        $this->initialize($aseco);
    }
Now would be nice warm up ignore.

User avatar
undef.de
Posts: 1834
Joined: 06 Apr 2011, 21:57
Location: Germany
Contact:

Re: [Plugin] Checkpoint Records

Post by undef.de » 17 Nov 2018, 20:55

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
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.

User avatar
braker
Posts: 6
Joined: 30 Dec 2017, 15:46

Re: [Plugin] Checkpoint Records

Post by braker » 08 Dec 2018, 13:03

Thank you for updating the plugin.
Just wanted to do it, I'm really stressed because of university and didn't have the time.

Post Reply

Return to “UASECO”

Who is online

Users browsing this forum: No registered users and 1 guest