static bool VerifyName(Player p, string mppass) { p.verifiedName = false; if (!Server.verify) { return(true); } byte[] hash = null; lock (md5Lock) hash = md5.ComputeHash(enc.GetBytes(Server.salt + p.truename)); string hashHex = BitConverter.ToString(hash); if (!mppass.CaselessEq(hashHex.Replace("-", ""))) { if (!Player.IPInPrivateRange(p.ip)) { p.Leave(null, "Login failed! Close the game and sign in again.", true); return(false); } } else { p.verifiedName = true; } return(true); }
static bool CheckPlayersCount(Group group, Player p) { if (Server.vip.Contains(p.name)) { return(true); } Player[] online = PlayerInfo.Online.Items; if (online.Length >= Server.players && !Player.IPInPrivateRange(p.ip)) { p.Leave(null, "Server full!", true); return(false); } if (group.Permission > LevelPermission.Guest) { return(true); } online = PlayerInfo.Online.Items; int guests = 0; foreach (Player pl in online) { if (pl.Rank <= LevelPermission.Guest) { guests++; } } if (guests < Server.maxGuests) { return(true); } if (Server.guestLimitNotify) { Chat.MessageOps("Guest " + p.truename + " couldn't log in - too many guests."); } Server.s.Log("Guest " + p.truename + " couldn't log in - too many guests."); p.Leave(null, "Server has reached max number of guests", true); return(false); }