[FIXED]User you are spectating

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

oliverde8
Posts: 1286
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

[FIXED]User you are spectating

Post by oliverde8 »

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,
Last edited by oliverde8 on 18 Oct 2014, 09:54, edited 1 time in total.
Image
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...
User avatar
w1lla
Posts: 2287
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: User you are spectating

Post by w1lla »

Code: Select all

		declare CSmPlayer TargetPlayer;
		if (GUIPlayer != Null) TargetPlayer <=> GUIPlayer;
		else TargetPlayer <=> InputPlayer;
This can be helpfull i think?
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
oliverde8
Posts: 1286
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: User you are spectating

Post by oliverde8 »

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.
Image
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...
User avatar
w1lla
Posts: 2287
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: User you are spectating

Post by w1lla »

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
oliverde8
Posts: 1286
Joined: 16 Jun 2010, 07:33
Location: in a Blue Box

Re: User you are spectating

Post by oliverde8 »

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

Code: Select all

if(ClientUI.SpectatorAutoTarget != NullId){
    log("Spectating : "^Players[ClientUI.SpectatorAutoTarget].Name);
}

if(SpectatorForcedTarget != NullId){
    log("Spectating : "^Players[ClientUI.SpectatorForcedTarget].Name);
}
But both SpectatorForcedTarget, and SpectatorAutoTarget are always Null so nothing there either.
Image
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...
User avatar
w1lla
Posts: 2287
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: User you are spectating

Post by w1lla »

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
User avatar
steeffeen
Translator
Translator
Posts: 2463
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: User you are spectating

Post by steeffeen »

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
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks
    User avatar
    Eole
    Nadeo
    Nadeo
    Posts: 1265
    Joined: 26 Apr 2011, 21:08

    Re: User you are spectating

    Post by Eole »

    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.
    Contribute to the ManiaPlanet documentation on GitHub
    A question about ManiaScript? Ask it here!
    oliverde8
    Posts: 1286
    Joined: 16 Jun 2010, 07:33
    Location: in a Blue Box

    Re: User you are spectating

    Post by oliverde8 »

    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 :

    Code: Select all

    if (GUIPlayer != Null) {
        log("GUIPlayer is "^GUIPlayer.Name);
    } else {
        log("GUIPlayer is NULL");
    }
    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?
    Image
    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...
    User avatar
    undef.de
    Posts: 2095
    Joined: 06 Apr 2011, 21:57
    Location: Germany, North Sea Coast
    Contact:

    Re: User you are spectating

    Post by undef.de »

    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.
    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.
    Post Reply

    Return to “ManiaScript”

    Who is online

    Users browsing this forum: No registered users and 1 guest