Example #1
0
        private void Aimbot()
        {
            // This aimbot is pasted, if you wrote this let me know and I'll credit you.
            float minDist = 9999f;

            Vector2 target = Vector2.zero;

            foreach (EntityZombie zombie in O.zombieList)
            {
                if (zombie && zombie.IsAlive())
                {
                    Vector3 lookAt = zombie.emodel.GetBellyPosition();
                    Vector3 w2s    = ESP.mainCam.WorldToScreenPoint(lookAt);

                    // If they're outside of our FOV.
                    if (Vector2.Distance(new Vector2(Screen.width / 2, Screen.height / 2), new Vector2(w2s.x, w2s.y)) > 150f)
                    {
                        continue;
                    }

                    if (ESPUtils.IsOnScreen(w2s))
                    {
                        float distance = Math.Abs(Vector2.Distance(new Vector2(w2s.x, Screen.height - w2s.y), new Vector2(Screen.width / 2, Screen.height / 2)));

                        if (distance < minDist)
                        {
                            minDist = distance;
                            target  = new Vector2(w2s.x, Screen.height - w2s.y);
                        }
                    }
                }
            }

            if (O.PlayerList.Count > 1)
            {
                foreach (EntityPlayer player in O.PlayerList)
                {
                    if (player && player.IsAlive() && player != O.localPlayer)
                    {
                        Vector3 lookAt = player.emodel.GetBellyPosition();
                        Vector3 w2s    = ESP.mainCam.WorldToScreenPoint(lookAt);

                        if (Vector2.Distance(new Vector2(Screen.width / 2, Screen.height / 2), new Vector2(w2s.x, w2s.y)) > 150f)
                        {
                            continue;
                        }

                        if (ESPUtils.IsOnScreen(w2s))
                        {
                            float distance = Math.Abs(Vector2.Distance(new Vector2(w2s.x, Screen.height - w2s.y), new Vector2(Screen.width / 2, Screen.height / 2)));

                            if (distance < minDist)
                            {
                                minDist = distance;
                                target  = new Vector2(w2s.x, Screen.height - w2s.y);
                            }
                        }
                    }
                }
            }

            if (target != Vector2.zero)
            {
                double distX = target.x - Screen.width / 2f;
                double distY = target.y - Screen.height / 2f;

                distX /= 10;
                distY /= 10;

                mouse_event(0x0001, (int)distX, (int)distY, 0, 0);
            }
        }
