Advertisement
Guest User

Untitled

a guest
Jan 24th, 2022
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.85 KB | None | 0 0
  1. private static void OnRenderer(int fps, EventArgs args)
  2. {
  3.     if (!gameProcessExists) return; //process is dead, don't bother drawing
  4.     if ((!isGameOnTop) && (!isOverlayOnTop)) return; //if game and overlay are not on top, don't draw
  5.     if (!Components.MainAssemblyToggle.Enabled) return; //main menu boolean to toggle the cheat on or off                      
  6.     if (GWorldPtr == IntPtr.Zero) return;
  7.  
  8.     double fClosestPos = 999999;
  9.     GameCenterPos = new Vector2(wndSize.X / 2 + wndMargins.X, wndSize.Y / 2 + wndMargins.Y);
  10.     GameCenterPos2 = new Vector2(wndSize.X / 2 + wndMargins.X, wndSize.Y / 2 + wndMargins.Y + 750.0f);//even if the game is windowed, calculate perfectly it's "center" for aim or crosshair
  11.  
  12.  
  13.     Functions.Ppc();
  14.     ULevel = Memory.ZwReadPointer(processHandle, GWorldPtr + 0x30, isWow64Process);
  15.     AActors = Memory.ZwReadPointer(processHandle, (IntPtr)ULevel.ToInt64() + 0x98, isWow64Process);
  16.     ActorCnt = Memory.ZwReadUInt32(processHandle, (IntPtr)ULevel.ToInt64() + 0xA0);
  17.     if ((AActors == IntPtr.Zero) || (ActorCnt < 1)) return;
  18.  
  19.     for (uint i = 0; i <= ActorCnt; i++)
  20.     {
  21.         AActor = Memory.ZwReadPointer(processHandle, (IntPtr)(AActors.ToInt64() + i * 8), isWow64Process);
  22.         if (AActor == IntPtr.Zero) continue;
  23.  
  24.         USceneComponent = Memory.ZwReadPointer(processHandle,
  25.             (IntPtr)AActor.ToInt64() + 0x130, isWow64Process);
  26.         if (USceneComponent == IntPtr.Zero) continue;
  27.         tempVec = Memory.ZwReadVector3(processHandle,
  28.             (IntPtr)USceneComponent.ToInt64() + 0x11C);
  29.  
  30.         AActorID = Memory.ZwReadUInt32(processHandle,
  31.             (IntPtr)AActor.ToInt64() + 0x18);
  32.         if (!CachedID.ContainsKey(AActorID))
  33.         {
  34.             var retname = GetNameFromFName(AActorID);
  35.             CachedID.Add(AActorID, retname);
  36.         }
  37.  
  38.         CurrentActorHP = Memory.ZwReadFloat(processHandle, (IntPtr)AActor.ToInt64() + 0x528);
  39.         CurrentActorHPMax = Memory.ZwReadFloat(processHandle, (IntPtr)AActor.ToInt64() + 0x287C);
  40.  
  41.         //string retname = "";
  42.         if ((AActorID > 0)) //&& (AActorID < 700000)
  43.         {
  44.             var retname = CachedID[AActorID];
  45.             retname = GetNameFromFName(AActorID);
  46.             if (retname.Contains("MainCharacter_C") || retname.Contains("DefaultPVPBotCharacter_C") || retname.Contains("DefaultBotCharacter_C")) EnemyID = AActorID;
  47.  
  48.             //Team Info////////////////////////////////////////////////////////////////////////////////////////////////////////
  49.             actor_pawn = Memory.ZwReadPointer(processHandle, (IntPtr)AActor.ToInt64() + 0x118, true);
  50.             Playerstate = Memory.ZwReadPointer(processHandle, (IntPtr)actor_pawn.ToInt64() + 0x240, true);
  51.             IsDowned = Memory.ZwReadBool(processHandle, (IntPtr)AActor.ToInt64() + 0xC18);
  52.             bool bKickbackEnableds = Memory.ZwReadBool(processHandle, (IntPtr)Program.ULocalPlayerControler.ToInt64() + 0xAF8);
  53.             LAKSTeamState = Memory.ZwReadPointer(processHandle, (IntPtr)UplayerState.ToInt64() + Offset_AKSTeamState, true);
  54.             LTeamNum = Memory.ZwReadPointer(processHandle, (IntPtr)LAKSTeamState.ToInt64() + Offset_r_TeamNum, true);
  55.             AKSTeamState = Memory.ZwReadPointer(processHandle, (IntPtr)Playerstate.ToInt64() + Offset_AKSTeamState, true);
  56.             TeamNum = Memory.ZwReadPointer(processHandle, (IntPtr)AKSTeamState.ToInt64() + Offset_r_TeamNum, true);
  57.             ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  58.  
  59.             if (Components.AimbotComponent.NoRecoil.Enabled)
  60.             {
  61.                 bKickbackEnableds = Memory.ZwWriteBool(processHandle, (IntPtr)Program.ULocalPlayerControler.ToInt64() + 0xAF8, false);
  62.             }
  63.             else
  64.             {
  65.                 bKickbackEnableds = Memory.ZwWriteBool(processHandle, (IntPtr)Program.ULocalPlayerControler.ToInt64() + 0xAF8, true);
  66.             }
  67.         }
  68.  
  69.         if (!Components.VisualsComponent.DrawTheVisuals.Enabled) return;
  70.        
  71.         dist = (int)(GetDistance3D(FMinimalViewInfo_Location, tempVec));
  72.         if (AActorID != EnemyID || CurrentActorHP == 0) continue;
  73.         Vector2 vScreen_h3ad = new Vector2(0, 0);
  74.         Vector2 vScreen_f33t = new Vector2(0, 0);
  75.         if (!Renderer.WorldToScreenUE4(new Vector3(tempVec.X, tempVec.Y, tempVec.Z + 70.0f), out vScreen_h3ad, FMinimalViewInfo_Location, FMinimalViewInfo_Rotation, FMinimalViewInfo_FOV, wndMargins, wndSize)) continue;
  76.            
  77.         Renderer.WorldToScreenUE4(new Vector3(tempVec.X, tempVec.Y, tempVec.Z - 70.0f), out vScreen_f33t, FMinimalViewInfo_Location, FMinimalViewInfo_Rotation, FMinimalViewInfo_FOV, wndMargins, wndSize);
  78.         if (Components.VisualsComponent.DrawBox.Enabled)
  79.         {
  80.             if (LTeamNum != TeamNum)
  81.             {
  82.                 Renderer.DrawFPSBox(vScreen_h3ad, vScreen_f33t, Components.VisualsComponent.EnemyColor.Color, BoxStance.standing, Components.VisualsComponent.DrawBoxThic.Value, Components.VisualsComponent.DrawBoxBorder.Enabled, true, CurrentActorHP, CurrentActorHPMax);
  83.                 Renderer.DrawText("[" + dist + "m]", vScreen_f33t.X, vScreen_f33t.Y, Components.VisualsComponent.EnemyColor.Color, 12, TextAlignment.centered, false);
  84.             }
  85.         }
  86.         else
  87.         {
  88.             Renderer.DrawFPSBox(vScreen_h3ad, vScreen_f33t, Color.Blue, BoxStance.standing, Components.VisualsComponent.DrawBoxThic.Value, Components.VisualsComponent.DrawBoxBorder.Enabled);
  89.             Renderer.DrawText("[" + dist + "m]", vScreen_f33t.X, vScreen_f33t.Y, Color.Black, 12, TextAlignment.centered, false);
  90.         }
  91.  
  92.         if (Components.AimbotComponent.DrawFov.Enabled) //draw fov circle
  93.         {
  94.             Renderer.DrawCircle(GameCenterPos, Components.AimbotComponent.AimFov.Value, Components.AimbotComponent.AimFovColor.Color);
  95.         }
  96.         var AimDist2D = GetDistance2D(vScreen_h3ad, GameCenterPos);
  97.         if (Components.AimbotComponent.AimFov.Value < AimDist2D) continue;
  98.  
  99.         if (AimDist2D < fClosestPos)
  100.         {
  101.             fClosestPos = AimDist2D;
  102.             AimTarg2D = vScreen_h3ad;
  103.  
  104.             if (Components.AimbotComponent.AimKey.Enabled && Components.AimbotComponent.AimGlobalBool.Enabled && dist > 5 && LTeamNum != TeamNum)
  105.             {
  106.  
  107.                 double DistX = AimTarg2D.X - GameCenterPos.X;
  108.                 double DistY = (AimTarg2D.Y) - GameCenterPos.Y;
  109.  
  110.                 double slowDistX = DistX / (0.5f + (Math.Abs(DistX) / (1.0f + Components.AimbotComponent.AimSpeed.Value)));
  111.                 double slowDistY = DistY / (0.5f + (Math.Abs(DistY) / (1.0f + Components.AimbotComponent.AimSpeed.Value)));
  112.                 Input.mouse_eventWS(MouseEventFlags.MOVE, (int)slowDistX, (int)slowDistY, MouseEventDataXButtons.NONE, IntPtr.Zero);
  113.  
  114.                 //Vector3 Aimassist = new Vector3()
  115.             }
  116.         }
  117.     }
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement