Creating input fields for username/password?Solved

Hi, I'm going to do the registration system.

To enter username and password, can we make spaces(blanks)?

thanks in advance for your help

Oxide.Game.Rust.Cui.CuiInputFieldComponent

Take a look.

            expandedContainer.Add(new CuiElement
            {

                Components =
                {
                    new CuiInputFieldComponent
                    {
                        Text = "Testx",
                        FontSize = 14,
                        Align = TextAnchor.MiddleCenter,
                        Color =  "0.31 2 0.31 1",
                 //       Command = command, 
                        IsPassword = false, 
                        CharsLimit = 32
                    },
                    new CuiRectTransformComponent
                    {
                        AnchorMin = "0.206 0.689",
                        AnchorMax = "0.343 0.731"
                    }
                }
            });


0UJmx4pH.png

I'm not getting an error, but it doesn't show



Merged post

YIeLzDqC.png

I found it but I want it to be adjusted according to the color.

Merged post

also needs to detect the entered text, how can I do
Set command, and when you use enter you send content as an argument with this command from player.

can you give a small sample

ı cant do this

Please, clarify. You set a command. When you press Enter, it sends this command.
But doesn't it happen that I want to save the username and password?
5d6baaccae8cf.png SwenenzY
But doesn't it happen that I want to save the username and password?
You talking about something doesn't work, but you do not show your code, how are we supposed to help you exactly?

all here, I hope it helps

using System.Collections.Generic;
using Oxide.Game.Rust.Cui;
using UnityEngine;
using Oxide.Core.Plugins;
using System;
using Facepunch.Models.Database;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using UnityEngine;
using System.Collections;
using System.Linq;
using UnityEngine;
using Oxide.Game.Rust.Cui;
using Newtonsoft.Json;
using UnityEngine.UI;
using Component = UnityEngine.Component;

namespace Oxide.Plugins
{
    
    [Info("Login System", "SwenenzY", "1.0.1")]
    [Description("Login System")]
    internal class LoginSystem : RustPlugin
    {
        private CuiElementContainer _expandedContainer = new CuiElementContainer();
        private const string MainCanvas = "mainCanvas";
        private const string EcButton = "ecButton";
        private const string Texec = "Texec";
        private const string UserNameField = "UserName";
        private const string PassWordField = "PassWord";
        private const string UserNameText = "UserNameText";
        private const string PassWordtText = "PassWordtText";
        private const string RegisterButton = "RegisterButton";
        public string Type => "UnityEngine.UI.InputField";
        [ChatCommand("menu")]
        private void open_menu(BasePlayer player)
        {
            BuildUı(player);
           

        }
        [ConsoleCommand("menu_remove")]
        private void menu_remove(ConsoleSystem.Arg args)
        {
            BasePlayer player = BasePlayer.FindByID(System.Convert.ToUInt64(args.Args[0]));

            CuiHelper.DestroyUi(player, MainCanvas);

        }
        public class CuiInputField
        {
            public CuiInputFieldComponent InputField { get; } = new CuiInputFieldComponent();
			public CuiRectTransformComponent RectTransform { get; } = new CuiRectTransformComponent();
            public float FadeOut { get; set; }
        }
        public class CuiPoint
        {
            public float X { get; set; } = 0f;
            public float Y { get; set; } = 0f;

            public CuiPoint() { }

            public CuiPoint(float x, float y)
            {
                X = x;
                Y = y;
            }

            public override string ToString() => $"{X} {Y}";
        }
        [ConsoleCommand("GetPassUser")]
        private void  GetPassUser( ConsoleSystem.Arg args )
        {
            Puts("Work");
			Puts(args.Args[0]);
        }

        private void BuildUı(BasePlayer player) 
                
