Hello,
i need first time destroy all players one CUI... Its not problem i do it with:
But i send new cui for one player when he respawn: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")); } }
How this add rework for send this cui all players on server? TYCode: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); }
[DOUBLEPOST=1487177489][/DOUBLEPOST]I try:
But this show only last player on server :/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); } }
Removing and adding CUI to reload it?
Discussion in 'Rust Development' started by zhulenejsnek, Feb 15, 2017.
-
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); } }
-
Wulf Community Admin
-
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)
-
-
What? What name of element??
-
Try this
Code:// Called wheen player wake up void OnPlayerSleepEnded(BasePlayer player) { foreach (var pl in BasePlayer.activePlayerList) { CuiHelper.DestroyUi(pl, "inf"); showInfoGui(pl); } }
-
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 ) -