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
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.CuiInputFieldComponentTake 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"
}
}
});
I'm not getting an error, but it doesn't show

can you give a small sample
ı cant do this
You talking about something doesn't work, but you do not show your code, how are we supposed to help you exactly?SwenenzY
But doesn't it happen that I want to save the username and password?
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);
}
}
} 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.

:D worked
misticos
You can make it a public uMod plugin! Congratulations tho
I think this is a good opportunity: D
We have password plugin already aren't we?misticos
You can make it a public uMod plugin! Congratulations tho
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.