Example #1
0
        public static void StartTrigger()
        {
            Thread.Sleep(500);

            while (true)
            {
                #region TriggerBOT
                if (pLocal.pThis != IntPtr.Zero && g_pEngineClient.IsInGame() && pLocal.GetHealth() > 0)
                {
                    var LocalWeapon = pLocal.GetActiveWeapon();

                    var LocalWeaponID = LocalWeapon.GetIndex();

                    var LocalWeaponConfig = Config.GetWeaponConfig(LocalWeaponID);


                    if (LocalWeaponConfig.bTriggerBotEnabled && Config.TriggerBotEnabled)
                    {
                        bool isKeyPressed = IsKeyState(Config.iTriggerBotKey) || IsKeyState(Config.iTriggerBotWorkWithAimKey);

                        if (LocalWeapon.IsKnife() || LocalWeapon.IsBomb() || LocalWeapon.IsGrenade())
                        {
                            isKeyPressed = false;
                        }

                        if (isKeyPressed)
                        {
                            var cross = pLocal.GetCrosshairID();

                            if (cross > 0 && cross <= 64)
                            {
                                CBasePlayer pTarget = new CBasePlayer(g_EntityList.GetEntityByIndex(cross));
                                if (pTarget.pThis != IntPtr.Zero && !pTarget.IsDormant() && pTarget.GetHealth() > 0 && !pTarget.HasGunGameImmunity())
                                {
                                    if (LocalWeaponConfig.bFriendlyFire || pLocal.GetTeamNum() != pTarget.GetTeamNum())
                                    {
                                        Thread.Sleep(LocalWeaponConfig.iDelay);
                                        g_pEngineClient.OneTickAttack();
                                        Thread.Sleep(LocalWeaponConfig.iPause);
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
                Thread.Sleep(5);
            }
        }