SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2.  
  3. namespace sad
  4. {
  5.     internal class Aimbot
  6.     {
  7.         public static float fov = 30;
  8.         public static void Aim()
  9.         {
  10.             Vector3 posTargetPlayer = Aimbot.GetPosTargetPlayer();
  11.             if (posTargetPlayer == Vector3.zero)
  12.             {
  13.                 return;
  14.             }
  15.             Quaternion quaternion = Quaternion.LookRotation(posTargetPlayer - MainCamera.mainCamera.transform.position, Vector3.right);
  16.             float num = quaternion.eulerAngles.x;
  17.             num = ((MainCamera.mainCamera.transform.position.y < posTargetPlayer.y) ? (-360f + num) : num);
  18.             num = Mathf.Clamp(num, -89f, 89f);
  19.             LocalPlayer.Entity.input.SetViewVars(new Vector3(num, quaternion.eulerAngles.y, 0f));
  20.         }
  21.  
  22.         private static Vector3 GetPosTargetPlayer()
  23.         {
  24.             Vector3 result = Vector3.zero;
  25.             Vector2 vector = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2));
  26.             float num = 999f;
  27.             foreach (BasePlayer basePlayer in BasePlayer.VisiblePlayerList)
  28.             {
  29.                 if (!(basePlayer == null) && !basePlayer.IsLocalPlayer() && !basePlayer.IsSleeping() && basePlayer.health > 0f)
  30.                 {
  31.                     Model model = basePlayer.GetModel();
  32.                     Vector3 positionBone = new Vector3(model.headBone.position.x, model.eyeBone.position.y, model.headBone.position.z);
  33.                     if (!(positionBone == Vector3.zero))
  34.                     {
  35.                         Vector3 screenPos = MainCamera.mainCamera.WorldToScreenPoint(positionBone);
  36.                         if (screenPos.z > 0f)
  37.                         {
  38.                             Vector2 vector2 = new Vector2(screenPos.x, (float)Screen.height - screenPos.y);
  39.                             float num2 = Mathf.Abs(Vector2.Distance(vector, vector2));
  40.                             if (num2 <= fov && num2 <= num)
  41.                             {
  42.                                 result = positionBone;
  43.                                 num = num2;
  44.                                 int distance = (int)Vector3.Distance(LocalPlayer.Entity.transform.position, basePlayer.transform.position);
  45.                                 if(distance > 70)
  46.                                 {
  47.                                     int vel = distance - 70 / 10 - 8;
  48.                                     result.y = vel;
  49.                                 }
  50.                             }
  51.                         }
  52.                     }
  53.                 }
  54.             }
  55.             return result;
  56.         }
  57.     }
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top