Okay so what this does is Whenever someone gets kicked It will add a strike to that person
In me and pros server you get 3 strikes you get banned automatically
NOTE This is not tested but im pretty confident it works
Also This can be used for various things like i said we use it for automatic ban
I will not be releasing that this is where u the community come in to code that
Anyway here it is
This goes in Chat.cs
Code:
case "kick":
{
if(CSocket.Client.isGM || CSocket.Client.isPM)
{
if(Command.Length < 2)
{
CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Command example: /kick player", Struct.ChatType.Talk));
break;
}
bool kicked = false;
//lock(Nano.ClientPool)
//{
try
{
Monitor.Enter(Nano.ClientPool);
foreach(KeyValuePair<int, ClientSocket> Player in Nano.ClientPool)
{
if(Player.Value.Client.Name.ToLower() == Command[1].ToLower())
{
if(Player.Value.Client.isPM && !CSocket.Client.isPM)
CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "GMs cannot kick PMs, sorry!", Struct.ChatType.Top));
else
{
ConquerPacket.ToServer(ConquerPacket.Chat(0, "SYSTEM", "ALLUSERS", Player.Value.Client.Name + " has been kicked from the server", Struct.ChatType.Center), 0);
Player.Value.Disconnect();
kicked = true;
Player.Value.Client.KickStrikes += 1;
}
break;
}
}
//}
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
finally
{
Monitor.Exit(Nano.ClientPool);
}
if(!kicked)
{
CSocket.Send(ConquerPacket.Chat(0, "SYSTEM", CSocket.Client.Name, "[ERROR] Cannot kick player.", Struct.ChatType.Talk));
}
}
break;
}
This goes in Character.cs
Code:
public int KickStrikes = 0;
Last but not least This goes in Database.cs
Code:
public static void Strikes(Character Client)
{
MySqlCommand Cmd = new MySqlCommand("UPDATE `characters` SET `Strikes = " +Client.KickStrikes + DatabaseConnection.NewConnection());
Cmd.ExecuteNonQuery();
Cmd.Connection.Close();
Cmd.Connection.Dispose();
Cmd.Dispose();
}
Code:
Client.KickStrikes = Convert.ToInt32(DR["Strikes"]);
Code:
", `Strikes`= " + Client.KickStrikes +
Also
Edit your character tables According to this
Name:Strikes
Type:int
Length:11
Decimals:0
Not Null
Have Fun And tell me if it doesnt work cause i havent tested it out yet
#edit saved and loaded from db






