09-29-2012, 17:22
Hi
guys i have problem with this cod:
In last else when i deactive this cod:
plug worked correctly and kiked player after 3 warn
but kick massege not showed after player kicked : you kick for max warn rechead!!
and when i active this code in last else:
after 1 warn player kicked (and its not correctly Because player must kicked after 3 warns) but now the warn massage : you kick for max warn rechead!!
showed to him after kicked !!
How i can to fix that plugin work for 3warns and also showed kick message : you kick for max warn rechead!!
guys i have problem with this cod:
Code:
public bool warnPlayer(ServerClient client, string reason)
{
int num = 0;
reason = reason.Trim();
reason = reasonParser(reason);
string message = "";
if (playerWarnings.TryGetValue(client.XUID, out num))
{
num++;
if (num >= kickWarnings)
{
message = GetServerCFG("AdminPlug", "warnkickmessage", "[Admin]: <playername> was kicked for <reason>").Replace("<playername>", client.Name).Replace("<reason>", reason).Replace("<warningcount>", num.ToString());
ServerSay(message, true);
ServerCommand("kickclient " + client.ClientNum + " \"[Admin]: you kick for max warn rechead!!\"");
playerWarnings.Remove(client.XUID);
warningTime.Remove(client.XUID);
playerWarnings.Add(client.XUID, 0);
return true;
}
if (num < kickWarnings)
{
playerWarnings.Remove(client.XUID);
playerWarnings.Add(client.XUID, num);
if (warningTime.ContainsKey(client.XUID))
{
warningTime.Remove(client.XUID);
}
warningTime.Add(client.XUID, DateTime.Now.AddHours(warningTTL));
message = GetServerCFG("AdminPlug", "warnmessage", "[Admin]: <playername> was warned for <reason>").Replace("<playername>", client.Name).Replace("<reason>", reason).Replace("<warningcount>", num.ToString());
//ServerCommand("kickclient " + client.ClientNum + " \"[Admin]: you kick for max warn rechead!!\"");
//base.ServerCommand("kickclient " + client.ClientNum);
ServerSay(message, true);
iPrintLnBold(string.Concat(new object[] { "[Admin]: You have been ^3Warned ^7for ^1", reason, " ^7Warning number:^1 ", num }), client);
}
}
else if (!playerWarnings.TryGetValue(client.XUID, out num))
{
num++;
playerWarnings.Add(client.XUID, 1);
if (warningTime.ContainsKey(client.XUID))
{
warningTime.Remove(client.XUID);
}
warningTime.Add(client.XUID, DateTime.Now.AddHours(warningTTL));
iPrintLnBold(string.Concat(new object[] { "[Admin]: You have been ^3Warned ^7for ^1", reason, " ^7Warning number:^1 ", num }), client);
//ServerCommand("kickclient " + client.ClientNum + " \"[Admin]: you kick for max warn rechead!!\"");
message = GetServerCFG("AdminPlug", "warnmessage", "[Admin]: <playername> was kicked for <reason>").Replace("<playername>", client.Name).Replace("<reason>", reason).Replace("<warningcount>", num.ToString());
ServerSay(message, true);
}
return false;
}In last else when i deactive this cod:
Code:
//ServerCommand("kickclient " + client.ClientNum + " \"[Admin]: you kick for max warn reached!!\"");plug worked correctly and kiked player after 3 warn
but kick massege not showed after player kicked : you kick for max warn rechead!!
and when i active this code in last else:
Code:
ServerCommand("kickclient " + client.ClientNum + " \"[Admin]: you kick for max warn rechead!!\"");after 1 warn player kicked (and its not correctly Because player must kicked after 3 warns) but now the warn massage : you kick for max warn rechead!!
showed to him after kicked !!
How i can to fix that plugin work for 3warns and also showed kick message : you kick for max warn rechead!!


![[Image: back_us_button.png]](http://static.squarespace.com/static/51cca4bae4b0bf9a1f4deb75/t/52ea6a9ee4b0f767960f8c35/1390493521990/back_us_button.png)