void OnItemDeployedByPlayer(DeployableObject component, IDeployableItem item) { if (!antiSleepingBagHack) { return; } if (component.gameObject.name == "SleepingBagA(Clone)" || component.gameObject.name == "SingleBed(Clone)") { if (!item.character) { return; } if (!(MeshBatchPhysics.Linecast(item.character.eyesOrigin, component.transform.position, out cachedRaycast, out cachedBoolean, out cachedhitInstance))) { return; } if (cachedhitInstance == null && cachedRaycast.collider.gameObject.name != "MetalDoor(Clone)") { return; } if (Vector3.Distance(item.character.eyesOrigin, component.transform.position) > 9f) { return; } AntiCheatBroadcastAdmins(string.Format("{0} tried to spawn a {1} @ {2} from {3}", item.character.playerClient.userName, component.gameObject.name.Replace("(Clone)", ""), component.transform.position.ToString(), item.character.eyesOrigin.ToString())); AntiCheatBroadcastAdmins(string.Format("{0} was on the way", (cachedhitInstance == null) ? "Metal Door" : cachedhitInstance.physicalColliderReferenceOnly.gameObject.name.Replace("(Clone)", ""))); Puts(string.Format("{0} tried to spawn a {1} @ {2} from {3} threw {4}", item.character.playerClient.userName, component.gameObject.name.Replace("(Clone)", ""), component.transform.position.ToString(), item.character.eyesOrigin.ToString(), (cachedhitInstance == null) ? "Metal Door" : cachedhitInstance.physicalColliderReferenceOnly.gameObject.name.Replace("(Clone)", ""))); NetCull.Destroy(component.gameObject); if (sleepingbaghackPunish) { Punish(item.character.playerClient, string.Format("rSleepHack ({0})", (cachedhitInstance == null) ? "Metal Door" : cachedhitInstance.physicalColliderReferenceOnly.gameObject.name.Replace("(Clone)", ""))); } } }
///////////////////////// // ModifyDamage(TakeDamage takedamage, DamageEvent damage) // Called when any damage was made ///////////////////////// object ModifyDamage(TakeDamage takedamage, ref DamageEvent damage) { /*if (antiMassRadiation && (damage.damageTypes == 0 || damage.damageTypes == DamageTypeFlags.damage_radiation) ) * { * if (takedamage.GetComponent<Controllable>() == null) return null; * if (damage.victim.character == null) return null; * if (float.IsInfinity(damage.amount)) return null; * if (damage.amount > 12f) { AntiCheatBroadcastAdmins(string.Format("{0} is receiving too much damage from the radiation, ignoring the damage", takedamage.GetComponent<Controllable>().playerClient.userName.ToString())); damage.amount = 0f; return damage; } * } * else */ if (antiWallhack) { if (damage.status != LifeStatus.WasKilled) { return(null); } if (!(damage.extraData is BulletWeaponImpact)) { return(null); } cachedBulletWeapon = damage.extraData as BulletWeaponImpact; if (!MeshBatchPhysics.Linecast(damage.attacker.character.eyesOrigin, cachedBulletWeapon.worldPoint, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { return(null); } if (cachedhitInstance == null) { return(null); } cachedCollider = cachedhitInstance.physicalColliderReferenceOnly; if (cachedCollider == null) { return(null); } if (!(cachedCollider.gameObject.name.Contains("Wall") || cachedCollider.gameObject.name.Contains("Ceiling"))) { return(null); } Debug.Log(string.Format("Wallhack detection on {0} from: {1} to: {2}", damage.attacker.client.userName, damage.attacker.character.eyesOrigin.ToString(), cachedBulletWeapon.worldPoint.ToString())); AntiCheatBroadcastAdmins(string.Format("Wallhack detection on {0} from: {1} to: {2}", damage.attacker.client.userName, damage.attacker.character.eyesOrigin.ToString(), cachedBulletWeapon.worldPoint.ToString())); damage.status = LifeStatus.IsAlive; damage.amount = 0f; takedamage.SetGodMode(false); takedamage.health = 10f; if (takedamage.GetComponent <HumanBodyTakeDamage>() != null) { takedamage.GetComponent <HumanBodyTakeDamage>().SetBleedingLevel(0f); } if (wallhackPunish) { if (wallhackLogs[damage.attacker.client] == null) { wallhackLogs[damage.attacker.client] = Time.realtimeSinceStartup; } if ((wallhackLogs[damage.attacker.client] - Time.realtimeSinceStartup) > 3) { wallhackLogs[damage.attacker.client] = Time.realtimeSinceStartup; } if (wallhackLogs[damage.attacker.client] - Time.realtimeSinceStartup > 0.1) { Punish(damage.attacker.client, "rWallhack"); } } return(damage); } return(null); }