void CheckNewAngles(NoRecoilHandler norecoilhandler, Angle2 oldAngles, float lasttimestamp) { Character character = norecoilhandler.GetCharacter(); if (character == null) { return; } if ((lasttimestamp - Time.realtimeSinceStartup) > 0.5f) { return; } if (oldAngles != character.eyesAngles) { return; } norecoilhandler.NoRecoils++; AntiCheatBroadcastAdmins(string.Format("{0} is suspected of having done a no recoil kill ({1} detections/{2} kills)", norecoilhandler.playerClient.userName, norecoilhandler.NoRecoils.ToString(), norecoilhandler.Kills.ToString())); if (!norecoilPunish) { return; } if (norecoilhandler.Kills < norecoilPunishMinKills) { return; } if (norecoilhandler.NoRecoils / norecoilhandler.Kills < norecoilPunishMinRatio) { return; } Punish(norecoilhandler.playerClient, string.Format("rNoRecoil({0}/{1})", norecoilhandler.NoRecoils.ToString(), norecoilhandler.Kills.ToString())); }
/*void CheckSilenceKill(TakeDamage takedamage, DamageEvent damage) * { * if (damage.victim.networkView == null) return; * * if (!(damage.extraData is WeaponImpact)) return; * cachedWeapon = damage.extraData as WeaponImpact; * if (cachedWeapon.dataBlock == null) return; * if(Physics2.Raycast2(damage.attacker.client.controllable.GetComponent<Character>().eyesRay, out cachedRaycast2, 250f, 406721553)) * { * var componenthit = (cachedRaycast2.remoteBodyPart == null) ? ((Component)cachedRaycast2.collider) : ((Component)cachedRaycast2.remoteBodyPart); * Debug.Log(componenthit.ToString()); * Debug.Log(cachedRaycast2.distance.ToString()); * return; * } * Debug.Log("NO HIT"); * }*/ void CheckNoRecoil(TakeDamage takedamage, DamageEvent damage) { if (damage.victim.networkView == null) { return; } if (damage.damageTypes != DamageTypeFlags.damage_bullet) { return; } if (Vector3.Distance(damage.attacker.networkView.position, damage.victim.networkView.position) < norecoilDistance) { return; } NoRecoilHandler norecoilhandler = damage.attacker.client.GetComponent <NoRecoilHandler>(); if (norecoilhandler == null) { norecoilhandler = damage.attacker.client.gameObject.AddComponent <NoRecoilHandler>(); } norecoilhandler.Kills++; Character character = damage.attacker.character; norecoilhandler.character = character; var eyeangles = (Angle2)character.eyesAngles; timer.Once(0.3f, () => CheckNewAngles(norecoilhandler, eyeangles, Time.realtimeSinceStartup)); }