Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using UnityEngine;
- using System.Reflection;
- using System.Runtime.InteropServices;
- using System.IO;
- using System.Reflection.Emit;
- using RuntimeHelpers = System.Runtime.CompilerServices.RuntimeHelpers;
- class Hack : MonoBehaviour
- {
- bool bAimbot = true;
- bool bAimVisible = true;
- bool bAimTarget = true;
- bool bNoRecoil = true;
- bool bNoSpread = true;
- bool bBuildRange = true;
- bool bInstantReload = true;
- bool bChams = true;
- bool bChamsFriendly = false;
- bool bChamsEnemy = true;
- bool bLines = true;
- bool bLinesBottom = true;
- bool bLinesFriend = false;
- bool bLinesEnemy = true;
- bool bHealth = true;
- bool bHealthFriend = false;
- bool bHealthEnemy = true;
- Material lineMaterial = null;
- void CreateLineMaterial()
- {
- if (!lineMaterial)
- {
- lineMaterial = new Material("Shader \"Lines/Colored Blended\" {" +
- "SubShader { Pass { " +
- " Blend SrcAlpha OneMinusSrcAlpha " +
- " ZWrite Off Cull Off Fog { Mode Off } " +
- " ZTest Always" +
- " BindChannels {" +
- " Bind \"vertex\", vertex Bind \"color\", color }" +
- "} } }");
- lineMaterial.hideFlags = HideFlags.HideAndDontSave;
- lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
- }
- }
- public void DrawLine(Vector3 Start, Vector3 End, Color color)
- {
- lineMaterial.SetPass(0);
- GL.PushMatrix();
- GL.LoadOrtho();
- GL.Begin(GL.LINES);
- GL.Color(color);
- GL.Vertex3(Start.x / Screen.width, Start.y / Screen.height, 0);
- GL.Vertex3(End.x / Screen.width, End.y / Screen.height, 0);
- GL.End();
- GL.PopMatrix();
- }
- void DrawBox(Vector3 Pos, float Width, float Height, Color color)
- {
- DrawLine(new Vector3(Pos.x, Pos.y, 0), new Vector3(Pos.x + Width, Pos.y, 0), color);
- DrawLine(new Vector3(Pos.x + Width, Pos.y, 0), new Vector3(Pos.x + Width, Pos.y + Height, 0), color);
- DrawLine(new Vector3(Pos.x + Width, Pos.y + Height, 0), new Vector3(Pos.x, Pos.y + Height, 0), color);
- DrawLine(new Vector3(Pos.x, Pos.y + Height, 0), new Vector3(Pos.x, Pos.y, 0), color);
- }
- public void DrawCircle(Vector3 Pos, float r, float s, Color color)
- {
- float Step = 3.14159265f * 2.0f / s;
- for (float a = 0; a < 3.14159265 * 2.0; a += Step)
- {
- float x1 = r * Mathf.Cos(a) + Pos.x;
- float y1 = r * Mathf.Sin(a) + Pos.y;
- float x2 = r * Mathf.Cos(a + Step) + Pos.x;
- float y2 = r * Mathf.Sin(a + Step) + Pos.y;
- DrawLine(new Vector3(x1, y1, 0), new Vector3(x2, y2, 0), color);
- }
- }
- Material ChamMaterial = null;
- Material[] ChamMats;
- void CreateChamMaterial()
- {
- if (!ChamMaterial)
- {
- ChamMaterial = new Material(
- "Shader \"Custom/Cham\"" +
- "{" +
- " SubShader " +
- " {" +
- " Pass " +
- " {" +
- " ZTest Less" +
- " ZWrite On" +
- " Color (1,0,0,1) " +
- " }" +
- " Pass " +
- " {" +
- " ZTest Greater" +
- " ZWrite Off" +
- " Color (0,0,1,1)" +
- " }" +
- " }" +
- "}");
- ChamMaterial.hideFlags = HideFlags.HideAndDontSave;
- ChamMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
- ChamMats = new Material[] { ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial };
- }
- }
- Material ChamMaterial2 = null;
- Material[] ChamMats2;
- void CreateChamMaterial2()
- {
- if (!ChamMaterial2)
- {
- ChamMaterial2 = new Material(
- "Shader \"Custom/Cham\"" +
- "{" +
- " SubShader " +
- " {" +
- " Pass " +
- " {" +
- " ZTest Less" +
- " ZWrite On" +
- " Color (1,1,0,1) " +
- " }" +
- " Pass " +
- " {" +
- " ZTest Greater" +
- " ZWrite Off" +
- " Color (0,1,0,1)" +
- " }" +
- " }" +
- "}");
- ChamMaterial2.hideFlags = HideFlags.HideAndDontSave;
- ChamMaterial2.shader.hideFlags = HideFlags.HideAndDontSave;
- ChamMats2 = new Material[] { ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2 };
- }
- }
- //bool BlockFunction(MethodBase Original)
- //{
- // if (Original == null) return false;
- // IntPtr pBody1 = Original.MethodHandle.GetFunctionPointer();
- // if (pBody1 == null) return false;
- // unsafe
- // {
- // var ptr = (byte*)pBody1.ToPointer();
- // (*(byte*)(ptr + 0)) = 0xC3;
- // }
- // return true;
- //}
- bool IsVisible(GameObject obj, Vector3 Position)
- {
- RaycastHit hit;
- if (Physics.Linecast(Camera.main.transform.position, Position, out hit))
- {
- if (hit.collider)
- {
- if (hit.collider.gameObject.transform.root.gameObject == obj.transform.root.gameObject) return true;
- }
- }
- return false;
- }
- //void Aimbot()
- //{
- // Vector3 target = Vector3.zero;
- // float bestDistance = 100000;
- // GUILayout.BeginVertical();
- // Unit local = UnitsRegistry.Instance.GetPlayer();
- // if (local == null) return;
- // MouseLook ml = local.gameObject.GetComponent<MouseLook>();
- // if (ml == null) return;
- // List<Unit> players = UnitsRegistry.Instance.GetAllPlayers();
- // int c = 0;
- // foreach (Unit player in players)
- // {
- // if (player == local) continue;
- // if (local.Team != player.Team)
- // {
- // foreach (SkinnedMeshRenderer skin in player.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>())
- // {
- // foreach (Transform bone in skin.bones)
- // {
- // if (bone.name.ToLower().Contains("neck") || bone.name.ToLower().Contains("head") || bone.name.ToLower().Contains("cameraroot"))
- // //if (bone.name.ToLower().Contains("cameraroot"))
- // {
- // Vector3 Position = Camera.main.WorldToScreenPoint(bone.position);
- // if (Position.z > 0)
- // {
- // if (IsVisible(bone.root.gameObject, bone.position))
- // {
- // DrawCircle(Position, 10, 10, Color.green);
- // Vector2 s;
- // s.x = Screen.width / 2 - Position.x;
- // s.y = Screen.height / 2 - Position.y;
- // if (s.magnitude < bestDistance)
- // {
- // bestDistance = s.magnitude;
- // target = bone.position;
- // }
- // }
- // else
- // DrawCircle(Position, 10, 10, Color.red);
- // }
- // break;
- // }
- // }
- // }
- // }
- // }
- // //Transform tr = ml.GetType().GetField("cameraRoot", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ml) as Transform;
- // Vector3 targetESP = Camera.main.WorldToScreenPoint(target);
- // DrawCircle(targetESP, 12, 10, Color.cyan);
- // if (target != Vector3.zero && Input.GetKey(KeyCode.LeftShift))
- // //if (Input.GetKey(KeyCode.LeftShift))
- // {
- // GameObject obj = new GameObject();
- // obj.transform.position = Camera.main.transform.position;
- // obj.transform.LookAt(target);
- // float ax = obj.transform.eulerAngles.x;
- // if (ax > 90) ax -= 360;
- // ml.RotationX = ax;
- // ml.RotationY = obj.transform.eulerAngles.y;
- // GUILayout.Label("eulerAngles " + obj.transform.eulerAngles.ToString());
- // }
- // GUILayout.EndVertical();
- //}
- void DoAimbot()
- {
- if (!bAimbot) return;
- Vector3 target = Vector3.zero;
- float bestDistance = 100000;
- Unit local = UnitsRegistry.Instance.GetPlayer();
- if (local == null) return;
- MouseLook ml = local.gameObject.GetComponent<MouseLook>();
- if (ml == null) return;
- List<Unit> players = UnitsRegistry.Instance.GetAllPlayers();
- foreach (Unit player in players)
- {
- if (player == local) continue;
- if (local.Team != player.Team)
- {
- foreach (SkinnedMeshRenderer skin in player.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>())
- {
- foreach (Transform bone in skin.bones)
- {
- //if (bone.name.ToLower().Contains("neck") || bone.name.ToLower().Contains("head") || bone.name.ToLower().Contains("cameraroot"))
- if (bone.name.ToLower().Contains("neck"))
- {
- Vector3 Position = Camera.main.WorldToScreenPoint(bone.position);
- if (Position.z > 0)
- {
- bool bWasVisible = IsVisible(bone.root.gameObject, bone.position);
- if (!bAimVisible) bWasVisible = true;
- if (bWasVisible)
- {
- if (bAimTarget) DrawCircle(Position, 10, 10, Color.green);
- Vector2 s;
- s.x = Screen.width / 2 - Position.x;
- s.y = Screen.height / 2 - Position.y;
- if (s.magnitude < bestDistance)
- {
- bestDistance = s.magnitude;
- target = bone.position;
- }
- }
- else
- {
- if (bAimTarget) DrawCircle(Position, 10, 10, Color.red);
- }
- }
- break;
- }
- }
- }
- }
- }
- if (bAimTarget && target != Vector3.zero)
- {
- Vector3 targetESP = Camera.main.WorldToScreenPoint(target);
- DrawCircle(targetESP, 12, 10, Color.cyan);
- }
- if (target != Vector3.zero && Input.GetKey(KeyCode.LeftShift))
- {
- GameObject obj = new GameObject();
- obj.transform.position = Camera.main.transform.position;
- obj.transform.LookAt(target);
- float ax = obj.transform.eulerAngles.x;
- if (ax > 90) ax -= 360;
- ml.RotationX = ax;
- ml.RotationY = obj.transform.eulerAngles.y;
- }
- }
- void DoESP()
- {
- Unit local = UnitsRegistry.Instance.GetPlayer();
- if (local == null) return;
- List<Unit> players = UnitsRegistry.Instance.GetAllPlayers();
- foreach (Unit player in players)
- {
- if (player == local) continue;
- foreach (SkinnedMeshRenderer skin in player.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>())
- {
- foreach (Transform bone in skin.bones)
- {
- //if (bone.name.ToLower().Contains("neck") || bone.name.ToLower().Contains("head") || bone.name.ToLower().Contains("cameraroot"))
- if (bone.name.ToLower().Contains("neck"))
- {
- Vector3 Position = Camera.main.WorldToScreenPoint(bone.position);
- if (Position.z > 0)
- {
- if (bLines)
- {
- Vector3 LineStart = new Vector3(Screen.width / 2, 0, 0);
- if (!bLinesBottom) LineStart.y = Screen.height/2;
- if (bLinesFriend && player.Team == local.Team) DrawLine(LineStart, Position, Color.green);
- if (bLinesEnemy && player.Team != local.Team) DrawLine(LineStart, Position, Color.red);
- }
- if (bHealth)
- {
- float Health = player.Health;
- Color cHealth = Color.green;
- if (Health < 70) cHealth = Color.yellow;
- if (Health < 35) cHealth = Color.red;
- Vector3 HealthPos = Position;
- HealthPos.x -= 25;
- HealthPos.y += 16;
- if (bHealthFriend && player.Team == local.Team)
- {
- DrawBox(HealthPos, 50, 1, Color.black);
- DrawBox(HealthPos, Health / 2, 1, cHealth);
- }
- if (bHealthEnemy && player.Team != local.Team)
- {
- DrawBox(HealthPos, 50, 1, Color.black);
- DrawBox(HealthPos, Health / 2, 1, cHealth);
- }
- }
- }
- break;
- }
- }
- }
- }
- }
- void DoChams()
- {
- if (!bChams) return;
- Unit local = UnitsRegistry.Instance.GetPlayer();
- if (local == null) return;
- List<Unit> players = UnitsRegistry.Instance.GetAllPlayers();
- foreach (Unit player in players)
- {
- if (player == local) continue;
- foreach (SkinnedMeshRenderer skin in player.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>())
- {
- if (local.Team == player.Team)
- {
- if (bChamsFriendly) skin.materials = ChamMats2;
- }
- else
- {
- if (bChamsEnemy) skin.materials = ChamMats;
- }
- }
- }
- }
- void DoBuildDistance()
- {
- if (!bBuildRange) return;
- Unit local = UnitsRegistry.Instance.GetPlayer();
- if (local == null) return;
- BuildGhostController bgc = local.gameObject.GetComponent<BuildGhostController>();
- if (bgc != null)
- {
- ToolLogicBuild tlb = (ToolLogicBuild)bgc.GetType().GetField("tool", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(bgc);
- if (tlb != null)
- {
- if (tlb.SpecialTool != null)
- {
- tlb.SpecialTool.Range = 5.0f;
- }
- }
- }
- }
- void DoInstantReload()
- {
- if (!bInstantReload) return;
- Unit local = UnitsRegistry.Instance.GetPlayer();
- if (local == null) return;
- local.ReloadEnd = 0;
- }
- void DoNoSpread()
- {
- if (!bNoSpread) return;
- Unit local = UnitsRegistry.Instance.GetPlayer();
- if (local == null) return;
- BloomLogic bl = local.gameObject.GetComponent<BloomLogic>();
- if (bl != null)
- {
- bl.Angle = 0.0f;
- }
- }
- void DoNoRecoil()
- {
- if (!bNoRecoil) return;
- Unit local = UnitsRegistry.Instance.GetPlayer();
- if (local == null) return;
- RecoilLogic rl = local.gameObject.GetComponent<RecoilLogic>();
- if (rl != null)
- {
- rl.RecoilAngles = Vector2.zero;
- }
- }
- void DoHacks()
- {
- DoChams();
- DoBuildDistance();
- DoInstantReload();
- DoNoSpread();
- DoNoRecoil();
- DoESP();
- DoAimbot();
- }
- void OnRenderObject()
- {
- CreateLineMaterial();
- CreateChamMaterial();
- CreateChamMaterial2();
- DoHacks();
- }
- DebugMenu _menu = null;
- bool bMenu = false;
- Rect windowRect = new Rect(16, 70, 192, 600);
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.Home)) bMenu = !bMenu;
- }
- void OnGUI()
- {
- //GUI.color = Color.yellow;
- GUI.color = Color.red;
- if (GUI.Button(new Rect(Screen.width - 300, 32, 300, 20), "GameAnarchy Block N Load V1.01")) bMenu = !bMenu;
- if (bMenu)
- {
- GUI.Window(50, windowRect, WindowFunction, "Hacks");
- }
- }
- void WindowFunction(int windowID)
- {
- GUI.color = Color.white;
- GUILayout.BeginVertical();
- if (GUILayout.Button("HELP"))
- {
- Application.OpenURL("http://gameanarchy.net/666/index.php");
- }
- if (GUILayout.Button("Game Debug Menu"))
- {
- if (_menu != null)
- _menu.Show();
- else
- {
- _menu = this.gameObject.AddComponent<DebugMenu>();
- _menu.Show();
- }
- }
- GUILayout.Label("- AIM -");
- bAimbot = GUILayout.Toggle(bAimbot, "Aimbot");
- bAimVisible = GUILayout.Toggle(bAimVisible, "Aim Visible");
- bAimTarget = GUILayout.Toggle(bAimTarget, "Show Aim Targets");
- GUILayout.Label("- WEAPON -");
- bNoRecoil = GUILayout.Toggle(bNoRecoil, "No Recoil");
- bNoSpread = GUILayout.Toggle(bNoSpread, "No Spread");
- bInstantReload = GUILayout.Toggle(bInstantReload, "Instant Reload");
- bBuildRange = GUILayout.Toggle(bBuildRange, "Increase Build Distance");
- GUILayout.Label("- CHAMS -");
- bChams = GUILayout.Toggle(bChams, "Chams");
- bChamsFriendly = GUILayout.Toggle(bChamsFriendly, "Friendly Chams");
- bChamsEnemy = GUILayout.Toggle(bChamsEnemy, "Enemy Chams");
- GUILayout.Label("- ESP -");
- bLines = GUILayout.Toggle(bLines, "Lines");
- bLinesBottom = GUILayout.Toggle(bLinesBottom, "From Bottom");
- bLinesFriend = GUILayout.Toggle(bLinesFriend, "Friendly Lines");
- bLinesEnemy = GUILayout.Toggle(bLinesEnemy, "Enemy Lines");
- bHealth = GUILayout.Toggle(bHealth, "Health");
- bHealthFriend = GUILayout.Toggle(bHealthFriend, "Friendly Health");
- bHealthEnemy = GUILayout.Toggle(bHealthEnemy, "Enemy Health");
- GUILayout.EndVertical();
- GUI.DragWindow();
- }
- }
- class _HOOK
- {
- public static GameObject tst = null;
- static void InitHack()
- {
- if (tst == null)
- {
- tst = new GameObject();
- tst.AddComponent<Hack>();
- GameObject.DontDestroyOnLoad(tst);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement