冰楓論壇

 找回密碼
 立即註冊
ads_sugarbook
搜索
查看: 3314|回覆: 1
打印 上一主題 下一主題

[資源分享] Special Force 2 完整SDK + Source

[複製鏈接]

15

主題

12

好友

31

積分

新手上路

Rank: 1

UID
195926
帖子
263
主題
15
精華
0
積分
31
楓幣
318
威望
29
存款
0
贊助金額
0
推廣
0
GP
41
閱讀權限
10
在線時間
41 小時
註冊時間
2017-7-10
最後登入
2023-9-24

2019聖誕節紀念勳章

跳轉到指定樓層
1
發表於 2019-12-18 10:07:19 |只看該作者 |倒序瀏覽
版上沒什麼類似這樣的文章分享 或者 該款遊戲外掛輔助
都是成品或者廣告商
故想說盡這麼一小份心力,提供相關的文章供學習參考用
小弟我個人非原創 , 但保證絕對可用。
有興趣的要研究的 歡迎詢問
可以在下方留言給我,我會盡我能知道的盡量回答。
之後看情況發"可執行檔"
遊戲引擎繪製 " Unreal Engine 3 "
其功能包含:方框,骨骼,頭圈,標記線,血量,距離透視 + 十字準心
同以下程式碼。
程式碼內涵:自瞄,2D雷達,3D框透,敵我判別+選項設定
有興趣的可以加以研究,學習。 SDK.zip (3.79 MB, 下載次數: 51)

Visual Studio 2017 編譯

