public static TruthDetector.ActionTaken Punish(NetUser netUser, UserData userData, HackMethod hackMethod, [Optional, DefaultParameterValue(false)] bool PunishBan) { string str = ""; if ((server.log > 1) && Users.HasFlag(netUser.userID, UserFlags.admin)) { if (hackMethod == HackMethod.AimedHack) { Broadcast.Message(netUser, string.Concat(new object[] { "Violation ", netUser.truthDetector.violation, "(+", 100, ") of ", truth.threshold }), "TRUTH", 0f); } else { Broadcast.Message(netUser, string.Concat(new object[] { "Violation ", netUser.truthDetector.violation, "(+", Rate, ") of ", truth.threshold }), "TRUTH", 0f); } } switch (hackMethod) { case HackMethod.AimedHack: str = "'Aimbot Hack'"; netUser.truthDetector.violation += truth.threshold; break; case HackMethod.SpeedHack: str = "'Speed Hack'"; netUser.truthDetector.violation += Rate; break; case HackMethod.MoveHack: str = "'Move Hack'"; netUser.truthDetector.violation += Rate; break; case HackMethod.JumpHack: str = "'Jump Hack'"; netUser.truthDetector.violation += Rate; break; case HackMethod.WallHack: str = "'Wall Hack'"; netUser.truthDetector.violation += Rate; break; case HackMethod.FallHack: str = "'Fall Hack'"; netUser.truthDetector.violation += truth.threshold; break; case HackMethod.NetExploit: str = "'Network Exploit'"; netUser.truthDetector.violation += truth.threshold; break; case HackMethod.OtherHack: str = "'Object Hack'"; netUser.truthDetector.violation += Rate; break; default: return(TruthDetector.ActionTaken.None); } if (netUser.truthDetector.violation >= truth.threshold) { if ((MaxViolations != -1) && (userData != null)) { userData.ViolationDate = DateTime.Now; userData.Violations++; } netUser.truthDetector.violation = 0; if ((MaxViolations != -1) && ((PunishAction.Contains <string>("BAN") || PunishBan) || ((MaxViolations <= 0) || (userData.Violations >= MaxViolations)))) { Users.SetViolations(userData.SteamID, 0); DateTime period = new DateTime(); if (BannedPeriod > 0) { period = DateTime.Now.AddMinutes((double)BannedPeriod); } PunishReason = Config.GetMessageTruth("Truth.Logger.Banned", netUser, str, userData.Violations, new DateTime()); if (PunishDetails != "") { Helper.LogError(string.Concat(new object[] { "Violated [", netUser.displayName, ":", netUser.userID, "]: ", PunishDetails }), ViolationDetails); } Helper.Log(PunishReason, true); if (ReportRank > 0) { Broadcast.MessageGM(PunishReason); } if (Core.DatabaseType.Equals("MYSQL")) { MySQL.Update(string.Format(string_0, userData.SteamID, MySQL.QuoteString(PunishReason), MySQL.QuoteString(PunishDetails))); MySQL.Update(string.Format(string_1, userData.SteamID, userData.ViolationDate.ToString("yyyy-MM-dd HH:mm:ss"))); } if (PunishAction.Contains <string>("NOTICE")) { Broadcast.Message(ViolationColor, netUser, Config.GetMessageTruth("Truth.Violation.Banned", netUser, str, userData.Violations, period), null, 0f); Broadcast.MessageAll(ViolationColor, Config.GetMessageTruth("Truth.Punish.Banned", netUser, str, userData.Violations, new DateTime()), netUser); Broadcast.MessageAll(ViolationColor, PunishDetails, null); } else { Broadcast.Message(ViolationColor, netUser, Config.GetMessageTruth("Truth.Violation.Banned", netUser, str, userData.Violations, period), null, 0f); Broadcast.Message(ViolationColor, netUser, PunishDetails, null, 0f); } if (BannedBlockIP && !BannedExcludeIP.Contains <string>(userData.LastConnectIP)) { Blocklist.Add(userData.LastConnectIP); } Users.Ban(netUser.userID, "Banned for using " + str + " by SERVER.", period, PunishDetails); netUser.Kick(NetError.Facepunch_Kick_Violation, true); return(TruthDetector.ActionTaken.Kicked); } PunishReason = Config.GetMessageTruth("Truth.Logger.Notice", netUser, str, userData.Violations, new DateTime()); if (PunishDetails != "") { Helper.LogError(string.Concat(new object[] { "Violated [", netUser.displayName, ":", netUser.userID, "]: ", PunishDetails }), ViolationDetails); } Helper.Log(PunishReason, true); if (ReportRank > 0) { Broadcast.MessageGM(PunishReason); } if (Core.DatabaseType.Equals("MYSQL")) { MySQL.Update(string.Format(string_0, userData.SteamID, MySQL.QuoteString(PunishReason), MySQL.QuoteString(PunishDetails))); MySQL.Update(string.Format(string_1, userData.SteamID, userData.ViolationDate.ToString("yyyy-MM-dd HH:mm:ss"))); } string text = Config.GetMessageTruth("Truth.Violation.Notice", netUser, str, userData.Violations, new DateTime()); string str3 = Config.GetMessageTruth("Truth.Punish.Notice", netUser, str, userData.Violations, new DateTime()); if (PunishAction.Contains <string>("KILL")) { text = Config.GetMessageTruth("Truth.Violation.Killed", netUser, str, userData.Violations, new DateTime()); str3 = Config.GetMessageTruth("Truth.Punish.Killed", netUser, str, userData.Violations, new DateTime()); } if (PunishAction.Contains <string>("KICK")) { text = Config.GetMessageTruth("Truth.Violation.Kicked", netUser, str, userData.Violations, new DateTime()); str3 = Config.GetMessageTruth("Truth.Punish.Kicked", netUser, str, userData.Violations, new DateTime()); } if (PunishAction.Contains <string>("NOTICE")) { Broadcast.Message(ViolationColor, netUser, text, null, 0f); Broadcast.MessageAll(ViolationColor, str3, netUser); Broadcast.MessageAll(ViolationColor, PunishDetails, null); } if (PunishAction.Contains <string>("KILL")) { TakeDamage.KillSelf(netUser.playerClient.controllable.character, null); } if (PunishAction.Contains <string>("KICK")) { netUser.Kick(NetError.Facepunch_Kick_Violation, true); } } return(actionTaken_0); }