Development

Gamestate in UASECO

In some situation it is required for your Plugin to know which Widgets are to display, because at Score you may want to display other Widgets as in Race, or you have to hide your Widget at Score. In this case you need to know at which state the Game currently is.

It is quite simple in UASECO to inquire which state the Game currently is:

Inquire the Gamestate

if ($aseco->server->gamestate == Server::RACE) {
	// The Players are racing
}
else if ($aseco->server->gamestate == Server::SCORE) {
	// The Players see the Scoreboard
}

Alternate method

An alternative way is to register the events onBeginPodium and onEndPodium in your Plugin:

Inquire the Gamestate

public function __construct () {
	$this->registerEvent('onBeginPodium', 'onBeginPodium');
	$this->registerEvent('onEndPodium', 'onEndPodium');
}

public function onBeginPodium ($aseco) {
	// The Players see the Scoreboard
}

public function onEndPodium ($aseco) {
	// The Players are racing, or better short before starting
}

The event onBeginPodium is send after onEndMap (where $aseco->server->gamestate is changed to Server::SCORE)!

This is a private enthusiast Website. Maniaplanet, Trackmania, Shootmania, Nadeo are trademarks of Ubisoft Entertainment.
Windows is a registered trademark of Microsoft Corporation.

Last modified: Wed, 17 Apr 2019 22:10:37 +0200