[Xaseco 1] OnPlayerFinish in order in rounds mode?

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

Post Reply
coolthing
pedestrian
pedestrian
Posts: 8
Joined: 23 Feb 2015 22:28
Owned TM-games: TMU

[Xaseco 1] OnPlayerFinish in order in rounds mode?

Post by coolthing » 16 Feb 2016 22:58

Hi everyone,

I have just a quick question concerning the onPlayerFinish event when being in rounds mode. Is it always ensured that when I only rely on this event that I get the ranking in the correct order in rounds mode like Nadeo would show it on the right side and distributing points accordingly? So when I do the following in the pseudo code below, will I get the correct result in the onRoundEnd function?

Code: Select all

...
$finishs = array();
...
function onPlayerFinish($aseco, $finish)
{
    $player = $finish->player;
    $finishs[] = $player;
}

...

// Called when the round ends (once all have finished or time is up)
function onEndRound($aseco) 
{
    // Will I always get here the same ordering as Nadeo would show it for distributing points?
    foreach($finishs as $player)
    {
         Aseco::console($player->login);
    }
}

Was just not 100% sure if some players will finish with the same time :) I could not find any information about this.

Appreciate your help,

Cheers,
Knights.Coolthing

P.S.: What is exactly fixed in the onPlayerFinished1 event, would you recommand to use that one instead?

Xymph
Pit Crew
Pit Crew
Posts: 5685
Joined: 19 Aug 2007 12:58
Owned TM-games: TMN, TMU, TMF, TM²
Contact:

Re: [Xaseco 1] OnPlayerFinish in order in rounds mode?

Post by Xymph » 17 Feb 2016 10:36

coolthing wrote: I have just a quick question concerning the onPlayerFinish event when being in rounds mode. Is it always ensured that when I only rely on this event that I get the ranking in the correct order in rounds mode like Nadeo would show it on the right side and distributing points accordingly?
I don't remember, you'd have to test that.
coolthing wrote:So when I do the following in the pseudo code below, will I get the correct result in the onRoundEnd function?
It's onEndRound.
coolthing wrote: P.S.: What is exactly fixed in the onPlayerFinished1 event, would you recommand to use that one instead?
It's onPlayerFinish1.
When registering to onPlayerFinish, like most plugins do and should do, your callback gets invoked in the order of registration (IIRC), meaning it can come quite late in the callback chain. In some cases, it is necessary that one plugin's callback is invoked before another's, like plugin.checkpoints.php before plugin.dedimania.php. That's when onPlayerFinish1 can be registered to instead, as that event is invoked just before onPlayerFinish.
Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub

coolthing
pedestrian
pedestrian
Posts: 8
Joined: 23 Feb 2015 22:28
Owned TM-games: TMU

Re: [Xaseco 1] OnPlayerFinish in order in rounds mode?

Post by coolthing » 18 Feb 2016 09:30

Thanks for your answers :) Alright, then I may have to add some PF maps and see what happens :)

Post Reply