MenuDefines.hpp
  1. #define URotationToRadians( URotation )                ( ( URotation ) * ( CONST_Pi / 32768.0f ) )

  2. bool bHWNDtaken = false;
  3. HWND hwnd;

  4. INT Spam = 0;
  5. FLOAT LastTickSpam = 0.0f;
  6. FLOAT CurrentTickSpam;

  7. INT Bone = 0;
  8. FLOAT LastTickBone = 0.0f;
  9. FLOAT CurrentTickBone;


  10. INT RandBone = 0;
  11. FLOAT LastTickRandBone = 0.0f;
  12. FLOAT CurrentTickRandBone;

  13. bool bEnableAim = false;
  14. wchar_t* wAimKey[] = { L"RMOUSE", L"LMOUSE", L"SHIFT", L"L.ALT", L"ALWAYS" };
  15. int iAimKey = 0;
  16. wchar_t* wAimBy[] = { L"DISTANCE", L"FOV", L"HP" };
  17. int iAimBy = 0;
  18. wchar_t* wFovAngle[] = { L"1", L"2", L"3", L"5", L"10", L"25", L"30", L"45" };
  19. int iFovAngle = 0;
  20. wchar_t* wHPLimit[] = { L"0", L"25", L"50", L"75", L"99" };
  21. int iHPLimit = 0;
  22. wchar_t* wAimPosition[] = { L"RAND", L"HEAD", L"CHEST", L"HAND" };
  23. int iAimPosition = 0;
  24. wchar_t* wBoneRefreshTime[] = { L"0", L"20ms", L"40ms", L"60ms", L"80ms", L"100ms" };
  25. int iBoneRefreshTime = 0;
  26. bool bBoneRefreshed = false;
  27. bool bAutoFire = false;
  28. wchar_t* wSmoothAim[] = { L"0", L"1", L"2", L"3", L"4", L"5" };
  29. int iSmoothAim = 0;
  30. bool bSilentAim = false;
  31. bool bSmartAccuracy = false;
  32. bool bHardLock = false;

  33. wchar_t* wEnableEsp[] = { L"ENEMY", L"TEAM", L"BOTH" };
  34. int iEnableEsp = 2;
  35. bool bNameEsp = false;
  36. bool bDistanceEsp = false;
  37. bool bHealthEsp = false;
  38. bool bBoneEsp = false;
  39. bool bHeadCircle = false;
  40. wchar_t* wBoundingBox[] = { L"OFF", L"3D", L"2D" };
  41. int iBoundingBox = 0;
  42. bool bLaserEsp = false;
  43. bool AlienZombie = false;
  44. bool bSnapLines = false;
  45. bool bGrenadeEsp = false;
  46. bool bDeadVisible = false;
  47. bool bShowStats = false;
  48. wchar_t* wEnemyVis[] = { L"BLUE", L"RED", L"YELLOW" };
  49. int iEnemyVis = 1;
  50. wchar_t* wEnemyInv[] = { L"BLUE", L"RED", L"YELLOW" };
  51. int iEnemyInv = 0;
  52. wchar_t* wTeamVis[] = { L"BLUE", L"GREEN", L"YELLOW" };
  53. int iTeamVis = 1;
  54. wchar_t* wTeamInv[] = { L"BLUE", L"GREEN", L"YELLOW" };
  55. int iTeamInv = 1;

  56. wchar_t* wCrosshair[] = { L"OFF", L"ON" };
  57. int iCrosshair = 0;
  58. wchar_t* wCrosshairSize[] = { L"5", L"6", L"7", L"8", L"9", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23", L"24", L"25", L"26", L"27", L"28", L"29", L"30", L"31", L"32", L"33", L"34", L"35", L"36", L"37", L"38", L"39", L"40", L"41", L"42", L"43", L"44", L"45", L"46", L"47", L"48", L"49", L"50", L"51", L"52", L"53", L"54", L"55", L"56", L"57", L"58", L"59", L"60", L"61", L"62", L"63", L"64", L"65", L"66", L"67", L"68", L"69", L"70", L"71", L"72", L"73", L"74", L"75", L"76", L"77", L"78", L"79", L"80", L"81", L"82", L"83", L"84", L"85", L"86", L"87", L"88", L"89", L"90", L"91", L"92", L"93", L"94", L"95", L"96", L"97", L"98", L"99", L"100" };
  59. int iCrosshairSize = 0;
  60. bool bDropWeapon;
  61. int iPlayerRadius = 0;

  62. wchar_t userData[160];
  63. DWORD userDataSize = 160;

  64. #define Bone_Root                        0
  65. #define Bone_Hand_L                        3
  66. #define Bone_Hand_R                        4
  67. #define Bone_Foot_L                        6
  68. #define Bone_Foot_R                        7
  69. #define Bone_Pelvis                        9
  70. #define Bone_Spine                        10
  71. #define Bone_Spine1                        11
  72. #define Bone_Spine2                        12
  73. #define Bone_Neck                        13
  74. #define Bone_Head                        14
  75. #define Bone_Helmet                        15
  76. #define Bone_LClavicle                16
  77. #define Bone_LArmUp                        17
  78. #define Bone_LArmLow                18
  79. #define Bone_LHand                        19
  80. #define Bone_RClavicle                37
  81. #define Bone_RArmUp                        38
  82. #define Bone_RArmLow                39
  83. #define Bone_RHand                        40
  84. #define Bone_LLegUp                        58
  85. #define Bone_LLegLow                59
  86. #define Bone_LFoot                        60
  87. #define Bone_RLegUp                        62
  88. #define Bone_RLegLow                63
  89. #define Bone_RFoot                        64
複製代碼
PostRender.hpp
  1. #ifndef _POSTRENDER_HPP
  2. #define _POSTRENDER_HPP

  3. #include "MenuDefines.hpp"

  4. #define HACK_MAJOR_VERSION 1
  5. #define HACK_MINOR_VERSION 1

  6. using namespace std;

  7. HWND hSf2 = NULL;

  8. ASFPlayerController* PlayerController;

  9. FRotator SilentAimRot;

  10. bool Restored = false;
  11. bool Saved = false;
  12. bool Loaded = false;

  13. int iRandomNum = 14;
  14. bool bRandomNumChange = false;

  15. bool IsMyPawn = false;
  16. bool bBullet = false;

  17. bool bOPKKey = false;
  18. bool bRespawnKey = false;
  19. bool bHeroKey1 = false;
  20. bool bHeroKey2 = false;
  21. bool bRButton = false;
  22. bool bLButton = false;
  23. bool bShiftButton = false;
  24. bool bAltButton = false;

  25. float MouseX;
  26. float MouseY;

  27. int SlideBoxMin = 304;
  28. int SlideBoxMax = 454;

  29. #define MapColorValueA(health, inMax) (unsigned char)(255 - (((((health - inMax) * 100) / inMax) * 255) / 100))
  30. #define MapColorValueB(health, inMax) (unsigned char)((((health * 100) / inMax) * 255) / 100)
  31. #define MakeColor(R, G, B) { B, G, R, 255 }

  32. FColor Black MakeColor(0, 0, 0);
  33. FColor Gray MakeColor(110, 110, 110);
  34. FColor White MakeColor(255, 255, 255);
  35. FColor Red MakeColor(85, 85, 85);
  36. FColor Menu MakeColor(128, 196, 196);
  37. FColor Green MakeColor(0, 255, 0);
  38. FColor Blue MakeColor(0, 162, 232);
  39. FColor Orange MakeColor(255, 0, 0);
  40. FColor Yellow MakeColor(255, 255, 0);
  41. FColor Cyan MakeColor(128, 255, 255);

  42. enum BONE
  43. {
  44.         CHEST = 12, HEAD = 14,
  45.         LEFT_SHOULDER = 17, LEFT_ELBOW, LEFT_WRIST,
  46.         RIGHT_SHOULDER = 38, RIGHT_ELBOW, RIGHT_WRIST,
  47.         LEFT_HIP = 58, LEFT_KNEE, LEFT_ANKLE, LEFT_TOE,
  48.         RIGHT_HIP = 62, RIGHT_KNEE, RIGHT_ANKLE, RIGHT_TOE
  49. };

  50. UObject* GetInstanceOf(UClass* Class)
  51. {
  52.         static UObject* ObjectInstance;

  53.         ObjectInstance = NULL;

  54.         for (int i = 0; i < UObject::GObjObjects()->Count; ++i)
  55.         {
  56.                 UObject* CheckObject = (*UObject::GObjObjects())(i);

  57.                 if (CheckObject && CheckObject->IsA(Class))
  58.                 {
  59.                         if (!strstr(CheckObject->GetFullName(), "Default"))
  60.                                 ObjectInstance = CheckObject;
  61.                 }
  62.         }

  63.         return ObjectInstance;
  64. };

  65. FVector inline Vector_Sub(FVector v1, const FVector& v2)
  66. {
  67.         v1.X -= v2.X;
  68.         v1.Y -= v2.Y;
  69.         v1.Z -= v2.Z;

  70.         return v1;
  71. }

  72. FRotator inline Rotator_Sub(FRotator r1, const FRotator& r2)
  73. {
  74.         r1.Pitch -= r2.Pitch;
  75.         r1.Yaw -= r2.Yaw;
  76.         r1.Roll -= r2.Roll;

  77.         return r1;
  78. }

  79. FRotator inline Rotator_Sum(FRotator r1, const FRotator& r2)
  80. {
  81.         r1.Pitch += r2.Pitch;
  82.         r1.Yaw += r2.Yaw;
  83.         r1.Roll += r2.Roll;

  84.         return r1;
  85. }

  86. FRotator inline VectorToRotation(const FVector& vector)
  87. {
  88.         FRotator rotation;

  89.         rotation.Pitch = PlayerController->Atan2(vector.Z, PlayerController->Sqrt((vector.X * vector.X) + (vector.Y * vector.Y))) * CONST_RadToUnrRot;
  90.         rotation.Yaw = PlayerController->Atan2(vector.Y, vector.X) * CONST_RadToUnrRot;
  91.         rotation.Roll = 0;

  92.         return rotation;
  93. }

  94. FVector cameraLocation;
  95. FRotator cameraRotation;

  96. FVector WorldToScreen(UCanvas* canvas, const FVector& location)
  97. {
  98.         FVector output,
  99.                 axisX, axisY, axisZ, delta, transformed;

  100.         canvas->GetAxes(cameraRotation, &axisX, &axisY, &axisZ);

  101.         delta = PlayerController->Subtract_VectorVector(location, cameraLocation);

  102.         transformed.X = PlayerController->Dot_VectorVector(delta, axisY);
  103.         transformed.Y = PlayerController->Dot_VectorVector(delta, axisZ);
  104.         transformed.Z = PlayerController->Dot_VectorVector(delta, axisX);

  105.         if (transformed.Z < 1)
  106.                 transformed.Z = 1;

  107.         float FOVAngle = PlayerController->PlayerCamera->GetFOVAngle();

  108.         output.X = (canvas->ClipX / 2) + transformed.X * ((canvas->ClipX / 2) / PlayerController->Tan(FOVAngle * CONST_Pi / 360)) / transformed.Z;
  109.         output.Y = (canvas->ClipY / 2) + -transformed.Y * ((canvas->ClipX / 2) / PlayerController->Tan(FOVAngle * CONST_Pi / 360)) / transformed.Z;

  110.         return output;
  111. }

  112. void inline Draw2DLine(UCanvas* canvas, APawn* pawn, const FColor& color)
  113. {
  114.         FVector location = pawn->Location;
  115.         location = WorldToScreen(canvas, location);

  116.         canvas->Draw2DLine(canvas->ClipX / 2, canvas->ClipY, location.X, location.Y, color);
  117. }

  118. bool inline IsVisible(const FVector& end, APawn* pawn)
  119. {
  120.         FVector extent = { 0, 0, 0 };
  121.         FVector hitLocation;
  122.         FVector hitNormal;
  123.         FTraceHitInfo hitInfo;

  124.         AActor* actor = PlayerController->Trace(end, cameraLocation, true, extent, 0, &hitLocation, &hitNormal, &hitInfo);

  125.         return (pawn == actor);
  126. }

  127. bool IsTargetVisible(APawn* target)
  128. {
  129.         if (!target->Mesh)
  130.                 return false;

  131.         if (PlayerController->CanSee(target))
  132.                 return true;

  133.         FVector boneLocation;

  134.         char table[] = { 14, 19, 40, 61, 65 };

  135.         for (int i = 0; i < 5; i++)
  136.         {
  137.                 boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(table[i]), 0);

  138.                 if (IsVisible(boneLocation, target))
  139.                         return true;
  140.         }

  141.         return false;
  142. }

  143. bool inline IsSameTeam(APawn* pawn, APawn* target)
  144. {
  145.         return PlayerController->WorldInfo
  146.                 && PlayerController->WorldInfo->GRI
  147.                 && PlayerController->WorldInfo->GRI->OnSameTeam(pawn, target);
  148. }

  149. float inline Get3DDistance(AActor* pawn, AActor* target)
  150. {
  151.         return sqrt
  152.         (pow(target->Location.X - pawn->Location.X, 2)
  153.                 + pow(target->Location.Y - pawn->Location.Y, 2)
  154.                 + pow(target->Location.Z - pawn->Location.Z, 2));
  155. }

  156. FRotator inline LimitRotation(UCanvas* canvas, const FRotator& startRotation, const FRotator& endRotation)
  157. {
  158.         int realSmoothAim = 9999;

  159.         if (iSmoothAim == 1) realSmoothAim = 5;
  160.         else
  161.                 if (iSmoothAim == 2) realSmoothAim = 4;
  162.                 else
  163.                         if (iSmoothAim == 3) realSmoothAim = 3;
  164.                         else
  165.                                 if (iSmoothAim == 4) realSmoothAim = 2;
  166.                                 else
  167.                                         if (iSmoothAim == 5) realSmoothAim = 1;

  168.         int maxRotation = realSmoothAim * 100;

  169.         FRotator deltaRotation = canvas->Normalize(Rotator_Sub(endRotation, startRotation));

  170.         if (deltaRotation.Yaw > maxRotation) { deltaRotation.Yaw = maxRotation; }
  171.         else if (deltaRotation.Yaw < -maxRotation) { deltaRotation.Yaw = -maxRotation; }

  172.         if (deltaRotation.Pitch > maxRotation) { deltaRotation.Pitch = maxRotation; }
  173.         else if (deltaRotation.Pitch < -maxRotation) { deltaRotation.Pitch = -maxRotation; }

  174.         return Rotator_Sum(startRotation, deltaRotation);
  175. }

  176. bool IsInFOV(APawn* pawn, APawn* target)
  177. {
  178.         double dist;

  179.         int HP = iHPLimit * 25;
  180.         if (HP == 100) HP = 99;

  181.         if (target->bDeleteMe
  182.                 || target->Health < 1
  183.                 || IsSameTeam(pawn, target)
  184.                 || (!IsTargetVisible(target))
  185.                 || target->Health <= HP
  186.                 || target == pawn)
  187.                 return false;

  188.         float dist2 = Get3DDistance(pawn, target);

  189.         FRotator newRotation = VectorToRotation(Vector_Sub(target->Location, cameraLocation));
  190.         float fYaw = PlayerController->Rotation.Yaw - newRotation.Yaw;
  191.         if (fYaw < 0) fYaw = -fYaw;

  192.         fYaw = (fYaw / 182.0444f);

  193.         int HowMany = (int)fYaw;
  194.         int Inside = HowMany / 360;

  195.         if (Inside > 0) fYaw = (fYaw - (360 * Inside));

  196.         switch (iFovAngle)
  197.         {
  198.         case 0:
  199.                 if (fYaw <= 1) return true;
  200.                 else return false;

  201.                 break;
  202.         case 1:
  203.                 if (fYaw <= 2) return true;
  204.                 else return false;

  205.                 break;
  206.         case 2:
  207.                 if (fYaw <= 3) return true;
  208.                 else return false;

  209.                 break;
  210.         case 3:
  211.                 if (fYaw <= 5) return true;
  212.                 else return false;

  213.                 break;
  214.         case 4:
  215.                 if (fYaw <= 10) return true;
  216.                 else return false;

  217.                 break;
  218.         case 5:
  219.                 if (fYaw <= 25) return true;
  220.                 else return false;

  221.                 break;
  222.         case 6:
  223.                 if (fYaw <= 30) return true;
  224.                 else return false;

  225.                 break;
  226.         case 7:
  227.                 if (fYaw <= 45) return true;
  228.                 else return false;

  229.                 break;
  230.         default:
  231.                 return false;
  232.         }
  233. }

  234. void inline AutoAim(UCanvas* canvas, AWeapon* weapon, APawn* target)
  235. {
  236.         if (target->Health < 1 || !target->Mesh || target->bDeleteMe) return;
  237.         FVector boneLocation;

  238.         if (bRandomNumChange == true)
  239.         {
  240.                 iRandomNum = rand() % 61;
  241.                 bRandomNumChange = false;
  242.         }

  243.         if (iAimPosition == 0) boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(iRandomNum), 0);
  244.         else if (iAimPosition == 1) boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(HEAD), 0);
  245.         else if (iAimPosition == 2) boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(CHEST), 0);
  246.         else if (iAimPosition == 3) boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(RIGHT_WRIST), 0);

  247.         FRotator newRotation = VectorToRotation(Vector_Sub(boneLocation, cameraLocation));

  248.         FRotator OldRotation = PlayerController->Pawn->Rotation;

  249.         if (iSmoothAim > 0)
  250.                 newRotation = LimitRotation(canvas, cameraRotation, newRotation);

  251.         float bak1, bak2, bak3;

  252.         if ((ASFPawn_Player*)PlayerController->Pawn)
  253.         {
  254.                 bak1 = ((ASFPawn_Player*)PlayerController->Pawn)->RecoilResult.impactIncreaseEye;
  255.                 bak2 = ((ASFPawn_Player*)PlayerController->Pawn)->RecoilResult.impactSpinZ;
  256.                 bak3 = ((ASFPawn_Player*)PlayerController->Pawn)->RecoilResult.spinz;

  257.                 ((ASFPawn_Player*)PlayerController->Pawn)->RecoilResult.impactIncreaseEye = 0.0f;
  258.                 ((ASFPawn_Player*)PlayerController->Pawn)->RecoilResult.impactSpinZ = 0.0f;
  259.                 ((ASFPawn_Player*)PlayerController->Pawn)->RecoilResult.spinz = 0.0f;
  260.         }

  261.         PlayerController->Rotation = newRotation;
  262.         PlayerController->Pawn->Rotation = newRotation;
  263.         PlayerController->PlayerCamera->Rotation = newRotation;
  264.         PlayerController->Pawn->ClientSetRotation(newRotation);
  265.         PlayerController->rotInput = newRotation;

  266. }

  267. FRotator CalcSilentAimRot(APawn* target)
  268. {
  269.         if (target->Health < 1 || !target->Mesh || target->bDeleteMe) return { 0,0,0 };
  270.         FVector boneLocation;

  271.         if (bRandomNumChange == true)
  272.         {
  273.                 iRandomNum = rand() % 61;
  274.                 bRandomNumChange = false;
  275.         }

  276.         if (iAimPosition == 0) boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(iRandomNum), 0);
  277.         else if (iAimPosition == 1) boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(HEAD), 0);
  278.         else if (iAimPosition == 2) boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(CHEST), 0);
  279.         else if (iAimPosition == 3) boneLocation = target->Mesh->GetBoneLocation(target->Mesh->GetBoneName(RIGHT_WRIST), 0);

  280.         FRotator newRotation = VectorToRotation(Vector_Sub(boneLocation, cameraLocation));

  281.         return newRotation;
  282. }

  283. APawn* FindClosedTarget(APawn* pawn, APawn* target)
  284. {
  285.         APawn* result = NULL;

  286.         double dist;

  287.         int HP = iHPLimit * 25;
  288.         if (HP == 100) HP = 99;

  289.         while (target)
  290.         {
  291.                 if (target->bDeleteMe
  292.                         || target->Health < 1
  293.                         || !target->IsAliveAndWell()
  294.                         || IsSameTeam(pawn, target)
  295.                         || (!IsTargetVisible(target))
  296.                         || target->Health <= HP
  297.                         || target == pawn)
  298.                 {
  299.                         target = target->NextPawn;
  300.                         continue;
  301.                 }

  302.                 if (iAimBy == 1 && !IsInFOV(pawn, target))
  303.                 {
  304.                         target = target->NextPawn;
  305.                         continue;
  306.                 }

  307.                 float dist2 = Get3DDistance(pawn, target);

  308.                 if (!result || (dist2 < dist))
  309.                 {
  310.                         result = target;
  311.                         dist = dist2;
  312.                 }

  313.                 target = target->NextPawn;
  314.         }

  315.         return result;
  316. }

  317. APawn* FindLowestHP(APawn* pawn, APawn* target)
  318. {
  319.         APawn* result = NULL;

  320.         int hp1;

  321.         while (target)
  322.         {
  323.                 if (target->bDeleteMe
  324.                         || target->Health < 1
  325.                         || IsSameTeam(pawn, target)
  326.                         || !target->IsAliveAndWell()
  327.                         || (!IsTargetVisible(target))
  328.                         || target == pawn)
  329.                 {
  330.                         target = target->NextPawn;
  331.                         continue;
  332.                 }

  333.                 if (iAimBy != 2) return nullptr;

  334.                 int hp2 = target->Health;

  335.                 if (!result || (hp2 < hp1))
  336.                 {
  337.                         result = target;
  338.                         hp1 = hp2;
  339.                 }

  340.                 target = target->NextPawn;
  341.         }

  342.         return result;
  343. }

  344. void HeadCircle(APawn* target, UCanvas* pCanvas, int numSides, FColor Color)
  345. {
  346.         FVector hHead = target->Mesh->GetBoneLocationByIndex(14, 0);
  347.         hHead = WorldToScreen(pCanvas, hHead);

  348.         FVector HeadUp = target->Mesh->GetBoneLocationByIndex(14, 0);
  349.         HeadUp.Z += 14;
  350.         HeadUp = WorldToScreen(pCanvas, HeadUp);
  351.         FVector HeadLeft = target->Mesh->GetBoneLocationByIndex(14, 0);
  352.         HeadLeft.X += 14;
  353.         HeadLeft = WorldToScreen(pCanvas, HeadLeft);
  354.         FVector HeadRight = target->Mesh->GetBoneLocationByIndex(14, 0);
  355.         HeadRight.Y += 14;
  356.         HeadRight = WorldToScreen(pCanvas, HeadRight);

  357.         int X = hHead.X;
  358.         int Y = hHead.Y;

  359.         int radius = 0;

  360.         int up = (HeadUp.Y - hHead.Y);
  361.         int left = (X - HeadLeft.X);
  362.         int right = (X - HeadRight.X);

  363.         if (up < 0) up = -up;
  364.         if (left < 0) left = -left;
  365.         if (right < 0) right = -right;

  366.         if (up >= left && up >= right) radius = up;
  367.         else if (left >= up && left >= right) radius = left;
  368.         else if (right >= up && right >= up) radius = right;

  369.         if (radius < 0) radius = -radius;

  370.         float Step = CONST_Pi * 2.0 / numSides;
  371.         int Count = 0;
  372.         FVector2D V[128];
  373.         for (float a = 0; a < CONST_Pi * 2.0; a += Step) {
  374.                 float X1 = radius * cos(a) + X;
  375.                 float Y1 = radius * sin(a) + Y;
  376.                 float X2 = radius * cos(a + Step) + X;
  377.                 float Y2 = radius * sin(a + Step) + Y;
  378.                 V[Count].X = X1;
  379.                 V[Count].Y = Y1;
  380.                 V[Count + 1].X = X2;
  381.                 V[Count + 1].Y = Y2;
  382.                 pCanvas->Draw2DLine(V[Count].X, V[Count].Y, X2, Y2, Color);
  383.         }
  384. }

  385. void inline DrawHealthBar(UCanvas* canvas, APawn* pawn)
  386. {
  387.         FVector min, max, center;

  388.         FBox box;
  389.         pawn->GetComponentsBoundingBox(&box);

  390.         if (box.IsValid)
  391.         {
  392.                 min = box.Min;
  393.                 max = box.Max;

  394.                 float size = (70.0f / pawn->HealthMax) * pawn->Health;

  395.                 FColor color;

  396.                 if (pawn->Health > (pawn->HealthMax / 2))
  397.                 {
  398.                         color = MakeColor(MapColorValueA(pawn->Health, (pawn->HealthMax / 2)), 255, 0);
  399.                 }
  400.                 else
  401.                 {
  402.                         color = MakeColor(255, MapColorValueB(pawn->Health, (pawn->HealthMax / 2)), 0);
  403.                 }

  404.                 float W = max.X - min.X;
  405.                 float H = max.Y - min.Y;
  406.                 float D = max.Z - min.Z;

  407.                 center.X = max.X - (W / 2);
  408.                 center.Y = max.Y - (H / 2);
  409.                 center.Z = max.Z - (D + 8);
  410.                 center = WorldToScreen(canvas, center);

  411.                 center.Y += 7;

  412.                 canvas->Draw2DLine(center.X - 35 - 1, center.Y, ((center.X - 35) + size), center.Y, color);
  413.                 canvas->Draw2DLine(center.X - 35 - 1, center.Y - 1, ((center.X - 35) + size), center.Y - 1, color);
  414.                 canvas->Draw2DLine(center.X - 35 - 1, center.Y - 2, ((center.X - 35) + size), center.Y - 2, color);
  415.                 canvas->Draw2DLine(center.X - 35 - 1, center.Y - 3, ((center.X - 35) + size), center.Y - 3, color);

  416.                 canvas->Draw2DLine(center.X - 36, center.Y + 1, center.X + 36, center.Y + 1, Black);
  417.                 canvas->Draw2DLine(center.X - 36 - 1, center.Y - 4, center.X + 36, center.Y - 4, Black);
  418.                 canvas->Draw2DLine(center.X - 36, center.Y - 4, center.X - 36, center.Y + 1, Black);
  419.                 canvas->Draw2DLine(center.X + 36, center.Y - 4, center.X + 36, center.Y + 1, Black);
  420.         }
  421. }

  422. void DrawPlayerBones(UCanvas* pCanvas, APawn* Target, FColor Color)
  423. {
  424.         FVector vTopHead, vHead, vNeck, vPelvis, vLArmUp, vLArmLow, vLHand, vLLegUp, vLLegLow, vLFoot, vRArmUp, vRArmLow, vRHand, vRLegUp, vRLegLow, vRFoot;

  425.         vHead = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(14, 0));

  426.         vNeck = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_Neck, 0));
  427.         vPelvis = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_Pelvis, 0));

  428.         vLArmUp = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_LArmUp, 0));
  429.         vLArmLow = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_LArmLow, 0));
  430.         vLHand = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_LHand, 0));
  431.         vLLegUp = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_LLegUp, 0));
  432.         vLLegLow = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_LLegLow, 0));
  433.         vLFoot = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_LFoot, 0));

  434.         vRArmUp = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_RArmUp, 0));
  435.         vRArmLow = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_RArmLow, 0));
  436.         vRHand = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_RHand, 0));
  437.         vRLegUp = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_RLegUp, 0));
  438.         vRLegLow = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_RLegLow, 0));
  439.         vRFoot = WorldToScreen(pCanvas, Target->Mesh->GetBoneLocationByIndex(Bone_RFoot, 0));

  440.         pCanvas->Draw2DLine(vHead.X, vHead.Y, vNeck.X, vNeck.Y, Color);
  441.         pCanvas->Draw2DLine(vNeck.X, vNeck.Y, vPelvis.X, vPelvis.Y, Color);

  442.         pCanvas->Draw2DLine(vLArmUp.X, vLArmUp.Y, vNeck.X, vNeck.Y, Color);
  443.         pCanvas->Draw2DLine(vRArmUp.X, vRArmUp.Y, vNeck.X, vNeck.Y, Color);

  444.         pCanvas->Draw2DLine(vLLegUp.X, vLLegUp.Y, vPelvis.X, vPelvis.Y, Color);
  445.         pCanvas->Draw2DLine(vRLegUp.X, vRLegUp.Y, vPelvis.X, vPelvis.Y, Color);

  446.         pCanvas->Draw2DLine(vLArmUp.X, vLArmUp.Y, vLArmLow.X, vLArmLow.Y, Color);
  447.         pCanvas->Draw2DLine(vLArmLow.X, vLArmLow.Y, vLHand.X, vLHand.Y, Color);

  448.         pCanvas->Draw2DLine(vLLegUp.X, vLLegUp.Y, vLLegLow.X, vLLegLow.Y, Color);
  449.         pCanvas->Draw2DLine(vLLegLow.X, vLLegLow.Y, vLFoot.X, vLFoot.Y, Color);

  450.         pCanvas->Draw2DLine(vRArmUp.X, vRArmUp.Y, vRArmLow.X, vRArmLow.Y, Color);
  451.         pCanvas->Draw2DLine(vRArmLow.X, vRArmLow.Y, vRHand.X, vRHand.Y, Color);

  452.         pCanvas->Draw2DLine(vRLegUp.X, vRLegUp.Y, vRLegLow.X, vRLegLow.Y, Color);
  453.         pCanvas->Draw2DLine(vRLegLow.X, vRLegLow.Y, vRFoot.X, vRFoot.Y, Color);
  454. }

  455. void inline Draw3DBoundingBox(UCanvas* canvas, APawn* pawn, const FColor& color)
  456. {
  457.         if (pawn->Health < 1) return;

  458.         FVector min, max, vec1, vec2, vec3, vec4, vec5, vec6, vec7, vec8;

  459.         FBox box;
  460.         pawn->GetComponentsBoundingBox(&box);

  461.         if (box.IsValid)
  462.         {
  463.                 min = box.Min;
  464.                 max = box.Max;

  465.                 vec3 = min;
  466.                 vec3.X = max.X;
  467.                 vec4 = min;
  468.                 vec4.Y = max.Y;
  469.                 vec5 = min;
  470.                 vec5.Z = max.Z;
  471.                 vec6 = max;
  472.                 vec6.X = min.X;
  473.                 vec7 = max;
  474.                 vec7.Y = min.Y;
  475.                 vec8 = max;
  476.                 vec8.Z = min.Z;
  477.                 vec1 = WorldToScreen(canvas, min);
  478.                 vec2 = WorldToScreen(canvas, max);
  479.                 vec3 = WorldToScreen(canvas, vec3);
  480.                 vec4 = WorldToScreen(canvas, vec4);
  481.                 vec5 = WorldToScreen(canvas, vec5);
  482.                 vec6 = WorldToScreen(canvas, vec6);
  483.                 vec7 = WorldToScreen(canvas, vec7);
  484.                 vec8 = WorldToScreen(canvas, vec8);
  485.                 canvas->Draw2DLine(vec1.X, vec1.Y, vec5.X, vec5.Y, color);
  486.                 canvas->Draw2DLine(vec2.X, vec2.Y, vec8.X, vec8.Y, color);
  487.                 canvas->Draw2DLine(vec3.X, vec3.Y, vec7.X, vec7.Y, color);
  488.                 canvas->Draw2DLine(vec4.X, vec4.Y, vec6.X, vec6.Y, color);
  489.                 canvas->Draw2DLine(vec1.X, vec1.Y, vec3.X, vec3.Y, color);
  490.                 canvas->Draw2DLine(vec1.X, vec1.Y, vec4.X, vec4.Y, color);
  491.                 canvas->Draw2DLine(vec8.X, vec8.Y, vec3.X, vec3.Y, color);
  492.                 canvas->Draw2DLine(vec8.X, vec8.Y, vec4.X, vec4.Y, color);
  493.                 canvas->Draw2DLine(vec2.X, vec2.Y, vec6.X, vec6.Y, color);
  494.                 canvas->Draw2DLine(vec2.X, vec2.Y, vec7.X, vec7.Y, color);
  495.                 canvas->Draw2DLine(vec5.X, vec5.Y, vec6.X, vec6.Y, color);
  496.                 canvas->Draw2DLine(vec5.X, vec5.Y, vec7.X, vec7.Y, color);
  497.         }
  498. }

  499. void Draw2DBoundingBox(UCanvas* Canvas, APawn* Target, FColor color)
  500. {
  501.         if (Target->Health < 1) return;

  502.         FBox Box;
  503.         Target->GetComponentsBoundingBox(&Box);

  504.         FVector vpjMax = WorldToScreen(Canvas, Box.Max);
  505.         FVector vpjMin = WorldToScreen(Canvas, Box.Min);
  506.         FVector vpjCenter = WorldToScreen(Canvas, Target->Location);

  507.         float flWidth = fabs((vpjMax.Y - vpjMin.Y) / 4);

  508.         Canvas->Draw2DLine(vpjCenter.X - flWidth, vpjMin.Y, vpjCenter.X + flWidth, vpjMin.Y, color);
  509.         Canvas->Draw2DLine(vpjCenter.X - flWidth, vpjMax.Y, vpjCenter.X + flWidth, vpjMax.Y, color);
  510.         Canvas->Draw2DLine(vpjCenter.X - flWidth, vpjMin.Y, vpjCenter.X - flWidth, vpjMax.Y, color);
  511.         Canvas->Draw2DLine(vpjCenter.X + flWidth, vpjMax.Y, vpjCenter.X + flWidth, vpjMin.Y, color);
  512. }

  513. void inline DrawSnapLines(UCanvas* canvas, APawn* pawn, const FColor& color)
  514. {
  515.         FVector location = pawn->Location;
  516.         location = WorldToScreen(canvas, location);

  517.         canvas->Draw2DLine(canvas->ClipX / 2, canvas->ClipY, location.X, location.Y, color);
  518. }

  519. void inline ESP(UCanvas* canvas, APawn* pawn, APawn* target)
  520. {
  521.         if (target == NULL || pawn == NULL || target->Health < 1) return;

  522.         if (AlienZombie == false && (target->IsA(ASFPawn_Aliens::StaticClass())
  523.                 || target->IsA(ASFPawn_AlienPlayer::StaticClass())
  524.                 || target->IsA(ASFPawn_AI_Aliens_Base::StaticClass())
  525.                 || target->IsA(ASFZombieHideSeekPlayerController::StaticClass())
  526.                 || target->IsA(ASFAIController_ZombieHideSeek::StaticClass())
  527.                 || target->IsA(ASFPawnAI_ZombieHideSeekWalker::StaticClass())
  528.                 || target->IsA(ASFAIController_Zombie::StaticClass())
  529.                 || target->IsA(ASFAIController_ZombieMelee::StaticClass())
  530.                 || target->IsA(ASFAIController_ZombiePuker::StaticClass())
  531.                 || target->IsA(ASFPawnAI_Zombie::StaticClass())
  532.                 || target->IsA(ASFPawnAI_ZombiePunisher::StaticClass())
  533.                 || target->IsA(ASFPawnAI_ZombieWalker::StaticClass()))) return;

  534.         if (AlienZombie == true && (target->IsA(ASFPawn_Aliens::StaticClass())
  535.                 || target->IsA(ASFPawn_AlienPlayer::StaticClass())
  536.                 || target->IsA(ASFPawn_AI_Aliens_Base::StaticClass())
  537.                 || target->IsA(ASFZombieHideSeekPlayerController::StaticClass())
  538.                 || target->IsA(ASFAIController_ZombieHideSeek::StaticClass())
  539.                 || target->IsA(ASFPawnAI_ZombieHideSeekWalker::StaticClass())
  540.                 || target->IsA(ASFAIController_Zombie::StaticClass())
  541.                 || target->IsA(ASFAIController_ZombieMelee::StaticClass())
  542.                 || target->IsA(ASFAIController_ZombiePuker::StaticClass())
  543.                 || target->IsA(ASFPawnAI_Zombie::StaticClass())
  544.                 || target->IsA(ASFPawnAI_ZombiePunisher::StaticClass())
  545.                 || target->IsA(ASFPawnAI_ZombieWalker::StaticClass())))
  546.         {
  547.                 ASFPawn* sfTarget = (ASFPawn*)target;

  548.                 FColor color;

  549.                 if (sfTarget)
  550.                 {
  551.                         if (sfTarget->bIsSpawnProtection) color = Gray;
  552.                         else
  553.                         {
  554.                                 if (IsSameTeam(pawn, target))
  555.                                 {
  556.                                         if (IsTargetVisible(target))
  557.                                         {
  558.                                                 if (iTeamVis == 0) color = Blue;
  559.                                                 if (iTeamVis == 1) color = Green;
  560.                                                 if (iTeamVis == 2) color = Yellow;
  561.                                         }
  562.                                         else
  563.                                         {
  564.                                                 if (iTeamInv == 0) color = Blue;
  565.                                                 if (iTeamInv == 1) color = Green;
  566.                                                 if (iTeamInv == 2) color = Yellow;
  567.                                         }
  568.                                 }
  569.                                 else
  570.                                 {
  571.                                         if (IsTargetVisible(target))
  572.                                         {
  573.                                                 if (iEnemyVis == 0) color = Menu;
  574.                                                 if (iEnemyVis == 1) color = Orange;
  575.                                                 if (iEnemyVis == 2) color = Yellow;
  576.                                         }
  577.                                         else
  578.                                         {
  579.                                                 if (iEnemyInv == 0) color = Menu;
  580.                                                 if (iEnemyInv == 1) color = Orange;
  581.                                                 if (iEnemyInv == 2) color = Yellow;
  582.                                         }
  583.                                 }
  584.                         }
  585.                 }
  586.                 else color = Black;

  587.                 if (iEnableEsp == 0 && !IsSameTeam(pawn, target))
  588.                 {
  589.                         if (bHealthEsp) DrawHealthBar(canvas, target);
  590.                         if (iBoundingBox == 1) Draw3DBoundingBox(canvas, target, color);
  591.                         if (iBoundingBox == 2) Draw2DBoundingBox(canvas, target, color);
  592.                         if (bSnapLines) DrawSnapLines(canvas, target, color);
  593.                 }
  594.                 else if (iEnableEsp == 1 && IsSameTeam(pawn, target))
  595.                 {
  596.                         if (bHealthEsp) DrawHealthBar(canvas, target);
  597.                         if (iBoundingBox == 1) Draw3DBoundingBox(canvas, target, color);
  598.                         if (iBoundingBox == 2) Draw2DBoundingBox(canvas, target, color);
  599.                         if (bSnapLines) DrawSnapLines(canvas, target, color);
  600.                 }
  601.                 else if (iEnableEsp == 2)
  602.                 {
  603.                         if (bHealthEsp) DrawHealthBar(canvas, target);
  604.                         if (iBoundingBox == 1) Draw3DBoundingBox(canvas, target, color);
  605.                         if (iBoundingBox == 2) Draw2DBoundingBox(canvas, target, color);
  606.                         if (bSnapLines) DrawSnapLines(canvas, target, color);
  607.                 }
  608.         }
  609.         else
  610.         {
  611.                 ASFPawn* sfTarget = (ASFPawn*)target;

  612.                 FColor color;

  613.                 if (sfTarget)
  614.                 {
  615.                         if (sfTarget->bIsSpawnProtection) color = Gray;
  616.                         else
  617.                         {
  618.                                 if (IsSameTeam(pawn, target))
  619.                                 {
  620.                                         if (IsTargetVisible(target))
  621.                                         {
  622.                                                 if (iTeamVis == 0) color = Blue;
  623.                                                 if (iTeamVis == 1) color = Green;
  624.                                                 if (iTeamVis == 2) color = Yellow;
  625.                                         }
  626.                                         else
  627.                                         {
  628.                                                 if (iTeamInv == 0) color = Blue;
  629.                                                 if (iTeamInv == 1) color = Green;
  630.                                                 if (iTeamInv == 2) color = Yellow;
  631.                                         }
  632.                                 }
  633.                                 else
  634.                                 {
  635.                                         if (IsTargetVisible(target))
  636.                                         {
  637.                                                 if (iEnemyVis == 0) color = Menu;
  638.                                                 if (iEnemyVis == 1) color = Orange;
  639.                                                 if (iEnemyVis == 2) color = Yellow;
  640.                                         }
  641.                                         else
  642.                                         {
  643.                                                 if (iEnemyInv == 0) color = Menu;
  644.                                                 if (iEnemyInv == 1) color = Orange;
  645.                                                 if (iEnemyInv == 2) color = Yellow;
  646.                                         }
  647.                                 }
  648.                         }
  649.                 }
  650.                 else color = Black;

  651.                 if (iEnableEsp == 0 && !IsSameTeam(pawn, target))
  652.                 {
  653.                         if (bHealthEsp) DrawHealthBar(canvas, target);
  654.                         if (bBoneEsp) DrawPlayerBones(canvas, target, color);
  655.                         if (bHeadCircle) HeadCircle(target, canvas, 350, Cyan);
  656.                         if (iBoundingBox == 1) Draw3DBoundingBox(canvas, target, color);
  657.                         if (iBoundingBox == 2) Draw2DBoundingBox(canvas, target, color);
  658.                         if (bSnapLines) DrawSnapLines(canvas, target, color);
  659.                 }
  660.                 else if (iEnableEsp == 1 && IsSameTeam(pawn, target))
  661.                 {
  662.                         if (bHealthEsp) DrawHealthBar(canvas, target);
  663.                         if (bBoneEsp) DrawPlayerBones(canvas, target, color);
  664.                         if (bHeadCircle) HeadCircle(target, canvas, 350, Cyan);
  665.                         if (iBoundingBox == 1) Draw3DBoundingBox(canvas, target, color);
  666.                         if (iBoundingBox == 2) Draw2DBoundingBox(canvas, target, color);
  667.                         if (bSnapLines) DrawSnapLines(canvas, target, color);
  668.                 }
  669.                 else if (iEnableEsp == 2)
  670.                 {
  671.                         if (bHealthEsp) DrawHealthBar(canvas, target);
  672.                         if (bBoneEsp) DrawPlayerBones(canvas, target, color);
  673.                         if (bHeadCircle) HeadCircle(target, canvas, 350, Cyan);
  674.                         if (iBoundingBox == 1) Draw3DBoundingBox(canvas, target, color);
  675.                         if (iBoundingBox == 2) Draw2DBoundingBox(canvas, target, color);
  676.                         if (bSnapLines) DrawSnapLines(canvas, target, color);
  677.                 }
  678.         }
  679. }

  680. FVector2D WorldToRadar(FVector Location, INT RadarX, INT RadarY, int size)
  681. {
  682.         FVector2D Return;

  683.         FLOAT CosYaw = cos(URotationToRadians(cameraRotation.Yaw));
  684.         FLOAT SinYaw = sin(URotationToRadians(cameraRotation.Yaw));

  685.         FLOAT DeltaX = Location.X - cameraLocation.X;
  686.         FLOAT DeltaY = Location.Y - cameraLocation.Y;

  687.         FLOAT LocationX = (DeltaY * CosYaw - DeltaX * SinYaw) / (iPlayerRadius + 25);
  688.         FLOAT LocationY = (DeltaX * CosYaw + DeltaY * SinYaw) / (iPlayerRadius + 25);

  689.         if (LocationX > ((size / 2) - 5.0f) - 2.5f)
  690.                 LocationX = ((size / 2) - 5.0f) - 2.5f;
  691.         else if (LocationX < -(((size / 2) - 5.0f) - 2.5f))
  692.                 LocationX = -(((size / 2) - 5.0f) - 2.5f);

  693.         if (LocationY > ((size / 2) - 5.0f) - 2.5f)
  694.                 LocationY = ((size / 2) - 5.0f) - 2.5f;
  695.         else if (LocationY < -(((size / 2) - 5.0f) - 2.5f))
  696.                 LocationY = -(((size / 2) - 5.0f) - 2.5f);

  697.         Return.X = LocationX + RadarX;
  698.         Return.Y = -LocationY + RadarY;

  699.         return Return;
  700. }

  701. void inline Crosshair(UCanvas* canvas)
  702. {
  703.         {
  704.                 canvas->Draw2DLine(((canvas->ClipX / 2) - (iCrosshairSize + 6)), canvas->ClipY / 2, ((canvas->ClipX / 2) + (iCrosshairSize + 6)), canvas->ClipY / 2, Black);
  705.                 canvas->Draw2DLine(((canvas->ClipX / 2) - (iCrosshairSize + 6)), canvas->ClipY / 2 - 1, ((canvas->ClipX / 2) + (iCrosshairSize + 6)), canvas->ClipY / 2 - 1, Black);
  706.                 canvas->Draw2DLine(((canvas->ClipX / 2) - (iCrosshairSize + 6)), canvas->ClipY / 2 + 1, ((canvas->ClipX / 2) + (iCrosshairSize + 6)), canvas->ClipY / 2 + 1, Black);

  707.                 canvas->Draw2DLine(canvas->ClipX / 2, ((canvas->ClipY / 2) - (iCrosshairSize + 6)), canvas->ClipX / 2, ((canvas->ClipY / 2) + (iCrosshairSize + 6)), Black);
  708.                 canvas->Draw2DLine(canvas->ClipX / 2 - 1, ((canvas->ClipY / 2) - (iCrosshairSize + 6)), canvas->ClipX / 2 - 1, ((canvas->ClipY / 2) + (iCrosshairSize + 6)), Black);
  709.                 canvas->Draw2DLine(canvas->ClipX / 2 + 1, ((canvas->ClipY / 2) - (iCrosshairSize + 6)), canvas->ClipX / 2 + 1, ((canvas->ClipY / 2) + (iCrosshairSize + 6)), Black);
  710.         }
  711.         canvas->Draw2DLine(((canvas->ClipX / 2) - (iCrosshairSize + 5)), canvas->ClipY / 2, ((canvas->ClipX / 2) + (iCrosshairSize + 5)), canvas->ClipY / 2, Cyan); // -
  712.         canvas->Draw2DLine(canvas->ClipX / 2, ((canvas->ClipY / 2) - (iCrosshairSize + 5)), canvas->ClipX / 2, ((canvas->ClipY / 2) + (iCrosshairSize + 5)), Cyan); // |
  713. }

  714. bool bFirstLoad = true;

  715. void PostRender(UCanvas* canvas)
  716. {
  717.         if (FindWindowA(NULL, "TeamViewer")
  718.                 || FindWindowA(NULL, "AnyDesk"))
  719.         {
  720.                 return;
  721.         }
  722.        
  723.         if (!canvas) return;

  724.         if (bHWNDtaken == false)
  725.         {
  726.                 hwnd = FindWindowA("LaunchUnrealUwindowsClient", "SF2");
  727.                 bHWNDtaken = true;
  728.         }

  729.         canvas->CurZ = 1.0f;

  730.         {
  731.                 CurrentTickBone = clock() * 0.001f;
  732.                 Bone++;
  733.                 if ((CurrentTickBone - LastTickBone) > (float)((iBoneRefreshTime * 20) / 1000))
  734.                 {
  735.                         LastTickBone = CurrentTickBone;
  736.                         bBoneRefreshed = true;
  737.                         Bone = 0;
  738.                 }
  739.         }

  740.         APawn* pawn;

  741.         if (!PlayerController
  742.                 || !PlayerController->PlayerCamera)
  743.         {
  744.                 if (iCrosshair == 1) Crosshair(canvas);
  745.                 return;
  746.         }

  747.         if (PlayerController->Pawn && PlayerController->Pawn->Health > 0)
  748.         {
  749.                 pawn = PlayerController->Pawn;
  750.                 IsMyPawn = true;
  751.         }
  752.         else if (!(PlayerController->Pawn) && PlayerController->ViewTarget != NULL && PlayerController->ViewTarget && PlayerController->ViewTarget->IsA(APawn::StaticClass()))
  753.         {
  754.                 pawn = ((APawn*)PlayerController->ViewTarget);
  755.                 IsMyPawn = false;
  756.         }
  757.         else
  758.         {
  759.                 if (iCrosshair == 1) Crosshair(canvas);
  760.                 return;
  761.         }

  762.         cameraLocation = PlayerController->PlayerCamera->Location;
  763.         cameraRotation = PlayerController->PlayerCamera->Rotation;

  764.         ASFPawn* sfpawn = (ASFPawn*)pawn;

  765.         if (PlayerController->WorldInfo && PlayerController->WorldInfo->PawnList)
  766.         {
  767.                 APawn* target = PlayerController->WorldInfo->PawnList;
  768.                 APawn* closedTarget = FindClosedTarget(pawn, target);
  769.                 APawn* lowestTargetHP = FindLowestHP(pawn, target);

  770.                 while (target)
  771.                 {
  772.                         if (target != pawn
  773.                                 && !target->bDeleteMe)
  774.                         {
  775.                                 if (target
  776.                                         && target->Health > 0
  777.                                         && target->Weapon
  778.                                         && target->Weapon->IsA(ASFWeap_Bullet::StaticClass()))
  779.                                 {
  780.                                         target->Weapon->bDropOnDeath = bDropWeapon;
  781.                                 }

  782.                                 if (bDeadVisible && IsMyPawn == false) ESP(canvas, pawn, target);
  783.                                 else if (IsMyPawn == true) ESP(canvas, pawn, target);

  784.                                 if (target->Health > 0 && target->IsAliveAndWell() && target->Mesh && bBoneRefreshed)
  785.                                 {
  786.                                         target->Mesh->ForceSkelUpdate();
  787.                                         target->Mesh->UpdateAnimations();
  788.                                         target->Mesh->UpdateParentBoneMap();
  789.                                 }
  790.                         }

  791.                         target = target->NextPawn;
  792.                 }

  793.                 if (IsMyPawn == true)
  794.                 {
  795.                         if (bSilentAim)
  796.                         {
  797.                                 if (iAimBy == 2)
  798.                                 {
  799.                                         if (lowestTargetHP)
  800.                                         {
  801.                                                 if (iAimKey == 0 && bRButton)
  802.                                                 {
  803.                                                         Enemy = true;
  804.                                                         SilentAimRot = CalcSilentAimRot(lowestTargetHP);
  805.                                                 }
  806.                                                 else if (iAimKey == 1 && bLButton)
  807.                                                 {
  808.                                                         Enemy = true;
  809.                                                         SilentAimRot = CalcSilentAimRot(lowestTargetHP);
  810.                                                 }
  811.                                                 else if (iAimKey == 2 && bShiftButton)
  812.                                                 {
  813.                                                         Enemy = true;
  814.                                                         SilentAimRot = CalcSilentAimRot(lowestTargetHP);
  815.                                                 }
  816.                                                 else if (iAimKey == 3 && bAltButton)
  817.                                                 {
  818.                                                         Enemy = true;
  819.                                                         SilentAimRot = CalcSilentAimRot(lowestTargetHP);
  820.                                                 }
  821.                                                 else if (iAimKey == 4)
  822.                                                 {
  823.                                                         Enemy = true;
  824.                                                         SilentAimRot = CalcSilentAimRot(lowestTargetHP);
  825.                                                 }
  826.                                                 else Enemy = false;
  827.                                         }
  828.                                         else Enemy = false;
  829.                                 }
  830.                                 else
  831.                                 {
  832.                                         if (closedTarget)
  833.                                         {
  834.                                                 if (iAimKey == 0 && bRButton)
  835.                                                 {
  836.                                                         Enemy = true;
  837.                                                         SilentAimRot = CalcSilentAimRot(closedTarget);
  838.                                                 }
  839.                                                 else if (iAimKey == 1 && bLButton)
  840.                                                 {
  841.                                                         Enemy = true;
  842.                                                         SilentAimRot = CalcSilentAimRot(closedTarget);
  843.                                                 }
  844.                                                 else if (iAimKey == 2 && bShiftButton)
  845.                                                 {
  846.                                                         Enemy = true;
  847.                                                         SilentAimRot = CalcSilentAimRot(closedTarget);
  848.                                                 }
  849.                                                 else if (iAimKey == 3 && bAltButton)
  850.                                                 {
  851.                                                         Enemy = true;
  852.                                                         SilentAimRot = CalcSilentAimRot(closedTarget);
  853.                                                 }
  854.                                                 else if (iAimKey == 4)
  855.                                                 {
  856.                                                         Enemy = true;
  857.                                                         SilentAimRot = CalcSilentAimRot(closedTarget);
  858.                                                 }
  859.                                                 else Enemy = false;
  860.                                         }
  861.                                         else Enemy = false;
  862.                                 }
  863.                         }
  864.                         else Enemy = false;

  865.                         if (pawn->Weapon)
  866.                         {
  867.                                 AWeapon* weapon = (AWeapon*)pawn->Weapon;

  868.                                 if (bEnableAim)
  869.                                 {
  870.                                         if (iAimBy == 2)
  871.                                         {
  872.                                                 if (lowestTargetHP)
  873.                                                 {
  874.                                                         if (iAimKey == 0 && bRButton)
  875.                                                         {
  876.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  877.                                                                 AutoAim(canvas, weapon, lowestTargetHP);
  878.                                                         }
  879.                                                         else if (iAimKey == 1 && bLButton)
  880.                                                         {
  881.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  882.                                                                 AutoAim(canvas, weapon, lowestTargetHP);
  883.                                                         }
  884.                                                         else if (iAimKey == 2 && bShiftButton)
  885.                                                         {
  886.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  887.                                                                 AutoAim(canvas, weapon, lowestTargetHP);
  888.                                                         }
  889.                                                         else if (iAimKey == 3 && bAltButton)
  890.                                                         {
  891.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  892.                                                                 AutoAim(canvas, weapon, lowestTargetHP);
  893.                                                         }
  894.                                                         else if (iAimKey == 4)
  895.                                                         {
  896.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  897.                                                                 AutoAim(canvas, weapon, lowestTargetHP);
  898.                                                         }
  899.                                                         else
  900.                                                                 PlayerController->bIgnoreLookInput = false;
  901.                                                 }
  902.                                                 else
  903.                                                         PlayerController->bIgnoreLookInput = false;
  904.                                         }
  905.                                         else
  906.                                         {
  907.                                                 if (closedTarget)
  908.                                                 {
  909.                                                         if (iAimKey == 0 && bRButton)
  910.                                                         {
  911.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  912.                                                                 AutoAim(canvas, weapon, closedTarget);
  913.                                                         }
  914.                                                         else if (iAimKey == 1 && bLButton)
  915.                                                         {
  916.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  917.                                                                 AutoAim(canvas, weapon, closedTarget);
  918.                                                         }
  919.                                                         else if (iAimKey == 2 && bShiftButton)
  920.                                                         {
  921.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  922.                                                                 AutoAim(canvas, weapon, closedTarget);
  923.                                                         }
  924.                                                         else if (iAimKey == 3 && bAltButton)
  925.                                                         {
  926.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  927.                                                                 AutoAim(canvas, weapon, closedTarget);
  928.                                                         }
  929.                                                         else if (iAimKey == 4)
  930.                                                         {
  931.                                                                 if (bHardLock) PlayerController->bIgnoreLookInput = true;
  932.                                                                 AutoAim(canvas, weapon, closedTarget);
  933.                                                         }
  934.                                                         else
  935.                                                                 PlayerController->bIgnoreLookInput = false;
  936.                                                 }
  937.                                                 else
  938.                                                         PlayerController->bIgnoreLookInput = false;
  939.                                         }
  940.                                 }
  941.                         }
  942.                 }
  943.         }

  944.         if (iCrosshair == 1) Crosshair(canvas);

  945. }

  946. #endif
