Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help problem in warn code!!
#1
Hi
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!!
Reply

#2
I don't understand you at all...
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#3
it sould be like this :

Code:
ServerCommand("dropclient " + client.ClientNum + " \"[Admin]: you got kicked for max warn reachead!!"");
Reply

#4
Solved
req close/
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Android problem Yamato 12 8,136 04-25-2014, 04:49
Last Post: ScHmIdTy56789
  Problem with Rain Effects on Maps mitchhacker 5 4,848 10-22-2013, 00:46
Last Post: mitchhacker
  Help Code color crosshairs koren30 3 4,004 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 8,529 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,305 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,123 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,641 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,611 07-28-2013, 01:52
Last Post: First_Semyon
  Help Liberation Problem Yamato 27 24,872 07-17-2013, 19:54
Last Post: feature
  [Release] Ping Warn Plugin v1.1 master131 28 23,693 07-10-2013, 09:34
Last Post: spike17

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.