[XASECO] Plugin: Panels (FIX) hiding the records panel in spectator view

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
User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 143
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Manialink(s): woa
Location: Sweden
Contact:

[XASECO] Plugin: Panels (FIX) hiding the records panel in spectator view

Post by L3cKy » 14 Feb 2018 12:42

Hej Hej.

I`ve added a new event handler at the plugin.panels.php to hide the records panel at the spectator view.

Before:
Image

After:
Image


Changings
Open and edit "plugin.panels.php" (located at xaseco->plugins folder)

Add after line 23:

Code: Select all

Aseco::registerEvent('onPlayerInfoChanged', 'recspanel_spec');
Add after line 547:

Code: Select all

function recspanel_spec ($aseco, $info) {
	if ($aseco->server->gamestate != Server::SCORE) {
		$player = $aseco->server->players->getPlayer($info['Login']);
		if ($info['SpectatorStatus'] > 0) {
			$xml = '<manialink id="4"></manialink>';
			$aseco->client->query('SendDisplayManialinkPageToLogin', $player->login, $xml, 0, false);
		} else {
			update_recpanel($aseco, $player, $player->panels['pb']);
		}
	}
} // hide records panel in spectator view
Greetings L3cKy
Last edited by L3cKy on 15 Feb 2018 06:13, edited 4 times in total.

TheBigG
smooth traffic navigator
smooth traffic navigator
Posts: 232
Joined: 16 Oct 2010 19:45
Owned TM-games: TMN! TMF
Location: Germany

Re: [XASECO] Plugin: Panels (FIX) hiding the records panel in spectator view

Post by TheBigG » 14 Feb 2018 22:35

nice idea.
but XAseco does crash as soon as there is no player anymore.

Code: Select all

PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function recspanel_spec(), 2 passed in /home/tmf/master_xaseco/aseco.php on line 1249 and exactly 3 expected in /home/tmf/master_xaseco/plugins/plugin.panels.php:550
Stack trace:
#0 /home/tmf/master_xaseco/aseco.php(1249): recspanel_spec(Object(Aseco), Array)
#1 /home/tmf/master_xaseco/aseco.php(1338): Aseco->releaseEvent('onPlayerInfoCha...', Array)
#2 /home/tmf/master_xaseco/aseco.php(1106): Aseco->playerInfoChanged(Array)
#3 /home/tmf/master_xaseco/aseco.php(760): Aseco->executeCallbacks()
#4 /home/tmf/master_xaseco/aseco.php(2562): Aseco->run('config.xml')
#5 {main}
  thrown in /home/tmf/master_xaseco/plugins/plugin.panels.php on line 550

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 143
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Manialink(s): woa
Location: Sweden
Contact:

Re: [XASECO] Plugin: Panels (FIX) hiding the records panel in spectator view

Post by L3cKy » 15 Feb 2018 00:30

Sorry i forgot to delete the $pb ...

This should work ^^

Change:

Code: Select all

function recspanel_spec ($aseco, $player, $pb)
to

Code: Select all

function recspanel_spec ($aseco, $player)
Last edited by L3cKy on 15 Feb 2018 02:02, edited 6 times in total.

TheBigG
smooth traffic navigator
smooth traffic navigator
Posts: 232
Joined: 16 Oct 2010 19:45
Owned TM-games: TMN! TMF
Location: Germany

Re: [XASECO] Plugin: Panels (FIX) hiding the records panel in spectator view

Post by TheBigG » 15 Feb 2018 00:37

Now it works.
Thank you

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 143
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Manialink(s): woa
Location: Sweden
Contact:

Re: [XASECO] Plugin: Panels (FIX) hiding the records panel in spectator view

Post by L3cKy » 15 Feb 2018 05:29

Update:

The records panel is now hidden at any spectator state.

Add after line 23:

Code: Select all

Aseco::registerEvent('onPlayerInfoChanged', 'recspanel_spec');
Add after line 547:

Code: Select all

function recspanel_spec ($aseco, $info) {
	if ($aseco->server->gamestate != Server::SCORE) {
		$player = $aseco->server->players->getPlayer($info['Login']);
		if ($info['SpectatorStatus'] > 0) {
			$xml = '<manialink id="4"></manialink>';
			$aseco->client->query('SendDisplayManialinkPageToLogin', $player->login, $xml, 0, false);
		} else {
			update_recpanel($aseco, $player, $player->panels['pb']);
		}
	}
} // hide records panel in spectator view

TheBigG
smooth traffic navigator
smooth traffic navigator
Posts: 232
Joined: 16 Oct 2010 19:45
Owned TM-games: TMN! TMF
Location: Germany

Re: [XASECO] Plugin: Panels (FIX) hiding the records panel in spectator view

Post by TheBigG » 17 Feb 2018 16:17

Hi L3cKy,
one thing i noticed is that after a map change the panel gets displayed again even though you are still spectator

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 143
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Manialink(s): woa
Location: Sweden
Contact:

Re: [XASECO] Plugin: Panels (FIX) hiding the records panel in spectator view

Post by L3cKy » 17 Feb 2018 19:13

TheBigG wrote:
17 Feb 2018 16:17
Hi L3cKy,
one thing i noticed is that after a map change the panel gets displayed again even though you are still spectator
Pls use my update ...
And yes u will see at first the records panel in spectator view after map changed but it will disapear after few seconds ...

Post Reply