Example #2
0
        private void OnGUI()
        {
            // Run once per frame.
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            if (!mainCam)
            {
                mainCam = Camera.main;
            }

            if (fovCircle)
            {
                // Outline
                ESPUtils.DrawCircle(Color.black, new Vector2(Screen.width / 2, Screen.height / 2), 149f);
                ESPUtils.DrawCircle(Color.black, new Vector2(Screen.width / 2, Screen.height / 2), 151f);

                ESPUtils.DrawCircle(new Color32(30, 144, 255, 255), new Vector2(Screen.width / 2, Screen.height / 2), 150f);
            }

            if (crosshair)
            {
                // Constantly redefining these vectors so that you can change your resolution and the crosshair will still be in the middle.
                Vector2 lineHorizontalStart = new Vector2(Screen.width / 2 - crosshairScale, Screen.height / 2);
                Vector2 lineHorizontalEnd   = new Vector2(Screen.width / 2 + crosshairScale, Screen.height / 2);

                Vector2 lineVerticalStart = new Vector2(Screen.width / 2, Screen.height / 2 - crosshairScale);
                Vector2 lineVerticalEnd   = new Vector2(Screen.width / 2, Screen.height / 2 + crosshairScale);

                ESPUtils.DrawLine(lineHorizontalStart, lineHorizontalEnd, crosshairCol, lineThickness);
                ESPUtils.DrawLine(lineVerticalStart, lineVerticalEnd, crosshairCol, lineThickness);
            }

            if (O.zombieList.Count > 0 && (zombieName || zombieBox || zombieHealth))
            {
                foreach (EntityZombie zombie in O.zombieList)
                {
                    if (!zombie || !zombie.IsAlive())
                    {
                        continue;
                    }

                    Vector3 w2s = mainCam.WorldToScreenPoint(zombie.transform.position);

                    if (ESPUtils.IsOnScreen(w2s))
                    {
                        Vector3 w2sHead = mainCam.WorldToScreenPoint(zombie.emodel.GetHeadTransform().position);

                        float height = Mathf.Abs(w2sHead.y - w2s.y);
                        float x      = w2s.x - height * 0.3f /* Shift the box to the left a bit. */;
                        float y      = Screen.height - w2sHead.y;

                        if (zombieBox)
                        {
                            ESPUtils.OutlineBox(new Vector2(x - 1f, y - 1f), new Vector2((height / 2f) + 2f, height + 2f), blackCol);
                            ESPUtils.OutlineBox(new Vector2(x, y), new Vector2(height / 2f, height), entityBoxCol);
                            ESPUtils.OutlineBox(new Vector2(x + 1f, y + 1f), new Vector2((height / 2f) - 2f, height - 2f), blackCol);
                        }
                        else if (zombieCornerBox)
                        {
                            ESPUtils.CornerBox(new Vector2(w2sHead.x, y), height / 2f, height, 2f, entityBoxCol, true);
                        }

                        if (zombieName)
                        {
                            ESPUtils.DrawString(new Vector2(w2s.x, Screen.height - w2s.y + 8f /* Extra spacing below the box esp. */),
                                                zombie.EntityName.Replace("zombie", "Zombie_"), Color.red, true, 12, FontStyle.Normal);
                        }

                        if (zombieHealth)
                        {
                            float health     = zombie.Health;
                            int   maxHealth  = zombie.GetMaxHealth();
                            float percentage = health / maxHealth;
                            float barHeight  = height * percentage;

                            Color barColour = ESPUtils.GetHealthColour(health, maxHealth);

                            ESPUtils.RectFilled(x - 5f, y, 4f, height, blackCol);
                            ESPUtils.RectFilled(x - 4f, y + height - barHeight - 1f, 2f, barHeight, barColour);
                        }
                    }
                }
            }

            if (O.PlayerList.Count > 1 && (playerName || playerBox || playerHealth))
            {
                foreach (EntityPlayer player in O.PlayerList)
                {
                    if (!player || player == O.localPlayer || !player.IsAlive())
                    {
                        continue;
                    }

                    Vector3 w2s = mainCam.WorldToScreenPoint(player.transform.position);

                    if (ESPUtils.IsOnScreen(w2s))
                    {
                        Vector3 w2sHead = mainCam.WorldToScreenPoint(player.emodel.GetHeadTransform().position);

                        float height = Mathf.Abs(w2sHead.y - w2s.y);
                        float x      = w2s.x - height * 0.3f;
                        float y      = Screen.height - w2sHead.y;

                        if (playerBox)
                        {
                            ESPUtils.OutlineBox(new Vector2(x - 1f, y - 1f), new Vector2((height / 2f) + 2f, height + 2f), blackCol);
                            ESPUtils.OutlineBox(new Vector2(x, y), new Vector2(height / 2f, height), entityBoxCol);
                            ESPUtils.OutlineBox(new Vector2(x + 1f, y + 1f), new Vector2((height / 2f) - 2f, height - 2f), blackCol);
                        }
                        else if (playerCornerBox)
                        {
                            ESPUtils.CornerBox(new Vector2(w2sHead.x, y), height / 2f, height, 2f, entityBoxCol, true);
                        }

                        if (playerName)
                        {
                            ESPUtils.DrawString(new Vector2(w2s.x, Screen.height - w2s.y + 8f),
                                                player.EntityName, Color.red, true, 12, FontStyle.Normal);
                        }

                        if (playerHealth)
                        {
                            float health     = player.Health;
                            int   maxHealth  = player.GetMaxHealth();
                            float percentage = health / maxHealth;
                            float barHeight  = height * percentage;

                            Color barColour = ESPUtils.GetHealthColour(health, maxHealth);

                            ESPUtils.RectFilled(x - 5f, y, 4f, height, blackCol);
                            ESPUtils.RectFilled(x - 4f, y + height - barHeight - 1f, 2f, barHeight, barColour);
                        }
                    }
                }
            }
        }