Nos partenaires et nous-mêmes utilisons différentes technologies, telles que les cookies, pour personnaliser les contenus et les publicités, proposer des fonctionnalités sur les réseaux sociaux et analyser le trafic. Merci de cliquer sur le bouton ci-dessous pour donner votre accord. Vous pouvez changer d’avis et modifier vos choix à tout moment. Informations RGPD
/** * Spectators library */ #Const Version "2016-05-19" #Const ScriptName "Libs/Nadeo/Spectators.Script.txt" // ---------------------------------- // // Constants // ---------------------------------- // #Const C_Camera_All -1 #Const C_Camera_ThirdPerson 0 #Const C_Camera_FirstPerson 1 // ---------------------------------- // // Globales // ---------------------------------- // declare Boolean G_ForceClan; ///< Force spectators to watch players from their clan // ---------------------------------- // // Functions // ---------------------------------- // // ---------------------------------- // // Public // ---------------------------------- // // ---------------------------------- // /** Return the version number of the script * * @return The version number of the script */ Text GetScriptVersion() { return Version; } // ---------------------------------- // /** Return the name of the script * * @return The name of the script */ Text GetScriptName() { return ScriptName; } // ---------------------------------- // /// Get the camera constants Integer Camera_All() { return C_Camera_All; } Integer Camera_ThirdPerson() { return C_Camera_ThirdPerson; } Integer Camera_FirstPerson() { return C_Camera_FirstPerson; } // ---------------------------------- // /** Force a player to spectate a specific clan * * @param _UI The player's UI * @param _Clan The clan to spectate */ Void SetForcedTarget_Clan(CUIConfig _UI, Integer _Clan) { if (_UI == Null) return; declare Integer LibSpectators_ForcedTarget_Clan for _UI = -1; LibSpectators_ForcedTarget_Clan = _Clan; // _UI.Spectator_SetForcedTarget_Clan(LibSpectators_ForcedTarget_Clan); _UI.SpectatorForcedClan = LibSpectators_ForcedTarget_Clan; } Integer GetForcedTarget_Clan(CUIConfig _UI) { if (_UI == Null) return -1; declare Integer LibSpectators_ForcedTarget_Clan for _UI = -1; return LibSpectators_ForcedTarget_Clan; } // ---------------------------------- // /** Force spectators to watch players from their clan * * @param _Forced True to force */ Void ForceClan(Boolean _Forced) { G_ForceClan = _Forced; foreach (Score in Scores) { declare UI <=> UIManager.GetUI(Score.User); if (UI == Null) continue; if (G_ForceClan) SetForcedTarget_Clan(UI, Score.TeamNum); else SetForcedTarget_Clan(UI, -1); } } Void ForceCamera(Integer _Camera) { UIManager.UIAll.SpectatorForceCameraType = _Camera; } // ---------------------------------- // /// Update the library Void Yield() { if (G_ForceClan) { foreach (Player in AllPlayers) { if (Player.Score == Null) continue; declare UI <=> UIManager.GetUI(Player); if (UI == Null) continue; if (GetForcedTarget_Clan(UI) != Player.Score.TeamNum) { SetForcedTarget_Clan(UI, Player.Score.TeamNum); } } } } // ---------------------------------- // /// Unload the library Void Unload() { G_ForceClan = False; } // ---------------------------------- // /// Load the library Void Load() { Unload(); }