void SimpleRemove(StructureComponent structurecomponent, RemoveHandler rplayer) { object canremove = canRemoveStructure(structurecomponent, rplayer.removeType); if (canremove is string) { SendReply(rplayer.playerclient.netUser, canremove as string); return; } if (!(bool)canremove) { return; } if (canRefund) { TryRefund(structureCloneToGood[structurecomponent.gameObject.name], rplayer); } lastRemovedStructure = structurecomponent; TakeDamage.KillSelf(structurecomponent.GetComponent <IDMain>()); }
public void OnPlayerTeleport(Fougerite.Player player, Vector3 from, Vector3 dest) { if (RockGlitch) { var loc = player.Location; Vector3 cachedPosition = loc; RaycastHit cachedRaycast; cachedPosition.y += 100f; try { if (Physics.Raycast(loc, Vector3Up, out cachedRaycast, terrainLayer)) { cachedPosition = cachedRaycast.point; } if (!Physics.Raycast(cachedPosition, Vector3Down, out cachedRaycast, terrainLayer)) return; } catch { return; } if (!string.IsNullOrEmpty(cachedRaycast.collider.gameObject.name)) return; if (cachedRaycast.point.y < player.Y) return; Logger.LogDebug(player.Name + " tried to TELEPORT rock glitch at " + player.Location); Server.GetServer().Broadcast(player.Name + " don't try to rock glitch =)"); foreach (Collider collider in Physics.OverlapSphere(player.Location, 3f)) { if (collider.gameObject.name == "SleepingBagA(Clone)") TakeDamage.KillSelf(collider.GetComponent<IDMain>()); } if (RockGlitchKill) { if (player.Admin) { player.Message("You administrator rights allowed you to bug inside rocks."); return; } player.Message("Glitching gets you killed."); player.Kill(); } } }
void RemoveAllbannedbases(NetUser netuser) { int count = 0; int count2 = 0; foreach (StructureComponent comp in UnityEngine.Resources.FindObjectsOfTypeAll <StructureComponent>()) { var cachedStructure1 = comp.GetComponent <StructureComponent>(); var cachedMasterbannedbase = cachedStructure1._master; if (cachedMasterbannedbase == null) { continue; } var cachedmaster = cachedMasterbannedbase.ownerID; if (BanList.Contains(Convert.ToUInt64(cachedmaster))) { TakeDamage.KillSelf(comp.GetComponent <IDMain>()); count++; } } foreach (DeployableObject comp2 in UnityEngine.Resources.FindObjectsOfTypeAll <DeployableObject>()) { var cachedStructure2 = comp2.GetComponent <DeployableObject>(); var cachedMasterbannedbase2 = cachedStructure2._carrier; if (cachedMasterbannedbase2 != null) { continue; } var cachedmaster = cachedStructure2.ownerID; if (BanList.Contains(Convert.ToUInt64(cachedmaster))) { TakeDamage.KillSelf(comp2.GetComponent <IDMain>()); count2++; } } var total = (count + count2); SendReply(netuser, total.ToString() + " " + GetMessage("objects destroyed")); }
void CheckPlayerSpawn(PlayerClient player) { cachedPosition = player.lastKnownPosition; cachedPosition.y += 100f; if (Physics.Raycast(player.lastKnownPosition, Vector3Up, out cachedRaycast, terrainLayer)) { cachedPosition = cachedRaycast.point; } if (!Physics.Raycast(cachedPosition, Vector3Down, out cachedRaycast, terrainLayer)) { return; } if (cachedRaycast.collider.gameObject.name != "") { return; } if (cachedRaycast.point.y < player.lastKnownPosition.y) { return; } AntiGlitchBroadcastAdmins(string.Format("{0} is trying to rock glitch @ {1}", player.userName, player.lastKnownPosition.ToString())); Debug.Log(string.Format("{0} is trying to rock glitch @ {1}", player.userName, player.lastKnownPosition.ToString())); if (rockGlitchDestroySleepingBag) { foreach (Collider collider in Physics.OverlapSphere(player.lastKnownPosition, 3f)) { if (collider.gameObject.name == "SleepingBagA(Clone)") { TakeDamage.KillSelf(collider.GetComponent <IDMain>()); } } } if (rockGlitchDeath) { ConsoleNetworker.SendClientCommand(player.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe("You have been detected Rock Glitching! Die!")); TakeDamage.KillSelf(player.controllable.GetComponent <Character>()); } }
public void Kill() { TakeDamage.KillSelf(this.PlayerClient.controllable.character, null); }
public static void Kill(NetUser netuser) { TakeDamage.KillSelf(netuser.playerClient.controllable.character); }
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); }
void cmdchatbancheck(NetUser netuser, string command, string[] args) { if (!hasAccess(netuser, "Rbb.checkbase")) { SendReply(netuser, GetMessage("not allowed to use command")); return; } cachedCharacter = netuser.playerClient.rootControllable.idMain.GetComponent <Character>(); if (!MeshBatchPhysics.Raycast(cachedCharacter.eyesRay, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { SendReply(netuser, "Are you looking at the sky?"); return; } //Debug.Log(cachedRaycast.collider.ToString()); //Debug.Log(LayerMask.LayerToName(cachedRaycast.collider.gameObject.layer)); //Debug.Log(cachedRaycast.collider.transform.position.y.ToString()); //Debug.Log(cachedCharacter.origin.y.ToString()); //GameObject.Destroy(cachedRaycast.collider.GetComponent<UnityEngine.MeshCollider>()); /* * * var components = cachedRaycast.collider.GetComponents<UnityEngine.Component>(); * foreach (var comp in components) * { * Debug.Log(comp.ToString()); * } * Debug.Log("============= COMPONENTS IN PARENT ============="); * components = cachedRaycast.collider.GetComponentsInParent<UnityEngine.Component>(); * foreach (var comp in components) * { * Debug.Log(comp.ToString()); * } * Debug.Log("============= COMPONENTS IN CHILDREN ============="); * components = cachedRaycast.collider.GetComponentsInChildren<UnityEngine.Component>(); * foreach (var comp in components) * { * Debug.Log(comp.ToString()); * }*/ if (cachedhitInstance != null) { cachedCollider = cachedhitInstance.physicalColliderReferenceOnly; if (cachedCollider == null) { SendReply(netuser, GetMessage("cant tell what you are looking at")); return; } cachedStructure = cachedCollider.GetComponent <StructureComponent>(); if (cachedStructure != null && cachedStructure._master != null) { cachedMaster = cachedStructure._master; var owner = GetPlayerdata(cachedMaster.ownerID.ToString()); var gg = owner["StaticNickname"].ToString(); var q = owner["LastSeenNickname"].ToString(); var name = (q); rust.SendChatMessage(netuser, GetMessage("systemname"), "StaticNickName " + gg); rust.SendChatMessage(netuser, GetMessage("systemname"), string.Format("{0} - {1} - {2}", cachedStructure.gameObject.name, cachedMaster.ownerID.ToString(), name == null ? "Unknown" : name.ToString())); if (BanList.Contains(Convert.ToUInt64(cachedMaster.ownerID.ToString()))) { rust.SendChatMessage(netuser, GetMessage("systemname"), GetMessage("isinbanllist")); if (removeall) { foreach (StructureComponent comp in (HashSet <StructureComponent>)structureComponents.GetValue(cachedMaster)) { TakeDamage.KillSelf(comp.GetComponent <IDMain>()); } } return; } if (!BanList.Contains(Convert.ToUInt64(cachedMaster.ownerID.ToString()))) { rust.SendChatMessage(netuser, GetMessage("systemname"), GetMessage("isnotinbanllist")); return; } } } else { cachedDeployable = cachedRaycast.collider.GetComponent <DeployableObject>(); if (cachedDeployable != null) { var owner2 = GetPlayerdata(cachedDeployable.ownerID.ToString()); var gg2 = owner2["StaticNickname"].ToString(); var q2 = owner2["LastSeenNickname"].ToString(); var name = (q2); rust.SendChatMessage(netuser, GetMessage("systemname"), "StaticNickName " + gg2); rust.SendChatMessage(netuser, GetMessage("systemname"), string.Format("{0} - {1} - {2}", cachedDeployable.gameObject.name, cachedDeployable.ownerID.ToString(), name == null ? "Unknown" : name.ToString())); if (cachedDeployable.GetComponent <PasswordLockableObject>()) { SendReply(netuser, GetMessage("access to door")); int count = 0; foreach (ulong userid in (HashSet <ulong>)accessUsers.GetValue(cachedDeployable.GetComponent <PasswordLockableObject>())) { count++; SendReply(netuser, string.Format("{0} - {1}", userid.ToString(), name == null ? "Unknown" : name.ToString())); } if (count == 0) { SendReply(netuser, GetMessage("no one except the owner")); } } if (BanList.Contains(Convert.ToUInt64(cachedDeployable.ownerID.ToString()))) { var cachedcarrier = cachedDeployable._carrier; rust.SendChatMessage(netuser, GetMessage("systemname"), GetMessage("isinbanllist")); if (removeall) { foreach (DeployableObject comp in (HashSet <DeployableObject>)structureComponents.GetValue(cachedcarrier)) { TakeDamage.KillSelf(comp.GetComponent <IDMain>()); } } } rust.SendChatMessage(netuser, GetMessage("systemname"), GetMessage("isnotinbanllist")); return; } } SendReply(netuser, string.Format(GetMessage("cantprod what you are looking at phase 2")), cachedRaycast.collider.gameObject.name); }
void OnStructureBuilt(StructureComponent component, NetUser netuser) { var structurecheck = component.gameObject.AddComponent <StructureCheck>(); structurecheck.owner = netuser.playerClient.controllable.GetComponent <Character>(); structurecheck.radius = 0f; if ((antiPillarStash || antiPillarBarricade) && component.IsPillar()) { structurecheck.radius = 0.2f; } else if (antiFoundationGlitch && (component.type == StructureComponent.StructureComponentType.Foundation)) { structurecheck.radius = 3.0f; structurecheck.position.y += 2f; } else if (component.type == StructureComponent.StructureComponentType.Ramp) { if (antiRampStack) { if (MeshBatchPhysics.Raycast(structurecheck.position + Vector3ABitUp, Vector3Down, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { if (cachedhitInstance != null) { cachedComponent = cachedhitInstance.physicalColliderReferenceOnly.GetComponent <StructureComponent>(); if (cachedComponent.type == StructureComponent.StructureComponentType.Foundation || cachedComponent.type == StructureComponent.StructureComponentType.Ceiling) { var weight = getweight.GetValue(cachedComponent._master) as Dictionary <StructureComponent, HashSet <StructureComponent> >; int ramps = 0; if (weight.ContainsKey(cachedComponent)) { foreach (StructureComponent structure in weight[cachedComponent]) { if (structure.type == StructureComponent.StructureComponentType.Ramp) { ramps++; } } } if (ramps > rampstackMax) { TakeDamage.KillSelf(component.GetComponent <IDMain>()); if (structurecheck.owner != null && structurecheck.owner.playerClient != null) { ConsoleNetworker.SendClientCommand(structurecheck.owner.playerClient.netPlayer, "chat.add Oxide " + Facepunch.Utility.String.QuoteSafe(string.Format("You are not allowed to stack more than {0} ramps", rampstackMax.ToString()))); } timer.Once(0.01f, () => GameObject.Destroy(structurecheck)); return; } } } } } if (antiRampGlitch) { structurecheck.radius = 3.0f; structurecheck.position.y += 2f; } } timer.Once(0.05f, () => { if (structurecheck != null) { structurecheck.CheckCollision(); } }); }