コード例 #1
0
 public static int GetMapPlayers()
 {
     if (ClientState == 0)
     {
         ClientState = MemUtils.ReadInt32(Engine + Signatures.dwClientState);
     }
     return(MemUtils.ReadInt32((IntPtr)(ClientState + Signatures.dwClientState_MaxPlayer)));
 }
コード例 #2
0
 public static bool IsInGame()
 {
     if (ClientState == 0)
     {
         ClientState = MemUtils.ReadInt32(Engine + Signatures.dwClientState);
     }
     return(MemUtils.ReadByte((IntPtr)(ClientState + Signatures.dwClientState_State)) == 6);
 }
コード例 #3
0
        private void AimFunction()
        {
            var newAng = MathUtils.CalcAngle2(LocalPlayer, Closed.GetEntityBonePosition(8), LocalPlayer.ViewAngles);

            newAng = MathUtils.ClampAngle(newAng);
            MemUtils.WriteVector3((IntPtr)(ClientState + Signatures.dwClientState_ViewAngles), newAng);

            WinApi.mouse_event(WinApi.MOUSEEVENTF.LEFTDOWN, 0, 0, 0, 0);
            Thread.Sleep(1);
            WinApi.mouse_event(WinApi.MOUSEEVENTF.LEFTUP, 0, 0, 0, 0);
            //Thread.Sleep(10);
        }
コード例 #4
0
        public static Vector3 CalcAngle2(LocalPlayer me, Vector3 headPos, Vector3 angles)
        {
            double[] delta =
            {
                (me.Position.X - headPos.X), (me.Position.Y - headPos.Y),
                (me.Position.Z - (headPos.Z - 61))
            };
            var hyp = Math.Sqrt(delta[0] * delta[0] + delta[1] * delta[1]);

            me.PunchAngle = MemUtils.ReadVector2((IntPtr)(me.Entity + Netvars.m_aimPunchAngle));
            angles.X      = (float)(Math.Atan(delta[2] / hyp) * 57.295779513082f - me.PunchAngle.X * 2.0f);
            angles.Y      = (float)(Math.Atan(delta[1] / delta[0]) * 57.295779513082f - me.PunchAngle.Y * 2.0f);
            angles.Z      = 0.0f;

            if (delta[0] >= 0.0f)
            {
                angles.Y += 180.0f;
            }
            return(angles);
        }