        {
            
            _expandedContainer.Clear(); 
            // PANEL
            _expandedContainer.Add(new CuiPanel 
            {
                Image = {
                    //    Color = "0.6 0.02 0.2 3.92" // rgba(153,0,51,1) // 0.6 0.02 0.2 3.92
                    Color = "0.37 0.02 0.01 3.92",
                    Sprite = "assets/content/textures/generic/fulltransparent.tga"
                },
 
                RectTransform = {
                    AnchorMin = "0.049 0.049",
                    AnchorMax = "0.948 0.949"
                },
                CursorEnabled = true,
            }, "Overlay", MainCanvas);
			
            // CLOSE
            _expandedContainer.Add(new CuiButton 
            {
                RectTransform = {
                AnchorMin = "0.875 0.89",
                AnchorMax = "0.934 0.925"
            },
                Button = {   Command = "menu_remove " + player.userID, Color = ".31 0.31 0.31 1" },
                Text = { Text = "Kapat", Align = TextAnchor.MiddleCenter, FontSize = 20 },
            }, MainCanvas, EcButton);
			
            //  UPPER TEXT
           _expandedContainer.Add(new CuiLabel 
            {
                Text =
                {
                    Text = "Hexagon Role Play Kayıt - DEVELOPED BY SWENENZY", 
                    Align = TextAnchor.MiddleCenter, 
                    Color = "0.98 0.98 0.01 1"
                },
                RectTransform = {       
                    AnchorMin = "0.319 0.904",
                    AnchorMax = "0.672 0.928" 
                }
            }, MainCanvas, Texec);
            
            // USERNAME FİELD BACKGROUND
            _expandedContainer.Add(new CuiButton //Add button to change size of the UI
            {
                RectTransform = {
                AnchorMin = "0.206 0.689",
                AnchorMax = "0.343 0.731"   
            },
                Button = {    Color = "1.96 0 0.78 7.84" },
                Text =
                {
                    Text = "Kullanıcı Adı", 
                    Align = TextAnchor.UpperCenter ,
                    FontSize = 10
                },
            }, MainCanvas, UserNameField);
            
            // USERNAME FİELD
            _expandedContainer.Add(new CuiElement
            {
                Parent = MainCanvas,  Name = UserNameField, FadeOut = 0.5f,
                Components =   {
                  new CuiInputFieldComponent  {
                        Text = "",
                        FontSize = 14,
                        Align = TextAnchor.MiddleCenter,
                        Color =  "0.31 0.31 0.31 1",
                        IsPassword = false, 
                        CharsLimit = 32
                    },
                  
                  new CuiRectTransformComponent {
                        AnchorMin = "0.206 0.689",
                        AnchorMax = "0.343 0.731"   ,
                        OffsetMin = "0.206 0.689",
                        OffsetMax = "0.343 0.731" }
                }
            });
            
            // USER NAME TEXT
            _expandedContainer.Add(new CuiLabel 
            {
                Text =
                {
                    Text = "Kullanıcı Adı :", 
                    Align = TextAnchor.MiddleCenter, 
                    Color = "0.98 0.98 0.01 1"
                },
                RectTransform = {       
                    AnchorMin = "0.105 0.699",
                    AnchorMax = "0.173 0.722" 
                }
            }, MainCanvas, UserNameField);
            ///////////////////////////////////////
            // PASSWORD  FİELD BACKGROUND
            _expandedContainer.Add(new CuiButton
            {
                RectTransform = {
                    AnchorMin = "0.206 0.603",
                    AnchorMax = "0.343 0.644"   
                },
                Button =
                {
                    Color = "1.96 0 0.78 7.84"
                },
                Text =
                {
                    Text = "Şifre", 
                    Align = TextAnchor.UpperCenter ,
                    FontSize = 10
                },
            }, MainCanvas, PassWordField);
            
            // PASSWORD FİELD
            _expandedContainer.Add(new CuiElement
            {
                Parent = MainCanvas,  Name = PassWordField, FadeOut = 0.5f,
                Components =   {
                    new CuiInputFieldComponent  {
                        Text = "",
                        FontSize = 14,
                        Align = TextAnchor.MiddleCenter,
                        Color =  "0.31 0.31 0.31 1",
                        IsPassword = true, 
                        CharsLimit = 32
                    },
                  
                    new CuiRectTransformComponent {
                        AnchorMin = "0.206 0.603",
                        AnchorMax = "0.343 0.644"   ,
                        OffsetMin = "0.206 0.603",
                        OffsetMax = "0.343 0.644" }
                }
            });
            
            // PASSWORD TEXT
            _expandedContainer.Add(new CuiLabel 
            {
                Text =
                {
                    Text = "Şifre :", 
                    Align = TextAnchor.MiddleCenter, 
                    Color = "0.98 0.98 0.01 1"
                },
                RectTransform = {       
                    AnchorMin = "0.145 0.611",
                    AnchorMax = "0.173 0.636"
                }
            }, MainCanvas, PassWordField);
            
            // REGİSTER
            _expandedContainer.Add(new CuiButton 
            {
                RectTransform = {
                    AnchorMin = "0.118 0.443",
                    AnchorMax = "0.313 0.485"
                },
                Button = {   Command = "GetPassUser " + "x", Color = "1.96 0 0.78 7.84" },
                Text = { Text = "Kayıt Ol !", Align = TextAnchor.MiddleCenter, FontSize = 20 },
            }, MainCanvas, RegisterButton);
        
            CuiHelper.AddUi(player, _expandedContainer);
        }
    }


}
Cuiinputfield has property named Command, there you need to specify command name (WITHOUT EXTRA SPACE AT THE END). Entered value will be automatically passed as first argument (arg.Args[0]) when player press enter or escape button in the input field. Buttons have to effect on this.
5ba0b9633e817.png?uid=5ba0b9716c220 2CHEVSKII
Cuiinputfield has property named Command, there you need to specify command name (WITHOUT EXTRA SPACE AT THE END). Entered value will be automatically passed as first argument (arg.Args[0]) when player press enter or escape button in the input field. Buttons have to effect on this.

unknown.png

:D worked

You can make it a public uMod plugin! Congratulations tho
5b6ed4c9ac8e4.jpg misticos
You can make it a public uMod plugin! Congratulations tho

I think this is a good opportunity: D

5b6ed4c9ac8e4.jpg misticos
You can make it a public uMod plugin! Congratulations tho
We have password plugin already aren't we?
5ba0b9633e817.png?uid=5ba0b9716c220 2CHEVSKII
We have password plugin already aren't we?

I don't think any of them have a GUI, but there are a few, yes.

Locked automatically