determine spectator-camera

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

Post Reply
aca
Posts: 44
Joined: 02 May 2014, 14:25
Location: Passau

determine spectator-camera

Post by aca »

Hello coders,

I wonder if there was a possibility to determine the cam a spectator is using. Following scenario:

I'm about to finish a CP-plugin which shows the time difference to a tracked record (at bottom, middle and top). I show this widget to the player himself and also to his spectators BUT I want to hide it in free-spec.
My problem is, that

Code: Select all

$player->target_spectating
is not false when in free-spec but points to the last spectated player. If I could now determine the camera (should be 2), I could hide it to free-spectators.

Thx for your ideas!

Greetz, aca
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: determine spectator-camera

Post by undef.de »

Maybe one of these are useful:

https://www.uaseco.org/development/classes/player.php

Code: Select all

$player->is_spectator
$player->forced_spectator
$player->temporary_spectator
$player->pure_spectator
https://github.com/maniaplanet/dedicate ... erInfo.php
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.
aca
Posts: 44
Joined: 02 May 2014, 14:25
Location: Passau

Re: determine spectator-camera

Post by aca »

Thx for your quick answer, maybe you see my problem when i post the whole function onPlayerInfoChanged:

Code: Select all

	public function onPlayerInfoChanged ($aseco, $login){
		$player = $aseco->server->players->getPlayerByLogin($login);
		$isSpec = $player->is_spectator;
		$isTempSpec = $player->temporary_spectator;
		
		//if status changed to spectator
		if($isSpec || $isTempSpec){
			//$aseco->console("target spectated by $login : $player->target_spectating");
			//is a player spectated
			if($player->target_spectating != false){
				//set in specArray
				$this->specArray[$login] = $player->target_spectating;
				//show instantly widgets of target
				$xml = $this->buildTimeDiffWidgets($player->target_spectating, false);
				$aseco->sendManialink($xml, $login, 0);
			}
		}
		//if status changed from spectator to player
		else if(isset($this->specArray[$login])){
			//unset in specArray
			unset($this->specArray[$login]);
			//show instantly widgets player himself
			$xml = $this->buildTimeDiffWidgets($login, false);
			$aseco->sendManialink($xml, $login, 0);	
		}
A free-spectator is a spectator, so it will go into my if-condition. Normally a free-spectator has no target, but: target_spectating still points to the last spectated player.... that's why i asked if it is possible to determine the camera, then i could do sth like:

Code: Select all

if($player->target_spectating != false && $player->camera != 2)
I know there's not such member in Players-class, just for demonstrating...

I've seen, one can force a player into spectator and a special camera, so I thought, maybe one could determine the cam also other way round.
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: determine spectator-camera

Post by undef.de »

Instead of

Code: Select all

		//if status changed to spectator
		if ($isSpec || $isTempSpec) {
you could use

Code: Select all

		// if status changed to spectator
		if ($player->getSpectatorStatus()) {

aca wrote: 20 Apr 2018, 17:17 I've seen, one can force a player into spectator and a special camera, so I thought, maybe one could determine the cam also other way round.
You can force a player to a cam, but as far as I know you can't determine which cam he is currently using. But you can force the cam and then you know which cam he use. :lol:

Code: Select all

$result = $aseco->client->query('ForceSpectatorTarget', $player->login, $player->target_spectating, 1);
Details: https://www.uaseco.org/dedicated-server ... atorTarget
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.
aca
Posts: 44
Joined: 02 May 2014, 14:25
Location: Passau

Re: determine spectator-camera

Post by aca »

undef.de wrote: 20 Apr 2018, 18:57
You can force a player to a cam, but as far as I know you can't determine which cam he is currently using. But you can force the cam and then you know which cam he use. :lol:
Not what I wanted to do :lol: but thx for the information :thumbsup:
Post Reply

Return to “UASECO”

Who is online

Users browsing this forum: No registered users and 2 guests