I created Button with CUI.
What do i write in field "Command" to reference any method when i press the button?Code:elements.Add(new CuiButton { Button = { Command = "" Color = "0.8 0.8 0.8 0.2" }, RectTransform = { AnchorMin = $"0.76 {1 - 0.07*i + 0.006}", AnchorMax = $"0.87 {1 - 0.07*(i - 1)}" }, Text = { Text = "+", FontSize = 22, Align = TextAnchor.MiddleCenter } }, mainName); }
Rust CUI command button?
Discussion in 'Rust Development' started by Shade4, Sep 3, 2017.
-
Wulf Community Admin
You'd use a console command.
-
Code:
Command = "GUI.usewood",
Code:[ConsoleCommand("GUI.usewood")] private void test(BasePlayer player) { player.ChatMessage("It works"); }
-
Wulf Community Admin
-
Code:
[ConsoleCommand("GUI.usewood")] private void test(ConsoleSystem.Arg Args) { BasePlayer player = BasePlayer.FindByID(System.Convert.ToUInt64(Args.Args[0])); SendReply(player, "It works"); }
-
Wulf Community Admin
-
-
Wulf Community Admin
-
I am trying to send message to player but it dont work
-
Code:
[ConsoleCommand("GUI.usewood")] void YourConsoleCommand(ConsoleSystem.Arg arg) { var player = arg.Player(); if(player == null) return; SendReply(player, "It Works!"); }
-
-
-
[DOUBLEPOST=1504465607][/DOUBLEPOST]The problem was that ConsoleCommand should be write with small letters... -
Wulf Community Admin