Advertisement
Guest User

Untitled

a guest
Feb 6th, 2017
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 38.44 KB | None | 0 0
  1. //#define SHOWDEBUG
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. using UnityEngine;
  7. using System.Reflection;
  8. using System.Runtime.InteropServices;
  9. using System.IO;
  10. using System.Reflection.Emit;
  11. using RuntimeHelpers = System.Runtime.CompilerServices.RuntimeHelpers;
  12.  
  13.  
  14. class Hack : MonoBehaviour
  15. {
  16.     static public int[] count = new int[25];
  17.  
  18.  
  19.     bool bMenu      = false;
  20.     bool bHideGUI   = false;
  21.     bool bHideDebug = false;
  22.  
  23.     Rect windowRect = new Rect(256, 128, 192, 400);
  24.  
  25.     //Features
  26.     bool bAimbot = true;
  27.     bool bAimVisible = true;
  28.     bool bAutoFire = false;
  29.  
  30.     bool bChams = true;
  31.     bool bSkeleton = false;
  32.     bool bHealth = true;
  33.     bool bLine = false;
  34.     bool bBox = false;
  35.  
  36.     //Options
  37.     bool bLight = false;
  38.     bool bNoRecoilSpread = true;
  39.     bool bNoOcclusion = true;
  40.  
  41.     //Utility Functions
  42.     Material lineMaterial = null;
  43.     void CreateLineMaterial()
  44.     {
  45.         if (!lineMaterial)
  46.         {
  47.             lineMaterial = new Material("Shader \"Lines/Colored Blended\" {" +
  48.                 "SubShader { Pass { " +
  49.                 "    Blend SrcAlpha OneMinusSrcAlpha " +
  50.                 "    ZWrite Off Cull Off Fog { Mode Off } " +
  51.                 "    ZTest Always" +
  52.                 "    BindChannels {" +
  53.                 "      Bind \"vertex\", vertex Bind \"color\", color }" +
  54.                 "} } }");
  55.             lineMaterial.hideFlags = HideFlags.HideAndDontSave;
  56.             lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
  57.         }
  58.     }
  59.  
  60.     public void DrawLine(Vector3 Start, Vector3 End, Color color)
  61.     {
  62.         lineMaterial.SetPass(0);
  63.  
  64.         GL.PushMatrix();
  65.         GL.LoadOrtho();
  66.         GL.Color(color);
  67.         GL.Begin(GL.LINES);
  68.         GL.Vertex3(Start.x / Screen.width, Start.y / Screen.height, 0);
  69.         GL.Vertex3(End.x / Screen.width, End.y / Screen.height, 0);
  70.         GL.End();
  71.         GL.PopMatrix();
  72.     }
  73.  
  74.     void DrawBox(Vector3 Pos, float Width, float Height, Color color)
  75.     {
  76.         DrawLine(new Vector3(Pos.x, Pos.y, 0), new Vector3(Pos.x + Width, Pos.y, 0), color);
  77.         DrawLine(new Vector3(Pos.x + Width, Pos.y, 0), new Vector3(Pos.x + Width, Pos.y + Height, 0), color);
  78.         DrawLine(new Vector3(Pos.x + Width, Pos.y + Height, 0), new Vector3(Pos.x, Pos.y + Height, 0), color);
  79.         DrawLine(new Vector3(Pos.x, Pos.y + Height, 0), new Vector3(Pos.x, Pos.y, 0), color);
  80.     }
  81.  
  82.     public void DrawBoxCentered(Vector3 Pos, float Width, float Height, Color color)
  83.     {
  84.         float hw = Width / 2;
  85.         float hh = Height / 2;
  86.         DrawLine(new Vector3(Pos.x - hw, Pos.y - hh, Pos.z), new Vector3(Pos.x + hw, Pos.y - hh, Pos.z), color);
  87.         DrawLine(new Vector3(Pos.x - hw, Pos.y + hh, Pos.z), new Vector3(Pos.x + hw, Pos.y + hh, Pos.z), color);
  88.         DrawLine(new Vector3(Pos.x - hw, Pos.y - hh, Pos.z), new Vector3(Pos.x - hw, Pos.y + hh, Pos.z), color);
  89.         DrawLine(new Vector3(Pos.x + hw, Pos.y - hh, Pos.z), new Vector3(Pos.x + hw, Pos.y + hh, Pos.z), color);
  90.     }
  91.     public void DrawCircle(Vector3 Pos, float r, float s, Color color)
  92.     {
  93.         float Step = 3.14159265f * 2.0f / s;
  94.         for (float a = 0; a < 3.14159265 * 2.0; a += Step)
  95.         {
  96.             float x1 = r * Mathf.Cos(a) + Pos.x;
  97.             float y1 = r * Mathf.Sin(a) + Pos.y;
  98.             float x2 = r * Mathf.Cos(a + Step) + Pos.x;
  99.             float y2 = r * Mathf.Sin(a + Step) + Pos.y;
  100.             DrawLine(new Vector3(x1, y1, 0), new Vector3(x2, y2, 0), color);
  101.         }
  102.     }
  103.  
  104.     Material ChamMaterial = null;
  105.     Material[] ChamMats;
  106.     void CreateChamMaterial()
  107.     {
  108.         if (!ChamMaterial)
  109.         {
  110.             ChamMaterial = new Material(
  111.                     "Shader \"Custom/Cham\"" +
  112.                     "{" +
  113.                     "   SubShader " +
  114.                     "   {" +
  115.                     "       Pass " +
  116.                     "       {" +
  117.                     "           ZTest Less" +
  118.                     "           ZWrite On" +
  119.                     "           Color (1,0,0,1) " +
  120.                     "       }" +
  121.                     "       Pass " +
  122.                     "       {" +
  123.                     "           ZTest Greater" +
  124.                     "           ZWrite Off" +
  125.                     "           Color (0,0,1,1)" +
  126.                     "       }" +
  127.                     "   }" +
  128.                     "}");
  129.  
  130.  
  131.             ChamMaterial.hideFlags = HideFlags.HideAndDontSave;
  132.             ChamMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
  133.  
  134.             ChamMats = new Material[] { ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial, ChamMaterial };
  135.         }
  136.     }
  137.  
  138.     Material ChamMaterial2 = null;
  139.     Material[] ChamMats2;
  140.     void CreateChamMaterial2()
  141.     {
  142.         if (!ChamMaterial2)
  143.         {
  144.             ChamMaterial2 = new Material(
  145.                     "Shader \"Custom/Cham\"" +
  146.                     "{" +
  147.                     "   SubShader " +
  148.                     "   {" +
  149.                     "       Pass " +
  150.                     "       {" +
  151.                     "           ZTest Less" +
  152.                     "           ZWrite On" +
  153.                     "           Color (1,1,0,1) " +
  154.                     "       }" +
  155.                     "       Pass " +
  156.                     "       {" +
  157.                     "           ZTest Greater" +
  158.                     "           ZWrite Off" +
  159.                     "           Color (0,1,0,1)" +
  160.                     "       }" +
  161.                     "   }" +
  162.                     "}");
  163.  
  164.  
  165.             ChamMaterial2.hideFlags = HideFlags.HideAndDontSave;
  166.             ChamMaterial2.shader.hideFlags = HideFlags.HideAndDontSave;
  167.  
  168.             ChamMats2 = new Material[] { ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2, ChamMaterial2 };
  169.         }
  170.     }
  171.  
  172.     //public bool IsVisible(GameObject obj, Vector3 Position)
  173.     //{
  174.     //    RaycastHit hit;
  175.  
  176.     //    //Vector3 rayDirection = Camera.main.transform.position - Position;
  177.     //    //if (Physics.Raycast(Position, rayDirection, out hit))
  178.     //    //{
  179.     //    //    if (hit.transform == obj.transform)
  180.     //    //        return true;
  181.     //    //}
  182.  
  183.     //    //return false;
  184.  
  185.     //    Vector3 FromPosition = Camera.main.transform.position;
  186.     //    //FromPosition += Camera.main.transform.forward * 2;
  187.  
  188.     //    //0x440800
  189.     //    if (Physics.Linecast(FromPosition, Position, out hit, 0x440800))
  190.     //    {
  191.  
  192.     //        Vector3 hitESP = Camera.main.WorldToScreenPoint(hit.point);
  193.     //        if (hitESP.z >= 0)
  194.     //        {
  195.     //            if (hit.collider)
  196.     //            {
  197.     //                if (hit.collider.gameObject.transform.root.gameObject == obj.transform.root.gameObject)
  198.     //                {
  199.     //                    DrawCircle(hitESP, 10, 4, Color.cyan);
  200.     //                }
  201.     //                else
  202.     //                {
  203.     //                    DrawCircle(hitESP, 10, 4, Color.magenta);
  204.     //                }
  205.     //            }
  206.     //            else
  207.     //                DrawCircle(hitESP, 10, 4, Color.white);
  208.     //        }
  209.  
  210.          
  211.     //        if (hit.collider)
  212.     //        {
  213.     //            if (hit.collider.gameObject.transform.root.gameObject == obj.transform.root.gameObject) return true;
  214.     //        }
  215.     //    }
  216.     //    return false;
  217.     //}
  218.  
  219.     //Hacks
  220.  
  221.     public bool IsVisible(GameObject obj, Vector3 Position)
  222.     {
  223.         RaycastHit hit;
  224.         Vector3 FromPosition = Camera.main.transform.position;
  225.  
  226.         if (Physics.Linecast(FromPosition, Position, out hit, 0x440800))
  227.         {
  228.             //Vector3 hitESP = Camera.main.WorldToScreenPoint(hit.point);
  229.             //if (hitESP.z >= 0)
  230.             //{
  231.             //    DrawCircle(hitESP, 10, 4, Color.white);
  232.             //}
  233.             return false;
  234.         }
  235.         return true;
  236.     }
  237.  
  238.  
  239.  
  240.  
  241.     bool CanDoHacks()
  242.     {
  243.         if (!Camera.main)               return false;
  244.         if (!Main.get_IsAlive())        return false;
  245.         //if (!Peer.get_ClientGame())     return false;
  246.  
  247.         return true;
  248.     }
  249.  
  250.  
  251.     //Current Skeleton
  252.     Vector3 Head = Vector3.zero;
  253.     Vector3 Neck = Vector3.zero;
  254.     Vector3 Pelvis = Vector3.zero;
  255.     Vector3 LShoulder = Vector3.zero;
  256.     Vector3 LElbow = Vector3.zero;
  257.     Vector3 LHand = Vector3.zero;
  258.     Vector3 LHip = Vector3.zero;
  259.     Vector3 LKnee = Vector3.zero;
  260.     Vector3 LFoot = Vector3.zero;
  261.     Vector3 RShoulder = Vector3.zero;
  262.     Vector3 RElbow = Vector3.zero;
  263.     Vector3 RHand = Vector3.zero;
  264.     Vector3 RHip = Vector3.zero;
  265.     Vector3 RKnee = Vector3.zero;
  266.     Vector3 RFoot = Vector3.zero;
  267.     void ResetSkeleton()
  268.     {
  269.         Head = Vector3.zero;
  270.         Neck = Vector3.zero;
  271.         Pelvis = Vector3.zero;
  272.        
  273.         LShoulder = Vector3.zero;
  274.         LElbow = Vector3.zero;
  275.         LHand = Vector3.zero;
  276.        
  277.         LHip = Vector3.zero;
  278.         LKnee = Vector3.zero;
  279.         LFoot = Vector3.zero;
  280.        
  281.         RShoulder = Vector3.zero;
  282.         RElbow = Vector3.zero;
  283.         RHand = Vector3.zero;
  284.  
  285.         RHip = Vector3.zero;
  286.         RKnee = Vector3.zero;
  287.         RFoot = Vector3.zero;
  288.     }
  289.     void DrawBone(Vector3 Base, Vector3 Tip, Color color)
  290.     {
  291.         if (Base == Vector3.zero) return;
  292.         if (Tip == Vector3.zero) return;
  293.  
  294.         Vector3 ScreenPos1 = Camera.main.WorldToScreenPoint(Base);
  295.         if (ScreenPos1.z < 0) return;
  296.  
  297.         Vector3 ScreenPos2 = Camera.main.WorldToScreenPoint(Tip);
  298.         if (ScreenPos2.z < 0) return;
  299.         DrawLine(ScreenPos1, ScreenPos2, color);
  300.     }
  301.     void DrawSkeleton(Color color)
  302.     {
  303.         DrawBone(Head, Neck, color);
  304.         DrawBone(Neck, Pelvis, color);
  305.  
  306.         DrawBone(Neck, LShoulder, color);
  307.         DrawBone(LShoulder, LElbow, color);
  308.         DrawBone(LElbow, LHand, color);
  309.  
  310.         DrawBone(Pelvis, LHip, color);
  311.         DrawBone(LHip, LKnee, color);
  312.         DrawBone(LKnee, LFoot, color);
  313.  
  314.         DrawBone(Neck, RShoulder, color);
  315.         DrawBone(RShoulder, RElbow, color);
  316.         DrawBone(RElbow, RHand, color);
  317.  
  318.         DrawBone(Pelvis, RHip, color);
  319.         DrawBone(RHip, RKnee, color);
  320.         DrawBone(RKnee, RFoot, color);
  321.     }
  322.  
  323.     //void Aim(BaseMoveController controller,Vector3 Target)
  324.     //{
  325.     //    GameObject obj = new GameObject();
  326.     //    obj.transform.position = Camera.main.transform.position;
  327.     //    obj.transform.LookAt(Target, Vector3.up);
  328.  
  329.     //    float ax = obj.transform.eulerAngles.x - 270;
  330.     //    while (ax < 180)
  331.     //    {
  332.     //        ax += 180;
  333.     //    }
  334.     //    while (ax > 360)
  335.     //    {
  336.     //        ax -= 360;
  337.     //    }
  338.     //    controller.state.euler.y = obj.transform.eulerAngles.y;
  339.     //    controller.state.euler.x = ax;
  340.     //}
  341.  
  342.     void DoHacks()
  343.     {
  344.         //GUILayout.Label("Doing Hacks");
  345.  
  346.         if (!CanDoHacks()) return;
  347.         Camera.main.ResetWorldToCameraMatrix();
  348.  
  349.         this.transform.position = Camera.main.transform.position;
  350.  
  351.         BaseClientGame game             = Peer.get_ClientGame();
  352.         List<EntityNetPlayer> Players   = game.get_AlivePlayers();
  353.         ClientNetPlayer local           = game.get_LocalPlayer();
  354.         EntityNetPlayer localPlayer     = local.get_Entity();
  355.         BaseMoveController controller   = local.get_Controller();
  356.  
  357.         Vector3 Target = Vector3.zero;
  358.         float BestTargetDistance = 10000;
  359.  
  360.         foreach (EntityNetPlayer Player in Players)
  361.         {
  362.             if (Player == localPlayer) continue;
  363.             bool bSameTeam = localPlayer.IsTeam(Player);
  364.             //if (bSameTeam) continue;
  365.  
  366.             Vector3 BonePos = Player.get_NeckPosition();
  367.             Vector3 ScreenPos = Camera.main.WorldToScreenPoint(BonePos);
  368.             if (ScreenPos.z < 0) continue;
  369.  
  370.             Color cPlayer = Color.white;
  371.  
  372.             bool bVisible = IsVisible(Player.gameObject, BonePos);
  373.  
  374.             if (bSameTeam && bVisible) cPlayer = Color.green;
  375.             if (bSameTeam && !bVisible) cPlayer = Color.blue;
  376.             if (!bSameTeam && bVisible) cPlayer = Color.red;
  377.             if (!bSameTeam && !bVisible) cPlayer = Color.yellow;
  378.  
  379.             ResetSkeleton();
  380.             foreach (SkinnedMeshRenderer skin in Player.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>())
  381.             {
  382.                 if (bChams)
  383.                 {
  384.                     if (!bSameTeam)
  385.                         skin.materials = ChamMats;
  386.                     else
  387.                         skin.materials = ChamMats2;
  388.                 }
  389.  
  390.                 foreach (Transform bone in skin.bones)
  391.                 {
  392.                     if (bone.name.Contains("NPC_Head")) Head = bone.position;
  393.                     else if (bone.name.Contains("NPC_Neck")) Neck = bone.position;
  394.                     else if (bone.name.Contains("NPC_Pelvis")) Pelvis = bone.position;
  395.  
  396.                     else if (bone.name.Contains("NPC_L UpperArm")) LShoulder = bone.position;
  397.                     else if (bone.name.Contains("NPC_L Forearm")) LElbow = bone.position;
  398.                     else if (bone.name.Contains("NPC_L Hand")) LHand = bone.position;
  399.  
  400.                     else if (bone.name.Contains("NPC_L Thigh")) LHip = bone.position;
  401.                     else if (bone.name.Contains("NPC_L Calf")) LKnee = bone.position;
  402.                     else if (bone.name.Contains("NPC_L Foot")) LFoot = bone.position;
  403.  
  404.                     else if (bone.name.Contains("NPC_R UpperArm")) RShoulder = bone.position;
  405.                     else if (bone.name.Contains("NPC_R Forearm")) RElbow = bone.position;
  406.                     else if (bone.name.Contains("NPC_R Hand")) RHand = bone.position;
  407.  
  408.                     else if (bone.name.Contains("NPC_R Thigh")) RHip = bone.position;
  409.                     else if (bone.name.Contains("NPC_R Calf")) RKnee = bone.position;
  410.                     else if (bone.name.Contains("NPC_R Foot")) RFoot = bone.position;
  411.                 }
  412.             }
  413.             if (bSkeleton) DrawSkeleton(cPlayer);
  414.  
  415.             if (bLine)
  416.             {
  417.                 Vector3 linePos = Camera.main.WorldToScreenPoint(Pelvis);
  418.                 DrawLine(new Vector3(Screen.width / 2, 0, 0), linePos, cPlayer);
  419.             }
  420.            
  421.             if (bBox)
  422.             {
  423.                 Vector3 top     = Camera.main.WorldToScreenPoint(Head);
  424.                 Vector3 middle  = Camera.main.WorldToScreenPoint(Pelvis);
  425.                 Vector3 bottom = Camera.main.WorldToScreenPoint(LFoot);
  426.                 float s = bottom.y - top.y;
  427.                 DrawBoxCentered(middle, s / 2, s, cPlayer);
  428.             }
  429.  
  430.             if (bHealth)
  431.             {
  432.                 float Health = Player.get_Health();
  433.  
  434.                 Color cHealth = Color.green;
  435.                 if (Health < 70) cHealth = Color.yellow;
  436.                 if (Health < 35) cHealth = Color.red;
  437.  
  438.                 Vector3 HealthPos = ScreenPos;
  439.                 HealthPos.x -= 25;
  440.                 HealthPos.y += 16;
  441.                 DrawBox(HealthPos, 50, 1, Color.black);
  442.                 DrawBox(HealthPos, Health / 2, 1, cHealth);
  443.             }
  444.  
  445.             if (!bSameTeam && (!bAimVisible || (bAimVisible && bVisible)))
  446.             {
  447.                 float xDiff = ScreenPos.x - (Screen.width / 2);
  448.                 float yDiff = ScreenPos.y - (Screen.height / 2);
  449.                 float dist = (float)Math.Sqrt(xDiff * xDiff + yDiff * yDiff);
  450.                 if (dist < BestTargetDistance)
  451.                 {
  452.                     BestTargetDistance = dist;
  453.                     Target = Neck;
  454.                 }
  455.             }
  456.         }
  457.  
  458.         if (bAimbot && Input.GetKey(KeyCode.LeftShift))
  459.         {
  460.             if (Target != Vector3.zero)
  461.             {
  462.                 Vector3 targetESP = Camera.main.WorldToScreenPoint(Target);
  463.                 DrawCircle(targetESP, 10, 10, Color.green);
  464.  
  465.                 Aim(controller, Target);
  466.                 //Move(mx, my);
  467.                 //if (bAutoFire && (MoveSpeed < 5)) LeftClick();
  468.             }
  469.         }
  470.  
  471.     }
  472.  
  473.     void DoHacks1()
  474.     {
  475.         if (!CanDoHacks()) return;
  476.         Camera.main.ResetWorldToCameraMatrix();
  477.  
  478.         this.transform.position = Camera.main.transform.position;
  479.  
  480.         BaseClientGame game = Peer.get_ClientGame();
  481.         List<EntityNetPlayer> Players = game.get_AlivePlayers();
  482.         ClientNetPlayer local = game.get_LocalPlayer();
  483.         EntityNetPlayer localPlayer = local.get_Entity();
  484.         BaseMoveController controller = local.get_Controller();
  485.  
  486.         Vector3 Target = Vector3.zero;
  487.         float BestTargetDistance = 10000;
  488.         bool bWasVisible = false;
  489.  
  490.         foreach (EntityNetPlayer Player in Players)
  491.         {
  492.             if (Player == localPlayer) continue;
  493.  
  494.             Vector3 BonePos = Player.get_NeckPosition();
  495.             Vector3 ScreenPos = Camera.main.WorldToScreenPoint(BonePos);
  496.             if (ScreenPos.z < 0) continue;
  497.  
  498.             bool bSameTeam = localPlayer.IsTeam(Player);
  499.  
  500.             Color cPlayer = Color.white;
  501.             bool bVisible = IsVisible(Player.gameObject, BonePos);
  502.  
  503.             if (bSameTeam && bVisible) cPlayer = Color.green;
  504.             if (bSameTeam && !bVisible) cPlayer = Color.blue;
  505.             if (!bSameTeam && bVisible) cPlayer = Color.red;
  506.             if (!bSameTeam && !bVisible) cPlayer = Color.yellow;
  507.  
  508.             foreach (SkinnedMeshRenderer skin in Player.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>())
  509.             {
  510.                 if (bChams)
  511.                 {
  512.                     if (!bSameTeam)
  513.                         skin.materials = ChamMats;
  514.                     else
  515.                         skin.materials = ChamMats2;
  516.                 }
  517.             }
  518.  
  519.             if (bLine && !bSameTeam)
  520.             {
  521.                 DrawLine(new Vector3(Screen.width / 2, 0, 0), ScreenPos, cPlayer);
  522.             }
  523.  
  524.  
  525.             if (bHealth && !bSameTeam)
  526.             {
  527.                 float Health = Player.get_Health();
  528.  
  529.                 Color cHealth = Color.green;
  530.                 if (Health < 70) cHealth = Color.yellow;
  531.                 if (Health < 35) cHealth = Color.red;
  532.  
  533.                 Vector3 HealthPos = ScreenPos;
  534.                 HealthPos.x -= 25;
  535.                 HealthPos.y += 16;
  536.                 DrawBox(HealthPos, 50, 1, Color.black);
  537.                 DrawBox(HealthPos, Health / 2, 1, cHealth);
  538.             }
  539.  
  540.             if (!bSameTeam && (!bAimVisible || (bAimVisible && bVisible)))
  541.             {
  542.                 float xDiff = ScreenPos.x - (Screen.width / 2);
  543.                 float yDiff = ScreenPos.y - (Screen.height / 2);
  544.                 float dist = (float)Math.Sqrt(xDiff * xDiff + yDiff * yDiff);
  545.                 if (dist < BestTargetDistance)
  546.                 {
  547.                     BestTargetDistance = dist;
  548.                     Target = BonePos;
  549.                     bWasVisible = bVisible;
  550.                 }
  551.             }
  552.         }
  553.  
  554.         if (bAimbot && Target != Vector3.zero)
  555.         {
  556.             Vector3 targetESP = Camera.main.WorldToScreenPoint(Target);
  557.             DrawCircle(targetESP, 10, 10, Color.green);
  558.  
  559.             if (bWasVisible)
  560.             {
  561.                 DrawCircle(targetESP, 5, 10, Color.green);
  562.             }
  563.         }
  564.  
  565.         if (bAimbot && Input.GetKey(KeyCode.LeftShift))
  566.         {
  567.             if (Target != Vector3.zero)
  568.             {
  569.                 Aim(controller, Target);
  570.             }
  571.         }
  572.  
  573.     }
  574.  
  575.     Vector3 TestPos;
  576.     void DoHacks2()
  577.     {
  578.         //GUILayout.Label("Doing Hacks");
  579.  
  580.         if (!CanDoHacks()) return;
  581.         Camera.main.ResetWorldToCameraMatrix();
  582.  
  583.         this.transform.position = Camera.main.transform.position;
  584.  
  585.         BaseClientGame game = Peer.get_ClientGame();
  586.         List<EntityNetPlayer> Players = game.get_AlivePlayers();
  587.         ClientNetPlayer local = game.get_LocalPlayer();
  588.         EntityNetPlayer localPlayer = local.get_Entity();
  589.         BaseMoveController controller = local.get_Controller();
  590.  
  591.  
  592.         if (Input.GetKey(KeyCode.Keypad0))
  593.         {
  594.             //TestPos = controller.state.pos;
  595.             TestPos = controller.transform.position;
  596.         }
  597.         Vector3 TestScreenPos = Camera.main.WorldToScreenPoint(TestPos);
  598.         DrawCircle(TestScreenPos, 10, 10, Color.green);
  599.  
  600.        
  601.         GUILayout.Label("State: " + controller.state.euler.x + "," + controller.state.euler.y);
  602.  
  603.         GameObject obj = new GameObject();
  604.         obj.transform.position = Camera.main.transform.position;
  605.         //obj.transform.position = controller.transform.position;
  606.         //obj.transform.rotation = controller.transform.rotation;
  607.         obj.transform.LookAt(TestPos,Vector3.up);
  608.  
  609.         GUILayout.Label("Look: " + obj.transform.eulerAngles.x + "," + obj.transform.eulerAngles.y);
  610.  
  611.         float ax = obj.transform.eulerAngles.x - 270;
  612.  
  613.         while (ax < 180)
  614.         {
  615.             ax += 180;
  616.         }
  617.         while (ax > 360)
  618.         {
  619.             ax -= 360;
  620.         }
  621.         GUILayout.Label("ax: " + ax);
  622.  
  623.  
  624.      
  625.         if (Input.GetKey(KeyCode.LeftShift))
  626.         {
  627.             controller.state.euler.y = obj.transform.eulerAngles.y;
  628.             controller.state.euler.x = ax;
  629.         }
  630.         if (Input.GetKey(KeyCode.LeftControl))
  631.         {
  632.             controller.state.euler.x = ax;
  633.         }
  634.  
  635.         if (Input.GetKey(KeyCode.Keypad1))
  636.         {
  637.             controller.state.euler.x += 1;
  638.         }
  639.  
  640.         foreach (EntityNetPlayer Player in Players)
  641.         {
  642.             if (Player == localPlayer) continue;
  643.             bool bSameTeam = localPlayer.IsTeam(Player);
  644.             if (bSameTeam) continue;
  645.  
  646.             if (bChams)
  647.             {
  648.                 foreach (SkinnedMeshRenderer skin in Player.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>())
  649.                 {
  650.                     skin.materials = ChamMats;
  651.                 }
  652.             }
  653.  
  654.             Vector3 BonePos = Player.get_NeckPosition();
  655.             Vector3 ScreenPos = Camera.main.WorldToScreenPoint(BonePos);
  656.             if (ScreenPos.z < 0) continue;
  657.  
  658.             if (bHealth)
  659.             {
  660.                 float Health = Player.get_Health();
  661.  
  662.                 Color cHealth = Color.green;
  663.                 if (Health < 70) cHealth = Color.yellow;
  664.                 if (Health < 35) cHealth = Color.red;
  665.  
  666.                 Vector3 HealthPos = ScreenPos;
  667.                 HealthPos.x -= 25;
  668.                 HealthPos.y += 16;
  669.                 DrawBox(HealthPos, 50, 1, Color.black);
  670.                 DrawBox(HealthPos, Health / 2, 1, cHealth);
  671.             }
  672.         }
  673.     }
  674.  
  675.     //Hooks
  676.  
  677.     class _h1 : BaseWeapon
  678.     {
  679.         public float get_CurrentAccuracy()
  680.         {
  681.             return 0;
  682.         }
  683.         //public float get_firerate()
  684.         //{
  685.         //    return 1;
  686.         //}
  687.         //public float get_reloadSpeed()
  688.         //{
  689.         //    return 1f;
  690.         //}
  691.     }
  692.  
  693.     class _h2 : HtmlLayer
  694.     {
  695.         public static void SendFile(string actions, byte[] data, RequestFinished finished = null, RequestFailed failed = null)
  696.         {
  697.             Hack.count[0] += 1;
  698.             return;
  699.         }
  700.     }
  701.  
  702.     class _h3 : AntiWallHack
  703.     {
  704.         private void Update()
  705.         {
  706.             Hack.count[1] += 1;
  707.             return;
  708.         }
  709.         public void Ban()
  710.         {
  711.             Hack.count[2] += 1;
  712.             return;
  713.         }
  714.         private void DisconnectAndBan()
  715.         {
  716.             Hack.count[3] += 1;
  717.             return;
  718.         }
  719.         public bool IsEquals(Color col1, Color col2)
  720.         {
  721.             Hack.count[4] += 1;
  722.             return false;
  723.         }
  724.         public static void CaptureScreenshot(string reporterNick, int reporterID)
  725.         {
  726.             Hack.count[5] += 1;
  727.             return;
  728.         }
  729.         public void InvokeCheck()
  730.         {
  731.             Hack.count[6] += 1;
  732.             return;
  733.         }
  734.     }
  735.  
  736.     class _h4 : Main
  737.     {
  738.         private void OnEmuFailure(string method)
  739.         {
  740.             Hack.count[7] += 1;
  741.             return;
  742.         }
  743.     }
  744.  
  745.     class _h5 : MipmapCheck
  746.     {
  747.         public static void Check()
  748.         {
  749.             Hack.count[8] += 1;
  750.             return;
  751.         }
  752.         private bool IsEuqal(Color col1, Color col2)
  753.         {
  754.             Hack.count[9] += 1;
  755.             return false;
  756.         }
  757.     }
  758.  
  759.     class _h6 : Utility
  760.     {
  761.         public static Texture2D CaptureCustomScreenshot(int width, int height)
  762.         {
  763.             Hack.count[10] += 1;
  764.  
  765.             Texture2D texture2D1 = new Texture2D(width, height, (TextureFormat)3, true, false);
  766.             //texture2D1.ReadPixels(new Rect(0.0f, 0.0f, (float)width, (float)height), 0, 0);
  767.  
  768.             int num = Screen.width / 800;
  769.             Texture2D texture2D2 = new Texture2D(width >> num, height >> num, (TextureFormat)3, false, false);
  770.             texture2D2.SetPixels32(texture2D1.GetPixels32(num));
  771.             texture2D2.Apply();
  772.             return texture2D2;
  773.         }
  774.     }
  775.  
  776.     class _h7 : HoneyPot
  777.     {
  778.         public override void Initialize(object[] args)
  779.         {
  780.             Hack.count[11] += 1;
  781.             return;
  782.         }
  783.     }
  784.  
  785.  
  786.     bool HookFunction(MethodBase Original, MethodBase HookClass)
  787.     {
  788.         if (Original == null) return false;
  789.         if (HookClass == null) return false;
  790.  
  791.         IntPtr pBody1 = Original.MethodHandle.GetFunctionPointer();
  792.         IntPtr pBody2 = HookClass.MethodHandle.GetFunctionPointer();
  793.  
  794.         if (pBody1 == null) return false;
  795.         if (pBody2 == null) return false;
  796.  
  797.         unsafe
  798.         {
  799.             var ptr         = (byte*)pBody1.ToPointer();
  800.             Int32 Source    = (Int32)pBody1.ToPointer();
  801.             Int32 Dest      = (Int32)pBody2.ToPointer();
  802.  
  803.             (*(byte*)(ptr + 0))     = 0xE9;
  804.             (*(Int32*)(ptr + 1))    = Dest - (Source + 5);
  805.         }
  806.  
  807.         GUILayout.Label("Hooked: " + Original.Name);
  808.         return true;
  809.     }
  810.  
  811.     bool b1 = false;
  812.     bool b2 = false;
  813.     bool b3 = false;
  814.     bool b4 = false;
  815.     bool b5 = false;
  816.     bool b6 = false;
  817.     bool b7 = false;
  818.     bool b8 = false;
  819.     bool b9 = false;
  820.     bool b10 = false;
  821.     bool b11 = false;
  822.     bool b12 = false;
  823.     bool b13 = false;
  824.     bool b14 = false;
  825.     bool b15 = false;
  826.  
  827.     void DoHooks()
  828.     {
  829.  
  830. #if SHOWDEBUG
  831.         GUILayout.Label("Hooking Shit : " + cygwin_x32.CygWin32L.Instance.AssemblyCount);
  832.  
  833.         GUILayout.Label("b1 : " + b1);
  834.         GUILayout.Label("b2 : " + b2);
  835.         GUILayout.Label("b3 : " + b3);
  836.         GUILayout.Label("b4 : " + b4);
  837.         GUILayout.Label("b5 : " + b5);
  838.         GUILayout.Label("b6 : " + b6);
  839.         GUILayout.Label("b7 : " + b7);
  840.         GUILayout.Label("b8 : " + b8);
  841.         GUILayout.Label("b9 : " + b9);
  842.         GUILayout.Label("b10 : " + b10);
  843.         GUILayout.Label("b11 : " + b11);
  844.         GUILayout.Label("b12 : " + b12);
  845.         GUILayout.Label("b13 : " + b13);
  846.         GUILayout.Label("b14 : " + b14);
  847.         GUILayout.Label("b15 : " + b15);
  848. #endif
  849.  
  850.         //{
  851.         //    MethodBase method1 = typeof(NetEmulation).GetMethod("OnEmuFailure", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  852.         //    MethodBase method2 = typeof(_h4).GetMethod("OnEmuFailure", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  853.         //    HookFunction(method1, method2);
  854.         //}
  855.  
  856.         {
  857.             if (!b1)
  858.             {
  859.                 MethodBase method1 = typeof(Main).GetMethod("OnEmuFailure", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  860.                 MethodBase method2 = typeof(_h4).GetMethod("OnEmuFailure", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  861.                 b1 = HookFunction(method1, method2);
  862.             }
  863.         }
  864.  
  865.         {
  866.             if (!b2)
  867.             {
  868.                 MethodBase method1 = typeof(HtmlLayer).GetMethod("SendFile", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  869.                 MethodBase method2 = typeof(_h2).GetMethod("SendFile", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  870.                 b2 = HookFunction(method1, method2);
  871.             }
  872.         }
  873.  
  874.         {
  875.             if (!b3)
  876.             {
  877.                 MethodBase method1 = typeof(HoneyPot).GetMethod("Initialize", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  878.                 MethodBase method2 = typeof(_h7).GetMethod("Initialize", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  879.                 b3 = HookFunction(method1, method2);
  880.             }
  881.         }
  882.  
  883.  
  884.         {
  885.             if (!b4)
  886.             {
  887.                 MethodBase method1 = typeof(AntiWallHack).GetMethod("Update", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  888.                 MethodBase method2 = typeof(_h3).GetMethod("Update", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  889.                 b4 = HookFunction(method1, method2);
  890.             }
  891.         }
  892.         {
  893.             if (!b5)
  894.             {
  895.                 MethodBase method1 = typeof(AntiWallHack).GetMethod("Ban", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  896.                 MethodBase method2 = typeof(_h3).GetMethod("Ban", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  897.                 b5 = HookFunction(method1, method2);
  898.             }
  899.         }
  900.         {
  901.             if (!b6)
  902.             {
  903.                 MethodBase method1 = typeof(AntiWallHack).GetMethod("DisconnectAndBan", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  904.                 MethodBase method2 = typeof(_h3).GetMethod("DisconnectAndBan", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  905.                 b6 = HookFunction(method1, method2);
  906.             }
  907.         }
  908.         {
  909.             if (!b13)
  910.             {
  911.                 MethodBase method1 = typeof(AntiWallHack).GetMethod("IsEquals", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  912.                 MethodBase method2 = typeof(_h3).GetMethod("IsEquals", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  913.                 b13 = HookFunction(method1, method2);
  914.             }
  915.         }
  916.  
  917.         {
  918.             if (!b7)
  919.             {
  920.                 MethodBase method1 = typeof(AntiWallHack).GetMethod("CaptureScreenshot", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  921.                 MethodBase method2 = typeof(_h3).GetMethod("CaptureScreenshot", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  922.                 b7 = HookFunction(method1, method2);
  923.             }
  924.         }
  925.  
  926.         {
  927.             if (!b8)
  928.             {
  929.                 MethodBase method1 = typeof(AntiWallHack).GetMethod("InvokeCheck", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  930.                 MethodBase method2 = typeof(_h3).GetMethod("InvokeCheck", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  931.                 b8 = HookFunction(method1, method2);
  932.             }
  933.         }
  934.  
  935.         {
  936.             if (!b9)
  937.             {
  938.                 MethodBase method1 = typeof(Utility).GetMethod("CaptureCustomScreenshot", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  939.                 MethodBase method2 = typeof(_h6).GetMethod("CaptureCustomScreenshot", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  940.                 b9 = HookFunction(method1, method2);
  941.             }
  942.         }
  943.  
  944.  
  945.         {
  946.             if (!b10)
  947.             {
  948.                 MethodBase method1 = typeof(MipmapCheck).GetMethod("Check", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  949.                 MethodBase method2 = typeof(_h5).GetMethod("Check", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  950.                 b10 = HookFunction(method1, method2);
  951.             }
  952.         }
  953.         {
  954.             if (!b11)
  955.             {
  956.                 MethodBase method1 = typeof(MipmapCheck).GetMethod("IsEuqal", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  957.                 MethodBase method2 = typeof(_h5).GetMethod("IsEuqal", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  958.                 b11 = HookFunction(method1, method2);
  959.             }
  960.         }
  961.  
  962.         //{
  963.         //    if (bNoRecoilSpread)
  964.         //    {
  965.         //        if (!b12)
  966.         //        {
  967.         //            MethodBase method1 = typeof(ClientWeapon).GetMethod("get_CurrentAccuracy", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  968.         //            MethodBase method2 = typeof(_h1).GetMethod("get_CurrentAccuracy", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  969.         //            b12 = HookFunction(method1, method2);
  970.         //        }
  971.         //    }
  972.         //}
  973.  
  974.         //{
  975.         //    MethodBase method1 = typeof(ClientWeapon).GetMethod("get_firerate", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  976.         //    MethodBase method2 = typeof(ClientWeapon_hook).GetMethod("get_firerate", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  977.         //    HookFunction(method1, method2);
  978.         //}
  979.         //{
  980.         //    MethodBase method1 = typeof(ClientWeapon).GetMethod("get_reloadSpeed", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  981.         //    MethodBase method2 = typeof(ClientWeapon_hook).GetMethod("get_reloadSpeed", BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
  982.         //    HookFunction(method1, method2);
  983.         //}
  984.     }
  985.  
  986.  
  987.  
  988.  
  989.     //Handle GUI Stuff...
  990.     void Update()
  991.     {
  992.         //return;
  993.  
  994.         CVars.AWHType = 0;
  995.  
  996.         if (Input.GetKeyDown(KeyCode.Insert))   bHideGUI    = !bHideGUI;
  997.         if (Input.GetKeyDown(KeyCode.Home))     bMenu       = !bMenu;
  998.         //if (Input.GetKeyDown(KeyCode.End)) bHideDebug = !bHideDebug;
  999.         if (Input.GetKeyDown(KeyCode.End)) bLight = !bLight;
  1000.     }
  1001.  
  1002.     ObjEdit editor = null;
  1003.  
  1004.     void OnGUI()
  1005.     {
  1006.         //DoHooks();
  1007.  
  1008.         //GUILayout.Label("Loaded...");
  1009.         //return;
  1010.  
  1011.         CreateLineMaterial();
  1012.         CreateChamMaterial();
  1013.         CreateChamMaterial2();
  1014.  
  1015.         if (!this.light)
  1016.         {
  1017.             this.gameObject.AddComponent<Light>();
  1018.             this.light.color = Color.white;
  1019.             this.light.type = LightType.Point;
  1020.             this.light.range = 300;
  1021.             this.light.shadows = LightShadows.None;
  1022.             this.light.intensity = 1;
  1023.         }
  1024.         else
  1025.         {
  1026.             this.light.enabled = bLight;
  1027.         }
  1028.  
  1029.  
  1030.         GUI.color = Color.red;
  1031.         GUI.color = Color.white;
  1032.  
  1033.         //if (!editor) editor = this.GetComponent<ObjEdit>();
  1034.         //if (editor && editor.bActive)
  1035.         //{
  1036.         //    bMenu = false;
  1037.         //    if (GUI.Button(new Rect(0, 0, 80, 20), "EXIT")) editor.bActive = false;
  1038.         //    return;
  1039.         //}
  1040.  
  1041.         if (bHideGUI == false)
  1042.         {
  1043.             if (GUI.Button(new Rect(Screen.width - 305, Screen.height-25, 300, 20), "GameAnarchy Contract Wars v1.33c")) bMenu = !bMenu;
  1044.  
  1045.             if (bMenu)
  1046.             {
  1047.                 GUI.color = Color.red;
  1048.                 windowRect = GUI.Window(50, windowRect, WindowFunction, "Hacks");
  1049.             }
  1050.         }
  1051.  
  1052.         //if (Event.current.type == EventType.Repaint)
  1053.         //{
  1054.         //    if (Camera.main != null)
  1055.         //    {
  1056.         //        Camera.main.ResetWorldToCameraMatrix();
  1057.         //        Camera.main.useOcclusionCulling = !bNoOcclusion;
  1058.  
  1059.         //        //DoHooks();
  1060.         //    }
  1061.         //}
  1062.  
  1063.         DoHacks1();
  1064.  
  1065.         //GUI.color = Color.white;
  1066.         //GUILayout.Label("Test");
  1067.         //for (int i = 0; i < 12; i++)
  1068.         //{
  1069.         //    GUILayout.Label(i + ": " + count[i].ToString());
  1070.         //}
  1071.         DoHooks();
  1072.  
  1073.  
  1074.     }
  1075.  
  1076.     class GAExit : MonoBehaviour
  1077.     {
  1078.         void Update()
  1079.         {
  1080.             GameObject.Destroy(this);
  1081.         }
  1082.     }
  1083.  
  1084.     void WindowFunction(int windowID)
  1085.     {
  1086.         GUI.color = Color.white;
  1087.         GUILayout.BeginVertical();
  1088.  
  1089.         bAimbot = GUILayout.Toggle(bAimbot, "Aim Assist");
  1090.         bAimVisible = GUILayout.Toggle(bAimVisible, "Aim Visible");
  1091.         //bAutoFire = GUILayout.Toggle(bAutoFire, "Auto Fire");
  1092.  
  1093.         bChams = GUILayout.Toggle(bChams, "Chams");
  1094.         //bSkeleton = GUILayout.Toggle(bSkeleton, "Skeletons");
  1095.         bHealth = GUILayout.Toggle(bHealth, "Health Bars");
  1096.         //bLine = GUILayout.Toggle(bLine, "Lines");
  1097.         //bBox = GUILayout.Toggle(bBox, "Boxes");
  1098.  
  1099.         GUILayout.Label("- OPTIONS -");
  1100.         bLight = GUILayout.Toggle(bLight, "Light");
  1101.         //bNoRecoilSpread = GUILayout.Toggle(bNoRecoilSpread, "No Spread/Recoil");
  1102.         //bNoOcclusion = GUILayout.Toggle(bNoOcclusion, "No Occlusion");
  1103.  
  1104.         //if (GUILayout.Button("Editor"))
  1105.         //{
  1106.         //    if (editor != null) editor.bActive = true;
  1107.         //}
  1108.         if (GUILayout.Button("HELP"))
  1109.         {
  1110.             Application.OpenURL("http://gameanarchy.net/666/");
  1111.         }
  1112.         if (GUILayout.Button("Quit Hack"))
  1113.         {
  1114.             GameObject.Destroy(_HOOK.tst);
  1115.             GameObject e = new GameObject();
  1116.             e.AddComponent<GAExit>();
  1117.         }
  1118.  
  1119.         GUILayout.EndVertical();
  1120.         GUI.DragWindow();
  1121.     }
  1122.  
  1123.  
  1124. }
  1125.  
  1126.  
  1127. class _HOOK
  1128. {
  1129.     public static GameObject tst = null;
  1130.     static void InitHack()
  1131.     {
  1132.         if (tst == null)
  1133.         {
  1134.             tst = new GameObject();
  1135.             tst.AddComponent<Hack>();
  1136.             //tst.AddComponent<ObjEdit>();
  1137.             GameObject.DontDestroyOnLoad(tst);
  1138.         }
  1139.     }
  1140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement