Пример #1
0
        public void OnRegisterAttempt(MyPlayer player, string username, string password)
        {
            if (player.IsLoggedIn || username.Length < 4 || password.Length < 4)
            {
                return;
            }

            //Vorname_Nachname
            Regex regex = new Regex(@"([a-zA-Z]+)_([a-zA-Z]+)");

            if (!regex.IsMatch(username))
            {
                player.Emit("alttutorial:loginError", 2, "Der Name muss dem Format: Vorname_Nachname entsprechen.");
                return;
            }

            if (PlayerDatabase.DoesPlayerNameExists(username))
            {
                player.Emit("alttutorial:loginError", 2, "Name ist bereits vergeben!");
            }
            else
            {
                player.CreatePlayer(username, password);
                player.Spawn(new Position(0, 0, 72), 0);
                player.Emit("alttutorial:loginSuccess");
            }
        }