Hi,
Is there a way to retrieve the user(login) you are spectatig using Maniascript? I thought that InputPlayer was the main player and GUIPlayer the player being spectated. But both of them have information on the main player and not on the spectated player.
So I have Login1 spectating Login2. Login2 playes the game. in both variables on the game of Login1 I find Login1 and on the game of Login2 I find Login2.
Ideally I should have Login2 somewhere in the maniascript of Login1.
Can we have some information about the 3 variables GUIPlayer, InputPlayer and LocalUser? Is there something I am missing?
Thanks,
[FIXED]User you are spectating
Moderator: English Moderator
[FIXED]User you are spectating
Last edited by oliverde8 on 18 Oct 2014, 09:54, edited 1 time in total.

Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
- w1lla
- Posts: 2287
- Joined: 15 Jun 2010, 11:09
- Manialink: maniaplanetblog
- Location: Netherlands
- Contact:
Re: User you are spectating
Code: Select all
declare CSmPlayer TargetPlayer;
if (GUIPlayer != Null) TargetPlayer <=> GUIPlayer;
else TargetPlayer <=> InputPlayer;
TM² Info
SM Info
QM Info
OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
SM Info
QM Info
OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
Re: User you are spectating
Hey, thanks
but GuiPlayer doesen't contain the information about the player I am spectating. At least in TM² environnement Rounds script mode it doesen't I have only my login in it.
but GuiPlayer doesen't contain the information about the player I am spectating. At least in TM² environnement Rounds script mode it doesen't I have only my login in it.

Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
- w1lla
- Posts: 2287
- Joined: 15 Jun 2010, 11:09
- Manialink: maniaplanetblog
- Location: Netherlands
- Contact:
Re: User you are spectating
See:
https://github.com/maniaplanet/game-mod ... .txt#L2133
https://github.com/maniaplanet/game-mod ... .txt#L2148
Its basicly a Id of players and not login i believe.
https://github.com/maniaplanet/game-mod ... .txt#L2133
https://github.com/maniaplanet/game-mod ... .txt#L2148
Its basicly a Id of players and not login i believe.
TM² Info
SM Info
QM Info
OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
SM Info
QM Info
OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
Re: User you are spectating
Well I do vaguely remeber using GUIPlayer before to get the specatated . But I am in ScriptInGame context and I wonder if there isn't somthing broken.
I also tried this
But both SpectatorForcedTarget, and SpectatorAutoTarget are always Null so nothing there either.
I also tried this
Code: Select all
if(ClientUI.SpectatorAutoTarget != NullId){
log("Spectating : "^Players[ClientUI.SpectatorAutoTarget].Name);
}
if(SpectatorForcedTarget != NullId){
log("Spectating : "^Players[ClientUI.SpectatorForcedTarget].Name);
}

Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
- w1lla
- Posts: 2287
- Joined: 15 Jun 2010, 11:09
- Manialink: maniaplanetblog
- Location: Netherlands
- Contact:
Re: User you are spectating
Did you try a Ident value?
TM² Info
SM Info
QM Info
OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
SM Info
QM Info
OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
Re: User you are spectating
GUIPlayer is definitely the way to go
it contains the player whose values are shown at the time, meaning the player you're spectating
if it's not working correctly in TM, then it's a bug and Nadeo should be informed about it
it contains the player whose values are shown at the time, meaning the player you're spectating
if it's not working correctly in TM, then it's a bug and Nadeo should be informed about it
Re: User you are spectating
InputPlayer is always the local player.
LocalUser is always the user associated to the local player.
GUIPlayer can take three values :
- when spectating a specific player, GUIPlayer should be the spectated player,
- when spectating with a "global cam" (cam 7, overview of the map, free view, ...) GUIPlayer is Null,
- when playing GUIPlayer is the local player (== InputPlayer).
InputPlayer, LocalUser and GUIPlayer are Null for a short period of time when connecting to the server during the initialization of the Manialink. So if you log() one of these variables only at the beginning of the script they will be Null.
If you don't have this behavior, then there's a problem.
LocalUser is always the user associated to the local player.
GUIPlayer can take three values :
- when spectating a specific player, GUIPlayer should be the spectated player,
- when spectating with a "global cam" (cam 7, overview of the map, free view, ...) GUIPlayer is Null,
- when playing GUIPlayer is the local player (== InputPlayer).
InputPlayer, LocalUser and GUIPlayer are Null for a short period of time when connecting to the server during the initialization of the Manialink. So if you log() one of these variables only at the beginning of the script they will be Null.
If you don't have this behavior, then there's a problem.
Re: User you are spectating
Hi, I confirm there is a problem.
I had hope it was fix I know it was crazy for me to hope for that so soon.
I put this code inside a Manialinks maniascript's while loop :
I did see null while switching between players but beside that always my nickname was in the logs never saw the nickname of the player I spectate.
I tried in Script & Legacy Rounds mode as I needed the feature there.
Can you please fix this?
I had hope it was fix I know it was crazy for me to hope for that so soon.
I put this code inside a Manialinks maniascript's while loop :
Code: Select all
if (GUIPlayer != Null) {
log("GUIPlayer is "^GUIPlayer.Name);
} else {
log("GUIPlayer is NULL");
}
I tried in Script & Legacy Rounds mode as I needed the feature there.
Can you please fix this?

Developper for The next generation, Clean and Powerfull controller eXpansion for your SM & TM server . Working on eXpansion² with full MP4 support and many other awesome features...
Re: User you are spectating
Should this not be easily possible with the (unfortunately unavailable in TM) CTmMode::Spectators?
When is this available in TM? It would help very much to handle many things in the HUD of a controller.
When is this available in TM? It would help very much to handle many things in the HUD of a controller.
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.
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.
Who is online
Users browsing this forum: No registered users and 1 guest