複製代碼
SpecialForce2.cpp
  1. #include <Windows.h>
  2. #include <String.h>
  3. #include <iOStream>
  4. #include "SpecialForce2.hpp"

  5. UObject* pGlobalObject;
  6. UFunction* pGlobalFunction;
  7. void* pGlobalParms;
  8. void* pGlobalResult;

  9. char *szName;

  10. bool bSilentAimStarted = false;
  11. bool bWhenNotVisible = false;

  12. #define IS_FUNCTION(c, oo, o, n) (pGlobalFunction->Class->Name.Index == c && pGlobalFunction->Outer->Outer->Name.Index == oo && pGlobalFunction->Outer->Name.Index == o && pGlobalFunction->Name.Index == n)

  13. void __fastcall hkProcessEvent(UObject *pObject, void *edx, UFunction *pFunction, void *pParms, void *pResult)
  14. {
  15.                 szName = pFunction->GetFullName();

  16.                 pGlobalFunction = pFunction;

  17.                 #pragma region PostRender
  18.                 if (!strcmp(szName, "Function Engine.GameViewportClient.PostRender"))
  19.                 {
  20.                         if (pParms)
  21.                                 PostRender((((UGameViewportClient_eventPostRender_Parms*)(pParms))->Canvas));
  22.                 }
  23.                 #pragma endregion

  24.                 #pragma region PlayerTick
  25.                 if (!strcmp(pFunction->Name.GetName(), "PlayerTick"))
  26.                 {
  27.                         PlayerController = reinterpret_cast<ASFPlayerController*>(pObject);
  28.                 }
  29.                 #pragma endregion

  30.                 #pragma region PlayerDestroyed

  31.                 if (!strcmp(szName, "Function Engine.PlayerController.Destroyed")
  32.                         || !strcmp(szName, "Function Engine.Controller.Destroyed")
  33.                         || !strcmp(szName, "Function SFGame.SFPlayerController.Destroyed"))
  34.                 {
  35.                         if (pObject == PlayerController) {
  36.                                 PlayerController = nullptr;
  37.                         }
  38.                 }
  39.                 #pragma endregion
  40.        
  41.                 ProcessEvent(pObject, pFunction, pParms, pResult);
  42. }

  43. WNDPROC oWndProc = NULL;

  44. LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
  45. {
  46.         return CallWindowProc(oWndProc, hWnd, Msg, wParam, lParam);
  47. }

  48. typedef LONG(WINAPI *SetWindowLong_t)(HWND hWnd, int nIndex, LONG dwNewLong);

  49. SetWindowLong_t oSetWindowLongW = NULL;

  50. LONG WINAPI hkSetWindowLongW(HWND hWnd, int nIndex, LONG dwNewLong)
  51. {
  52.         switch (nIndex)
  53.         {
  54.         case DWL_DLGPROC:
  55.                 oWndProc = HookLib::SetWndProc(hSf2, WndProc);

  56.                 break;

  57.         case GWL_WNDPROC:
  58.                 oWndProc = (WNDPROC)dwNewLong;

  59.                 return oSetWindowLongW(hWnd, nIndex, (LONG)WndProc);
  60.         }

  61.         return oSetWindowLongW(hWnd, nIndex, dwNewLong);
  62. }

  63. LPVOID VMTHook(TArray< UObject* >* GObjObjects, char* ObjectName, int index)
  64. {
  65.         DWORD* vtable = NULL;
  66.         for (DWORD i = 0x0; i < GObjObjects->Num(); i++)
  67.         {
  68.                 if (!GObjObjects->Data[i]) { continue; }
  69.                 if (!strcmp(GObjObjects->Data[i]->GetFullName(), ObjectName))
  70.                         vtable = (DWORD*) * (DWORD*)GObjObjects->Data[i];
  71.         }

  72.         if (!vtable) return NULL;

  73.         uintptr_t dwVTable = *((uintptr_t*)vtable);
  74.         uintptr_t* dwEntry = ((uintptr_t*)vtable + index);
  75.         uintptr_t dwOrig = *((uintptr_t*)dwEntry);

  76.         DWORD dwOldProtection;
  77.         VirtualProtect((LPVOID)dwEntry, sizeof(dwEntry), PAGE_EXECUTE_READWRITE, &dwOldProtection);
  78.         *((uintptr_t*)dwEntry) = (uintptr_t)hkProcessEvent;
  79.         VirtualProtect((LPVOID)dwEntry, sizeof(dwEntry), dwOldProtection, &dwOldProtection);

  80.         return (LPVOID)dwOrig;
  81. }

  82. void DumpNames(TArray< UObject* >* GObjObjects)
  83. {
  84.         FILE* fp = fopen("Dump.txt", "w+");
  85.         for (DWORD i = 0x0; i < GObjObjects->Num(); i++)
  86.         {
  87.                 if (!GObjObjects->Data[i]) { continue; }
  88.                 fprintf(fp, "%s\n", GObjObjects->Data[i]->GetFullName());
  89.         }

  90.         fclose(fp);
  91. }

  92. void OnAttach()
  93. {
  94.         srand(time(0));

  95.         Sleep(500);
  96.         HANDLE hToken;
  97.         OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken);
  98.         GetUserProfileDirectoryW(hToken, userData, &userDataSize);
  99.         Sleep(500);

  100.         CloseHandle(hToken);

  101.         do
  102.         {
  103.                 Sleep(1000);

  104.                 hSf2 = HookLib::GetCurrentProcessWindow("LaunchUnrealUWindowsClient", "SF2");
  105.         } while (!hSf2);

  106.         oSetWindowLongW = SetWindowLongW;

  107.         TArray< UObject* >* GObjObjects = (TArray< UObject* >*) GObjects;

  108.         while (GObjObjects->Count < 178000)
  109.         {
  110.                 Sleep(500);
  111.         }

  112.         ProcessEvent = (tProcessEvent)VMTHook(GObjObjects, "SFGameViewportClient SFGame.Default__SFGameViewportClient", ProcessEvent_Index);
  113.         VMTHook(GObjObjects, "GameViewportClient Engine.Default__GameViewportClient", ProcessEvent_Index);
  114.         VMTHook(GObjObjects, "SFPlayerController SFGame.Default__SFPlayerController", ProcessEvent_Index);
  115.         VMTHook(GObjObjects, "Controller Engine.Default__Controller", ProcessEvent_Index);
  116.         VMTHook(GObjObjects, "PlayerController Engine.Default__PlayerController", ProcessEvent_Index);
  117.         VMTHook(GObjObjects, "SFPawn SFGame.Default__SFPawn", ProcessEvent_Index);
  118.         VMTHook(GObjObjects, "Pawn Engine.Default__Pawn", ProcessEvent_Index);
  119.         VMTHook(GObjObjects, "SFPawn_Player SFGame.Default__SFPawn_Player", ProcessEvent_Index);
  120.         VMTHook(GObjObjects, "SFWeapon SFGame.Default__SFWeapon", ProcessEvent_Index);
  121.         VMTHook(GObjObjects, "SFWeap_InstantHit SFGame.Default__SFWeap_InstantHit", ProcessEvent_Index);
  122.         VMTHook(GObjObjects, "SFWeap_Bullet SFGame.Default__SFWeap_Bullet", ProcessEvent_Index);

  123.         DetourTransactionBegin();
  124.         DetourUpdateThread(GetCurrentThread());
  125.         DetourAttach(&(PVOID&)oSetWindowLongW, hkSetWindowLongW);
  126.         DetourTransactionCommit();
  127.        
  128. }

  129. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved)
  130. {
  131.         switch (dwReason)
  132.         {
  133.         case DLL_PROCESS_ATTACH:
  134.                 DisableThreadLibraryCalls(hInstance);
  135.                 CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)OnAttach, NULL, NULL, NULL);
  136.         }
  137.         return TRUE;
  138. }

