public bool SendMeleeAttack(BaseEntity target, EHumanBone bone, Vector3 position) { ConsoleSystem.Log(bone.ToString()); var attackInfo = OpCodes.GetTargetHitInfo(bone); PlayerAttack attack = new PlayerAttack() { projectileID = 0, attack = new Attack() { hitID = target.UID, hitItem = 0, hitBone = attackInfo.HitBone, hitMaterialID = 97517300, hitPartID = attackInfo.HitPartID, pointEnd = position, pointStart = position, hitPositionLocal = attackInfo.HitLocalPos, hitPositionWorld = position, hitNormalLocal = attackInfo.HitNormalPos, hitNormalWorld = position } }; if (VirtualServer.BaseClient.write.Start()) { VirtualServer.BaseClient.write.PacketID(Message.Type.RPCMessage); VirtualServer.BaseClient.write.EntityID(this.UID); VirtualServer.BaseClient.write.UInt32((UInt32)ERPCMethodUID.PlayerAttack); PlayerAttack.Serialize(VirtualServer.BaseClient.write, attack); VirtualServer.BaseClient.Send(); } return(true); }
// Token: 0x0600012B RID: 299 RVA: 0x0000A294 File Offset: 0x00008494 public static bool SendRangeAttack(BasePlayer target, EHumanBone typeHit, PlayerProjectileAttack parentAttack, Vector3 pos) { bool isAlive = target.IsAlive; if (isAlive) { parentAttack.hitDistance = Vector3.Distance(target.Position, BasePlayer.LocalPlayer.Position); HitInfo hitInfo = OpCodes.GetTargetHitInfo(typeHit); parentAttack.playerAttack.attack.hitBone = hitInfo.HitBone; parentAttack.playerAttack.attack.hitPartID = hitInfo.HitPartID; parentAttack.playerAttack.attack.hitNormalLocal = hitInfo.HitNormalPos; parentAttack.playerAttack.attack.hitPositionLocal = hitInfo.HitLocalPos; parentAttack.playerAttack.attack.hitID = target.UID; float height = target.GetHeight(); parentAttack.playerAttack.attack.hitPositionWorld = pos; parentAttack.playerAttack.attack.hitNormalWorld = pos; parentAttack.playerAttack.attack.pointEnd = pos; VirtualServer.BaseClient.write.Start(); VirtualServer.BaseClient.write.PacketID(Message.Type.RPCMessage); VirtualServer.BaseClient.write.UInt32(RangeAim.LocalPlayer.UID); VirtualServer.BaseClient.write.UInt32(3322107216u); PlayerProjectileAttack.Serialize(VirtualServer.BaseClient.write, parentAttack); VirtualServer.BaseClient.write.Send(new SendInfo(VirtualServer.BaseClient.Connection)); } return(true); }
public override void OnUpdate() { if (Settings.Aimbot_Melee_Silent && BasePlayer.IsHaveLocalPlayer && BasePlayer.LocalPlayer.CanInteract()) { if (!BasePlayer.LocalPlayer.HasActiveItem || !BasePlayer.LocalPlayer.ActiveItem.IsMelee()) { // При отсутсвии в руках оружия ближнего боя, ставим кд 1, чтобы при смене оружия не было CooldownHack SetCooldown(1f); return; } m_Interval += DeltaTime; m_Cooldown -= DeltaTime; var prefabId = (EPrefabUID)BasePlayer.LocalPlayer.ActiveItem.PrefabID; var speed = GetMeleeSpeed(prefabId); // Если меняем оружие ближнего боя, то ставим кд 1, чтобы при смене оружие не было CooldownHack if (LastMeleePrefabUID != BasePlayer.LocalPlayer.ActiveItem.PrefabID) { LastMeleePrefabUID = BasePlayer.LocalPlayer.ActiveItem.PrefabID; SetCooldown(1f); return; } if (m_Interval > speed && m_Cooldown < 0) { m_Interval = 0; var maxDistance = OpCodes.GetMeleeMaxDistance(prefabId); BasePlayer target = BasePlayer.FindEnemy(maxDistance); if (target != null) { // При успешной атаке, ставим кд равное максимальной скорости атаки данного оружия SetCooldown(speed); var bone = OpCodes.GetTargetHit(0, Settings.Aimbot_Melee_Silent_AutoHeadshot); var attackInfo = OpCodes.GetTargetHitInfo(bone); var closestPoint = target.ClosestPoint(BasePlayer.LocalPlayer.EyePos); var offset = BasePlayer.LocalPlayer.GetForward(closestPoint) * 1.4f; DDraw.DrawBox(target.WorldSpaceBounds().position, target.WorldSpaceBounds().extents * 2, Color.magenta, 1f); DDraw.Arrow(closestPoint, closestPoint - offset, 0.1f, Color.blue, 1f); var position = closestPoint - offset; BasePlayer.LocalPlayer.ActiveItem.SendMeleeAttack(target, bone, position); } } } }
public static bool SendRangeAttack(BasePlayer target, EHumanBone typeHit, PlayerProjectileAttack parentAttack, Vector3 pos) { if (target.IsAlive) { parentAttack.hitDistance = Vector3.Distance(target.Position, BasePlayer.LocalPlayer.Position); var hitInfo = OpCodes.GetTargetHitInfo(typeHit); parentAttack.playerAttack.attack.hitBone = hitInfo.HitBone; parentAttack.playerAttack.attack.hitPartID = hitInfo.HitPartID; parentAttack.playerAttack.attack.hitNormalLocal = hitInfo.HitNormalPos; parentAttack.playerAttack.attack.hitPositionLocal = hitInfo.HitLocalPos; parentAttack.playerAttack.attack.hitID = target.UID; float height = target.GetHeight(); // TODO: Change this /*if (pos == Vector3.zero) * pos = target.Position + new Vector3(0, 50, 0);*/ //DDraw.Arrow(target.Position + new Vector3(0, height, 0), pos, 0.1f, Color.blue, 15f); parentAttack.playerAttack.attack.hitPositionWorld = pos; parentAttack.playerAttack.attack.hitNormalWorld = pos; parentAttack.playerAttack.attack.pointEnd = pos; // var forward = GetForward(); // parentAttack.playerAttack.attack.hitPositionWorld = EyePos + GetForward(); // parentAttack.playerAttack.attack.hitNormalWorld = EyePos + GetForward(); // parentAttack.playerAttack.attack.pointEnd = EyePos + GetForward(); VirtualServer.BaseClient.write.Start(); VirtualServer.BaseClient.write.PacketID(Message.Type.RPCMessage); VirtualServer.BaseClient.write.UInt32(LocalPlayer.UID); VirtualServer.BaseClient.write.UInt32((uint)ERPCMethodUID.OnProjectileAttack); PlayerProjectileAttack.Serialize(VirtualServer.BaseClient.write, parentAttack); VirtualServer.BaseClient.write.Send(new SendInfo(VirtualServer.BaseClient.Connection)); } return(true); }