Skip to content

Commit 34c1c2e

Browse files
authored
Create Aim_Find_Best_Target.cpp
1 parent 442c138 commit 34c1c2e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

examples/Aim_Find_Best_Target.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
int AimFindBestTarget(){
2+
float targetDistance = 9999.0;
3+
4+
int bestPlayerIndex = -1;
5+
6+
for(int i = 0; i < MAX_PLAYERS; i++){
7+
if(g_pEsp->Players[i].health > 0 && !g_pEsp->Players[i].isAlly && g_pEsp->Players[i].inList && g_pEsp->Players[i].isInScreen){
8+
g_pEsp->Players[i].ReadCoordOrigin();
9+
if(g_pEsp->Players[i].distanceCross < 30.f && g_pEsp->Players[i].distanceCross > 0.0f){
10+
if(g_pEsp->Players[i].distanceCross < targetDistance){
11+
bestPlayerIndex = i;
12+
targetDistance = g_pEsp->Players[i].distanceCross;
13+
}
14+
}
15+
}
16+
}
17+
return bestPlayerIndex;
18+
}

0 commit comments

Comments
 (0)