複製代碼
SpecialForce2.hpp
  1. #ifndef _SPECIALFORCE2_HPP
  2. #define _SPECIALFORCE2_HPP

  3. #define _CRT_NON_CONFORMING_SWPRINTFS

  4. #include <windows.h>
  5. #include <iostream>
  6. #include <fstream>
  7. #include "detours.h"
  8. #include <vector>
  9. #include <time.h>
  10. #include <ctime>
  11. #include <iphlpapi.h>
  12. #include <iomanip>
  13. #include <Lmcons.h>
  14. #include <Psapi.h>
  15. #include <TlHelp32.h>
  16. #include <shlobj.h>
  17. #include <UserEnv.h>
  18. #include <Lmcons.h>
  19. #include <string>
  20. #include <sstream>
  21. #include <algorithm>
  22. #include <stdexcept>
  23. #include <sys/stat.h>
  24. #include <time.h>
  25. #include <mutex>

  26. #pragma comment(lib, "shell32.lib")
  27. #pragma comment(lib, "IPHLPAPI.lib")
  28. #pragma comment(lib, "detours.lib")
  29. #pragma comment(lib, "User32.lib")
  30. #pragma comment(lib, "UserEnv.lib")
  31. #pragma comment(lib, "Kernel32.lib")

  32. bool Enemy = false;

  33. #include "SDK/SDK.h"

  34. #include "HookLib.hpp"

  35. #include "PostRender.hpp"

  36. #endif
