Esempio n. 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");
            }
        }
Esempio n. 2
0
        public void OnLoginAttempt(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", 1, "Der Name muss dem Format: Vorname_Nachname entsprechen.");
                return;
            }

            if (!PlayerDatabase.DoesPlayerNameExists(username))
            {
                player.Emit("alttutorial:loginError", 1, "Der Name ist nicht vergeben!");
                return;
            }

            if (PlayerDatabase.CheckLoginDetails(username, password))
            {
                //Passwort ist korrekt
                player.LoadPlayer(username);
                player.Spawn(new Position(0, 0, 72), 0);
                player.Emit("alttutorial:loginSuccess");
                player.SendNotification("Erfolgreich eingeloggt!");
                if (player.HasData("alttutorial:loginattempts"))
                {
                    player.DeleteData("alttutorial:loginattempts");
                }
            }
            else
            {
                //Passwort ist nicht korrekt
                player.Emit("alttutorial:loginError", 1, "Login Daten stimmen nicht überein!");

                int attempts = 1;
                if (player.HasData("alttutorial:loginattempts"))
                {
                    player.GetData("alttutorial:loginattempts", out attempts);

                    if (attempts == 2)
                    {
                        player.Kick("Zu viele Loginversuche.");
                    }
                    else
                    {
                        attempts++;
                    }
                }
                player.SetData("alttutorial:loginattempts", attempts);
            }
        }
Esempio n. 3
0
        public void OnPlayerConnect(MyPlayer player, string reason)
        {
            player.Model = (uint)PedModel.FreemodeMale01;
            player.Spawn(new Position(0, 0, 75), 0);
            player.Emit("altvtutorial:configflags");

            //Alt.Emit("eventname");

            /*if (PlayerDatabase.DoesPlayerNameExists(player.Name)) {
             *  player.LoadPlayer(player.Name);
             * } else {
             *  player.CreatePlayer(player.Name, "1234");
             * }
             *
             * player.SendNotification($"Cash: ~b~{player.Cash}$");*/
        }