Jump to content

420

Members
  • Content Count

    6
  • Joined

  • Last visited

Posts posted by 420


  1. To specify, the code i added and modified for Insane Limit wont work or activate. I dont know if i have made any errors during the modification of the code. My setup is as shown in Screenshot 1 and the code is built up like this:

    //////////////////////////////
    // ingame kd farm limit
    //////////////////////////////    
    // SETTINGS:
    
    // set max intern KDR
    int maxKDR = 2;
    int maxKPM = 2;
    
    // set min kills
    int minKills = 40;
    
    // set max warn messages before kick
    int warnPlayer = 0;
    double playerKdr = Math.Round (player.KillsRound / player.DeathsRound, 2, MidpointRounding.AwayFromZero);
    double playerKpm= Math.Round(player.KillsRound / (player.TimeRound / 60), 2, MidpointRounding.AwayFromZero);
    string playerName = player.Name;
    string discordPlayerName = playerName.Replace ("_", "\\_");
    
    bool useWhitelist = true;
    string webhookUrl = "https://discordapp.com/api/webhooks/721408527788146728/KIUAYgdCnFTLtX51AlnB8GmprtqZIrE5PwIi5--5aVaq7LLpkdXHh6Ce91hwrj_sAmnO";
    
    string info = plugin.FriendlyMapName (server.NextMapFileName) + " mode " + plugin.FriendlyModeName (server.NextGamemode);
    // SETTINGS END
    //////////////////////////////    
    
    if (minKills > killer.KillsRound) return false;
    
    if (useWhitelist && plugin.GetReservedSlotsList ().Contains (player.Name)) return false;
    
    
    if ((killer.KillsRound >= minKills) && (killer.KdrRound > maxKDR)) {
            plugin.ConsoleWrite ("^8^bKDR LIMIT:^8^n " + killer.Name + " KICKED for KDR. (" + plugin.FriendlyMapName (server.MapFileName) + "  -  K/D: " + killer.KillsRound + "/" + killer.DeathsRound + "  -  (DEBUG: kdr: " + killer.KdrRound + "  k/d: " + killer.KillsRound + "/" + killer.DeathsRound + ")");
            plugin.PRoConChat ("^8^bKDR LIMIT:^8^n " + killer.Name + " KICKED for KDR. (" + plugin.FriendlyMapName (server.MapFileName) + "  -  K/D: " + killer.KillsRound + "/" + killer.DeathsRound + "  -  (DEBUG: kdr: " + killer.KdrRound + "  k/d: " + killer.KillsRound + "/" + killer.DeathsRound + ")");
            plugin.KickPlayerWithMessage (killer.Name, plugin.R ("Kicked by KDR Limit - VIP is whitelisted"));
            using (WebClient webClient = new WebClient ()) {
                string battlelogLink = "https://battlelog.battlefield.com/bf4/user/" + player.Name;
                WebRequest request = WebRequest.Create (webhookUrl);
                request.Method = "POST";
                request.ContentType = "application/json";
                string webhookString = "{\"username\": \"BF4 Report\", \"content\": \"**```diff\\n | New Report | ```**\\n**Report for server:** " + server.Name + "\\n**Reported from:** Stats checker" + "\\n**Reported player:** " + discordPlayerName + "\\n**Reason:** High KDR " + playerKdr +"\\n**Info: **" + info + "\\n**Battlelog:** " + battlelogLink + "\"}";
                byte[] byteArray = Encoding.UTF8.GetBytes (webhookString);
                request.ContentLength = byteArray.Length;
                Stream dataStream = request.GetRequestStream ();
                dataStream.Write (byteArray, 0, byteArray.Length);
                dataStream.Close ();
            }
        }
    
    if ((killer.KillsRound >= minKills) && (killer.KpmRound > maxKPM)) {
            plugin.ConsoleWrite ("^8^bKPM LIMIT:^8^n " + killer.Name + " KICKED for KPM. (" + plugin.FriendlyMapName (server.MapFileName) + ")");
            plugin.PRoConChat ("^8^bKPM LIMIT:^8^n " + killer.Name + " KICKED for KPM. (" + plugin.FriendlyMapName (server.MapFileName) + ")");
            plugin.KickPlayerWithMessage (killer.Name, plugin.R ("Kicked by KPM Limit - VIP is whitelisted"));
            using (WebClient webClient = new WebClient ()) {
                string battlelogLink = "https://battlelog.battlefield.com/bf4/user/" + player.Name;
                WebRequest request = WebRequest.Create (webhookUrl);
                request.Method = "POST";
                request.ContentType = "application/json";
                string webhookString = "{\"username\": \"BF4 Report\", \"content\": \"**```diff\\n | New Report | ```**\\n**Report for server:** " + server.Name + "\\n**Reported from:** Stats checker" + "\\n**Reported player:** " + discordPlayerName + "\\n**Reason:** High KPM " + playerKpm +"\\n**Info: **" + info + "\\n**Battlelog:** " + battlelogLink + "\"}";
                byte[] byteArray = Encoding.UTF8.GetBytes (webhookString);
                request.ContentLength = byteArray.Length;
                Stream dataStream = request.GetRequestStream ();
                dataStream.Write (byteArray, 0, byteArray.Length);
                dataStream.Close ();
            }
    }


    In console messages are multible error messages as shown in screenshot 2.

    The current version we utilize is v. 1.5.3.4

    Screenshot_1.png

    Screenshot_2.png

×
×
  • Create New...

Important Information

Please review our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.