複製代碼
程式碼絕對可用,你只需要做到 引用or自己寫一個HookLib
收藏收藏0 推0 噓0


把本文推薦給朋友或其他網站上,每次被點擊增加您在本站積分: 1骰子
傻d一灬伙
複製連結並發給好友,以賺取推廣點數
簡單兩步驟,註冊、分享網址,即可獲得獎勵! 一起推廣文章換商品、賺$$

0

主題

0

好友

0

積分

新手上路

Rank: 1

UID
340817
帖子
1
主題
0
精華
0
積分
0
楓幣
1
威望
0
存款
0
贊助金額
0
推廣
0
GP
0
閱讀權限
10
性別
保密
在線時間
1 小時
註冊時間
2022-4-19
最後登入
2022-4-27
2
發表於 2022-4-19 19:22:55 |只看該作者
可以回復我的私訊嗎,有問題想向你請教!
點評回覆

使用道具 舉報

高級模式
B Color Image Link Quote Code Smilies |上傳

廣告刊登意見回饋關於我們職位招聘本站規範DMCA隱私權政策

Copyright © 2011-2024 冰楓論壇, All rights reserved

免責聲明:本網站是以即時上載留言的方式運作,本站對所有留言的真實性、完整性及立場等,不負任何法律責任。

而一切留言之言論只代表留言者個人意見,並非本網站之立場,用戶不應信賴內容,並應自行判斷內容之真實性。

小黑屋|手機版|冰楓論壇

GMT+8, 2024-4-28 17:23

回頂部