////////////////////////////// // ingame kd farm limit ////////////////////////////// // SETTINGS: // set max intern KDR int maxKDR = 20; int maxKPM = 3; // set min kills int minKills = 40; // set max warn messages before kick int warnPlayer = 5; 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 (); } }