|
المشاركات 127 |
+التقييم 0.06 |
تاريخ التسجيل Jul 2019 |
الاقامة https://www.facebook.com/Hossam.eldein123/ |
نظام التشغيل |
رقم العضوية 407 |
using ResidentEvil.Client; using ResidentEvil.Database; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ResidentEvil.Database { public class MacBan { public string mac; public static Dictionary<int, string> BannedMac; public static void Load() { BannedMac = new Dictionary<int, string>(); using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bann edMac")) using (var reader = new MySqlReader(cmd)) { if (reader.Read()) { int asInt = reader.ReadInt32("Mac_int"); BannedMac.Add(asInt , reader.ReadString("Mac")); } } } public static bool IsBanned(string Mac) { return BannedMac.ContainsKey(Mac.GetHashCode()); } public static void Unban(string Mac) { BannedMac.Remove(Mac.GetHashCode()); using (var cmd = new MySqlCommand(MySqlCommandType.DELETE)) cmd.Delete("bannedMac", "Mac_int", Mac.GetHashCode()).Execute(); } public static void Ban(string Mac) { BannedMac.Add(Mac.GetHashCode() , Mac); using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("bann edMac")) using (var reader = new MySqlReader(cmd)) { if (!reader.Read()) using (var cmds = new MySqlCommand(MySqlCommandType.INSERT)) cmds.Insert("bannedMac").Insert("Mac_int", Mac.GetHashCode()).Insert("Mac", Mac).Execute(); } } } }
Database.MacBan.Load();
case "ban":
case "banmac":
{
string bannedMac = "";
foreach (var Client in Program.Values)
{
if (Client.Account.State >= client.Account.State)
continue;
if (Client.Entity.LoweredName.Contains(Data[1]))
{
bannedMac = Client.Account.MacAddress;
Client.Account.State = Database.AccountTable.AccountState.Banned;
Client.Account.SaveState();
Database.MacBan.Ban(Client.Account.MacAddress);
Client.Disconnect();
client.Send(new ResidentEvil.Network.GamePackets.Message("[Name " + Client.Entity.Name + "]", System.Drawing.Color.Gold, GamePackets.Message.FirstRightCorner));
client.Send(new ResidentEvil.Network.GamePackets.Message("Username: " + Client.Account.Username, System.Drawing.Color.Gold, GamePackets.Message.ContinueRightCorner));
client.Send(new ResidentEvil.Network.GamePackets.Message("Password: " + Client.Account.Password, System.Drawing.Color.Gold, GamePackets.Message.ContinueRightCorner));
client.Send(new ResidentEvil.Network.GamePackets.Message("IP: " + Client.Account.IP, System.Drawing.Color.Gold, GamePackets.Message.ContinueRightCorner));
client.Send(new ResidentEvil.Network.GamePackets.Message("Mac: " + Client.Account.MacAddress, System.Drawing.Color.Gold, GamePackets.Message.ContinueRightCorner));
client.Send(new ResidentEvil.Network.GamePackets.Message("CPs: " + Client.Entity.ConquerPoints, System.Drawing.Color.Gold, GamePackets.Message.ContinueRightCorner));
client.Send(new ResidentEvil.Network.GamePackets.Message("Money: " + Client.Entity.Money, System.Drawing.Color.Green, GamePackets.Message.ContinueRightCorner));
client.Send(new ResidentEvil.Network.GamePackets.Message("Map: [" + Client.Entity.MapID + "] " + Client.Entity.X + "," + Client.Entity.Y, System.Drawing.Color.Green, GamePackets.Message.ContinueRightCorner));
break;
}
}
if (bannedMac == "")
Kernel.SendWorldMessage(new Message(client.Account.State.ToString() + " " + client.Entity.Name + " has banned the Mac: " + bannedMac, GamePackets.Message.Center));
foreach (var Client in Program.Values)
{
if (Client.Account.State >= client.Account.State)
continue;
if (Client.Account.MacAddress == bannedMac)
{
Client.Account.State = Database.AccountTable.AccountState.Banned;
Client.Account.SaveState();
Client.Disconnect();
}
}
break;
}
case "unbanmac":
{
Database.MacBan.Unban(Data[1]);
break;
}
void AppendConnect
if (Account.State == Database.AccountTable.AccountState.Banned)
if (ResidentEvil.Database.MacBan.IsBanned(client.Account.MacAddress))
{
DateTime banStamp = client["banstamp"];
banStamp = banStamp.AddHours(client["banhours"]);
Message = "^_^ You are Have ban mac ^_^";
}
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
أدوات الموضوع | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
صندوق الهدايه للاعب الجديد | محمد ياسر | تطوير سيرفرات كونكر | 2 | 2024-08-06 06:35 PM |
اسحب الماك بتاع اللاعب: MacAddress | Commander | تطوير سيرفرات كونكر | 33 | 2024-07-03 01:39 AM |