SpectatorStatus doesn't update properly

This is the place where you can find everything related to the dedicated server, control scripts and community tools.

Moderators: Pit Crew, TM-Patrol

Post Reply
amgreborn
pedestrian
pedestrian
Posts: 6
Joined: 05 Jun 2018 15:38
Owned TM-games: TMU

SpectatorStatus doesn't update properly

Post by amgreborn » 07 Jul 2018 16:46

I'm trying to build a spectator plugin, but the 'SpectatorStatus' by no means does what I expect it to do. Same thing with the TrackMania.PlayerInfoChanged event. If, for example, a player is in spec, and has their camera set to Replay/Auto, then the player will continuously jump from player to player. When that happens, I expect the TrackMania.PlayerInfoChanged (and the xaseco event onPlayerInfoChanged aswell) event to be triggered, but it simply doesn't. And even if I manually use the method GetPlayerInfo for a specific login (and parameter 1, because its a united server), it returns incorrect values for "SpectatorStatus". The spectators camera jumps from player to player, because its set to auto, but the SpectatorStatus' value has its TargetId part (and more..) not changed. Why does this happen?? I can't correctly determine which player someone is spectating. And there are quite a few more bugs regarding the spectatorstatus and the triggering of the event above.

I prepared a small file to test. Download this https://koyaanis.com/p/plugin.spectest.zip, change the login of some player you want the status of, and start xaseco in the terminal. Make the player go in spec with camera set to Replay/Auto. Type /i in chat whenever the spectator has switched from one player to another and look at the console output. I'm really confused by this. Can someone help or know why this happens?

This is how SpectatorStatus is build: SpectatorStatus = Spectator + TemporarySpectator * 10 + PureSpectator * 100 + AutoTarget * 1000 + CurrentTargetId * 10000

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 156
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Location: Berlin
Contact:

Re: SpectatorStatus doesn't update properly

Post by L3cKy » 08 Jul 2018 17:49

Well you got that wrong ... it is just that YOUR spectator_status is not changing at the auto spectator status.
Because your are at the status for the auto spectator and that dont change untill you switch to free cam, follow cam or just go back to race.

Edit: To show it better ;)

Image

Image

Image

Image


So you see YOUR status dont change by itself ... its need to be triggered ...
what you need to figure out is how to call "if i get spectated > result" instead of "if i spectate > result"
And this wont be that easy tho ^^ (maybe impossible)

That i used for the spectator status chat message:

Code: Select all

Aseco::registerEvent('onPlayerInfoChanged', 'checkmyspec');
function  checkmyspec ($aseco, $info) {
	if ($aseco->server->getGame() == 'TMF' && $aseco->server->gamestate != Server::SCORE) {
		$player = $aseco->server->players->getPlayer($info['Login']);
		$speck_check = $info['SpectatorStatus'];
		$msg = '$g' . $player->nickname . '$z$s$fffSpecStatus =$z$s$f00 '.$speck_check.'';
		$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($msg), $player->login);
	}
}

amgreborn
pedestrian
pedestrian
Posts: 6
Joined: 05 Jun 2018 15:38
Owned TM-games: TMU

Re: SpectatorStatus doesn't update properly

Post by amgreborn » 09 Jul 2018 11:17

I will check it out in ~1 week and EDIT this post to respond. Im in the middle of my exams atm

Post Reply