コード例 #5
0
        private void Loaded()
        {
            Task.Run(async() =>
            {
                while (true)
                {
                    if (InGame)
                    {
                        LocalPlayer.Update();
                        foreach (var player in Players)
                        {
                            player.Update();
                        }
                        if (Program.IsEspEnabled)
                        {
                            foreach (var justEntity in ListOfGlow.ToList())
                            {
                                justEntity.Update();
                            }
                        }
                        await Task.Delay(1);
                    }
                    else
                    {
                        await Task.Delay(100);
                    }
                }
            });
            Task.Run(async() =>
            {
                while (true)
                {
                    if (Program.IsTriggerBot && InGame)
                    {
                        if (LocalPlayer.PlayerInCrosshair != null)
                        {
                            var myWeapon = LocalPlayer.GetCurrentWeapon();
                            if (myWeapon == WeaponHandler.ItemDefinitionIndex.WeaponAwp ||
                                myWeapon == WeaponHandler.ItemDefinitionIndex.WeaponScar20 ||
                                myWeapon == WeaponHandler.ItemDefinitionIndex.WeaponG3sg1 ||
                                myWeapon == WeaponHandler.ItemDefinitionIndex.WeaponSsg08)
                            {
                                if (LocalPlayer.IsScoping())
                                {
                                    WinApi.mouse_event(WinApi.MOUSEEVENTF.LEFTDOWN, 0, 0, 0, 0);
                                    await Task.Delay(1);
                                    WinApi.mouse_event(WinApi.MOUSEEVENTF.LEFTUP, 0, 0, 0, 0);
                                }
                            }
                            else
                            {
                                WinApi.mouse_event(WinApi.MOUSEEVENTF.LEFTDOWN, 0, 0, 0, 0);
                                await Task.Delay(1);
                                WinApi.mouse_event(WinApi.MOUSEEVENTF.LEFTUP, 0, 0, 0, 0);
                            }
                        }
                    }
                    else
                    {
                        await Task.Delay(100);
                    }
                }
            });
            Task.Run(async() =>
            {
                while (true)
                {
                    if (Program.IsAimEnabled && Program.IsAimInAction && InGame)
                    {
                        if (IsCanNewTarget)
                        {
                            foreach (var player in Players.Where(x => x.IsValid && x.IsEnemy && x.IsAlive))
                            {
                                var w2SHead = MathUtils.WorldToScreen(LocalPlayer.ViewMatrix,
                                                                      new Vector2(_sizeX, _sizeY),
                                                                      player.GetEntityBonePosition(8));
                                FindClosest(player, w2SHead);
                            }
                        }
                        if (Closed != null)
                        {
                            IsCanNewTarget = false;
                        }
                        if (Closed == null || LocalPlayer.GetWeaponClip() <= 0 || !Closed.IsAlive || !Closed.IsValid)
                        {
                            Closed = null;
                            continue;
                        }

                        AimFunction();
                    }
                    else
                    {
                        IsCanNewTarget = true;
                        Closed         = null;
                        await Task.Delay(1);
                    }
                }
            });
            Task.Run(async() =>
            {
                var ignoreClassList = new List <int>()
                {
                    38, 50, 139, 242
                };
                while (true)
                {
                    if (Program.IsEspEnabled && InGame)
                    {
                        var glowObj   = MemUtils.ReadInt32(Client + Signatures.dwGlowObjectManager);
                        var glowCount = MemUtils.ReadInt32(Client + Signatures.dwGlowObjectManager + 4);

                        /*Printer.PrintInfo($"GlowCOunt: {glowCount}");
                         * Printer.PrintInfo(
                         *  $"Classes {MemUtils.ReadString(Client + Signatures.dwGetAllClasses, 128, Encoding.ASCII)}");*/
                        for (var i = 0; i <= glowCount; i++)
                        {
                            var entity = MemUtils.ReadInt32((IntPtr)(glowObj + i * 0x38));

                            if (entity == 0)
                            {
                                continue;
                            }

                            var one     = MemUtils.ReadInt32((IntPtr)(entity + 8));
                            var two     = MemUtils.ReadInt32((IntPtr)(one + 2 * 4));
                            var three   = MemUtils.ReadInt32((IntPtr)(two + 1));
                            var classId = MemUtils.ReadInt32((IntPtr)(three + 20));
                            //Printer.PrintInfo($"[{i}] Entity: {entity} | {one} | {two} | {three} | {classId}");

                            if (classId > 0 && ignoreClassList.All(x => x != classId))
                            {
                                if (!ListOfGlow.Any(x => x.Entity.Equals(entity)))
                                {
                                    ListOfGlow.Add(new JustEntity(entity));
                                }
                                MemUtils.WriteFloat((IntPtr)(glowObj + i * 0x38 + 0x4), 255);
                                MemUtils.WriteFloat((IntPtr)(glowObj + i * 0x38 + 0x8), 0);
                                MemUtils.WriteFloat((IntPtr)(glowObj + i * 0x38 + 0xC), 255);
                                MemUtils.WriteFloat((IntPtr)(glowObj + i * 0x38 + 0x10), 255);
                                MemUtils.Write((IntPtr)(glowObj + i * 0x38 + 0x24), new byte[] { 1 });
                                MemUtils.Write((IntPtr)(glowObj + i * 0x38 + 0x25), new byte[] { 0 });
                            }
                        }

                        foreach (var p in Players.Where(x => x.IsValid && x.IsAlive))
                        {
                            var glowIndex = MemUtils.ReadInt32((IntPtr)(p.Entity + Netvars.m_iGlowIndex));
                            if (p.IsAlly)
                            {
                                MemUtils.WriteFloat((IntPtr)(glowObj + glowIndex * 0x38 + 0x4), 0);
                                MemUtils.WriteFloat((IntPtr)(glowObj + glowIndex * 0x38 + 0x8), 155);
                                MemUtils.WriteFloat((IntPtr)(glowObj + glowIndex * 0x38 + 0xC), 255);
                                MemUtils.WriteFloat((IntPtr)(glowObj + glowIndex * 0x38 + 0x10), 255);
                                MemUtils.Write((IntPtr)(glowObj + glowIndex * 0x38 + 0x24), new byte[] { 1 });
                                MemUtils.Write((IntPtr)(glowObj + glowIndex * 0x38 + 0x25), new byte[] { 0 });
                            }
                            else
                            {
                                MemUtils.WriteFloat((IntPtr)(glowObj + glowIndex * 0x38 + 0x4), 255);
                                MemUtils.WriteFloat((IntPtr)(glowObj + glowIndex * 0x38 + 0x8), 0);
                                MemUtils.WriteFloat((IntPtr)(glowObj + glowIndex * 0x38 + 0xC), 0);
                                MemUtils.WriteFloat((IntPtr)(glowObj + glowIndex * 0x38 + 0x10), 255);
                                MemUtils.Write((IntPtr)(glowObj + glowIndex * 0x38 + 0x24), new byte[] { 1 });
                                MemUtils.Write((IntPtr)(glowObj + glowIndex * 0x38 + 0x25), new byte[] { 0 });
                            }
                        }
                    }
                    await Task.Delay(10);
                }
            });

            Task.Run(async() =>
            {
                while (true)
                {
                    if (!Program.IsBunnyHopEnabled || !Program.IsBunnyHopSpaced || !LocalPlayer.IsValid ||
                        !LocalPlayer.IsAlive)
                    {
                        continue;
                    }
                    var flags = MemUtils.ReadInt32((IntPtr)LocalPlayer.Entity + Netvars.m_fFlags);
                    if (flags == (int)FlagType.Jump)
                    {
                        continue;
                    }
                    MemUtils.WriteInt32(Client + Signatures.dwForceJump, 5);
                    await Task.Delay(25);
                    MemUtils.WriteInt32(Client + Signatures.dwForceJump, 4);
                    await Task.Delay(50);
                }
            });

            Task.Run(async() =>
            {
                while (true)
                {
                    var newInGame = IsInGame();
                    if (newInGame && newInGame != InGame)
                    {
                        ClientState = MemUtils.ReadInt32(Engine + Signatures.dwClientState);
                        _mapName    = MemUtils.ReadString((IntPtr)ClientState + Signatures.dwClientState_Map, 32, Encoding.ASCII).TrimStart('_');

                        Players.Clear();
                        MaxPlayersOnMap = GetMapPlayers();

                        Printer.PrintSuccess($"NewMapLoaded: {_mapName} (MaxPlayers: {_mapName})");
                        for (var i = 0; i < MaxPlayersOnMap; i++)
                        {
                            var p = new Player(i);
                            if (p.Entity == LocalPlayer.Entity)
                            {
                                continue;
                            }

                            Players.Add(p);
                        }
                    }
                    InGame = newInGame;
                    await Task.Delay(200);
                }
            });
        }