1. Hello,
    i need first time destroy all players one CUI... Its not problem i do it with:
    Code:
            private void DestroyGUI()
            {
                int size = BasePlayer.activePlayerList.Count;
                for(int i = 0; i < size; i++)
                {
                    BasePlayer bp = BasePlayer.activePlayerList[i];
                    CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo(bp.net.connection), null, "DestroyUI", new Facepunch.ObjectList("inf"));
                }
            } 
    But i send new cui for one player when he respawn:

    Code:
           public void showInfoGui(BasePlayer player) {
             DestroyGUI();
            
             var elements = new CuiElementContainer();
             var inf = elements.Add(new CuiPanel
                {
                    Image =
                    {
                        Color = "0.1 0.1 0.1 0.6"
                    },
                    RectTransform =
                    {
                        AnchorMin = "0.35 0.9", //Prvni cislo z leva    0.35 0.9
                        AnchorMax = "0.65 0.99"   //                    0.65 0.99
                    },
                    CursorEnabled = false
               
                }, "Hud", "inf");                     
                elements.Add(new CuiLabel
                    {
                        Text =
                        {
                            Text = "SCORRE ",
                            FontSize = 22,
                            Align = TextAnchor.MiddleCenter
                        }
                    }, inf);
                elements.Add(new CuiLabel
                    {
                        Text =
                        {
                            Text = "0",
                            FontSize = 35,
                            Align = TextAnchor.MiddleCenter,
                            Color = "0.9 0.1 0 0.9"        //red
                        },
                        RectTransform =
                        {
                            AnchorMin = "0.25 0.01",
                            AnchorMax = "0.30 0.99"
                        }
                    }, inf);            elements.Add(new CuiLabel
                    {
                        Text =
                        {
                            Text = "0",
                            FontSize = 35,
                            Align = TextAnchor.MiddleCenter,
                            Color = "0.2 0.4 0.8 0.9" //blue
                        },
                        RectTransform =
                        {
                            AnchorMin = "0.7 0.01",
                            AnchorMax = "0.75 0.99"
                        }
                    }, inf);
               
                CuiHelper.AddUi(player, elements);
          
          
           }
    How this add rework for send this cui all players on server? TY
    [DOUBLEPOST=1487177489][/DOUBLEPOST]I try:
    Code:
        private void ShowGUI() {
                int size = BasePlayer.activePlayerList.Count;
                for(int i = 0; i < size; i++)
                {
                    BasePlayer bp = BasePlayer.activePlayerList[i];
            Puts(bp.displayName + " showing gui ");
                    showInfoGui(bp);
                }     
        }
    But this show only last player on server :/
     
  2. Code:
    // Called wheen player wake up
    [HookMethod("OnPlayerSleepEnded")]
    void OnPlayerSleepEnded(BasePlayer player)
    {
        foreach (var pl in BasePlayer.activePlayerList) {
            CuiHelper.DestroyUi(pl, "You_UI_Name");
            showInfoGui(pl);
        }
    }
    
     
  3. Wulf

    Wulf Community Admin

    You don't need the HookMethod attribute. ;)
     
  4. I know, but - thsi is for screen game in plugin for TDM. And when +1 point i need on all clients remove gui and send new with new score... Destroy on all clients is ok... But sending to all clients new gui not work... This cui show only one player (who last conn to server)
     
  5. may you forgot define name of ui element?
     
  6. What? What name of element??
     
  7. I was wrong, all right with ui names and parents.

    Try this

    Code:
    // Called wheen player wake up
    void OnPlayerSleepEnded(BasePlayer player)
    {
        foreach (var pl in BasePlayer.activePlayerList) {
            CuiHelper.DestroyUi(pl, "inf");
            showInfoGui(pl);
        }
    }
    
    and remove calling DestroyGUI() from showInfoGui
     
  8. Ok i try it tomorrow, im in bed now. Thank you.
    I have next one question if i can - can i disable change wears?
    On spawn i give in wear inventory blue or red tshirt, but i need block it (now from red team can loot blue shirt, its bad :D)
     
  9. Work fine... Thank you