
Is there a possible way to get a list who is spectating who?
Moderator: English Moderator
Code: Select all
main () {
declare netwrite Text[Text] Net_RecordsEyepiece_SpectatingPlayers for Teams[0];
Net_RecordsEyepiece_SpectatingPlayers[""^InputPlayer.Login] = ""^GUIPlayer.Login;
}
Code: Select all
main () {
declare netread Text[Text] Net_RecordsEyepiece_SpectatingPlayers for Teams[0];
log(Now ^" : "^ Net_RecordsEyepiece_SpectatingPlayers);
}
Code: Select all
The objects of type CGameTeamProfile does not support declaration of attribute Net_RecordsEyepiece_SpectatingPlayers.
Code: Select all
The objects of type CTrackManiaPlayer does not support declaration of attribute Net_RecordsEyepiece_SpectatingPlayers.
Code: Select all
[]
Code: Select all
main() {
// Sends to gamemode spectated player login
declare netwrite Text Net_PlayerSpectatorTarget for UI;
// Receives from gamemode combined targets list: TargetLogin[SpectatorLogin];
declare netread Text[Text] Net_SpectatedPlayers for Teams[0];
while (True) {
yield;
if (IsSpectatorMode && GUIPlayer != Null) {
Net_PlayerSpectatorTarget = GUIPlayer.User.Login;
} else {
Net_PlayerSpectatorTarget = "";
}
foreach (SpectatorLogin => TargetLogin in Net_SpectatedPlayers) {
// ...
}
}
}
Code: Select all
***StartServer***
***
// Send combined information about spectators
declare netwrite Text[Text] Net_SpectatedPlayers for Teams[0];
***
***PlayLoop***
***
// Clear array (avoid sending disconnected spectators logins)
Net_SpectatedPlayers.clear();
foreach (Player in Spectators) {
// Receive who is spectated by player
declare UI for Player <=> UIManager.GetUI(Player);
if (UI != Null) {
declare netread Text Net_PlayerSpectatorTarget for UI;
// Add logins to combined array
Net_SpectatedPlayers[Player.User.Login] = Net_PlayerSpectatorTarget;
}
}
***
Not tested inside a controller, but this works inside a title, datas declared with "This" are present on all layers/manialinks, then this could be :undef.de wrote: GetterWidgetCode: Select all
main () { declare netwrite Text[Text] Net_RecordsEyepiece_SpectatingPlayers for Teams[0]; Net_RecordsEyepiece_SpectatingPlayers[""^InputPlayer.Login] = ""^GUIPlayer.Login; }
Code: Select all
main () { declare netread Text[Text] Net_RecordsEyepiece_SpectatingPlayers for Teams[0]; log(Now ^" : "^ Net_RecordsEyepiece_SpectatingPlayers); }
Code: Select all
main () {
declare Net_RecordsEyepiece_SpectatingPlayers for This = Text[Text];
Net_RecordsEyepiece_SpectatingPlayers[InputPlayer.Login] = GUIPlayer.Login;
}
Code: Select all
main () {
declare Net_RecordsEyepiece_SpectatingPlayers for This = Text[Text];
log(Now ^" : "^ Net_RecordsEyepiece_SpectatingPlayers);
}
Does not work, because the Getter has to be run at a remote player client (Player A) and the Widget is your client (Player B). Otherwise GUIPlayer is not the spectated Player from Player A (see here for details).spaii wrote: Not tested inside a controller, but this works inside a title, datas declared with "This" are present on all layers/manialinks, then this could be :
GetterWidgetCode: Select all
main () { declare Net_RecordsEyepiece_SpectatingPlayers for This = Text[Text]; Net_RecordsEyepiece_SpectatingPlayers[InputPlayer.Login] = GUIPlayer.Login; }
Code: Select all
main () { declare Net_RecordsEyepiece_SpectatingPlayers for This = Text[Text]; log(Now ^" : "^ Net_RecordsEyepiece_SpectatingPlayers); }
Thanks for that info... good to know!spaii wrote:"This" are present on all layers/manialinks
Code: Select all
declare netread Net_LibUI_Settings for Teams[0];
log(Net_LibUI_Settings);
Code: Select all
[
TimeGap_Mode=>BestRace,
TimeGap_Display=>True,
TimeGap_Position=>23. -90. 5.,
Chrono_Display=>True,
Chrono_Position=>110.3 -80.5 5.,
CheckpointTime_Mode=>BestRace,
CheckpointTime_DisplayTimeDiff=>True,
CheckpointTime_Display=>True,
CheckpointTime_Position=>-8. 31.8 -10.,
PrevBestTime_Display=>False,
PrevBestTime_Position=>158. -67. 5.,
SpeedAndDistance_Display=>False,
SpeedAndDistance_Position=>158. -79.5 5.,
Countdown_Display=>True,
Countdown_Position=>105. -76.5 5.,
IndependantLaps=>True,
Countdown_CutOffTimeLimit=>26544717
]
Users browsing this forum: No registered users and 3 guests