This is the Ballhack-Code from my newest Hyprid-Hook Project Enigma.
You need a Basehook with EngFuncs. In this tutorial i used Panzers Base Hook 1.20 with the newest offsets.
First you will need some Variables:
Code:
float me[3]; // Variable storring your Coordinates
You need to find out your Player Coordinates
In glTranlatef:
Code:
if((x != 0.0f) && (y != 0.0f) && (z != 0.0f)) // If not 0 you get the player cooridantes
{
me[0] = -x; //Get Player X
me[1] = -y; //Get Player Y
me[2] = -z; //Get Player Z
This Code put at the beginning:
Code:
bool isValidEnt(cl_entity_s *ent)
{
if(ent && (ent != pEngfuncs->GetLocalPlayer()) && !(ent->curstate.effects & EF_NODRAW) && ent->player && !ent->curstate.spectator && ent->curstate.solid && !(ent->curstate.messagenum < pEngfuncs->GetLocalPlayer()->curstate.messagenum)) // Check if Entry ist a Player and if he is alive
{
return true; //YES
}
else
{
return false; //NO
}
}
Next well need some Functions for the ESP
Function to recognize if a model is a counter or a terrorist:
Code:
int GetTeamByModel(char *mdl)
{
if( strstr(mdl,"leet")||
strstr(mdl,"terror") ||
strstr(mdl,"arctic") ||
strstr(mdl,"guerilla") )
{
return 0;
}
if( strstr(mdl,"gign") ||
strstr(mdl,"gsg9") ||
strstr(mdl,"sas") ||
strstr(mdl,"urban") ||
strstr(mdl,"vip") )
{
return 1;
}
return -1;
}
Distance Formula between you and an other Player:
Code:
int GetDistance(float *pos)
{
float a,b,c;
a = pos[0] - me[0]; //Distance between the x Coordinate auf me and of another Player
b = pos[1] - me[1]; //Distance between the y Coordinate auf me and of another Player
c = pos[2] - me[2]; //Distance between the z Coordinate auf me and of another Player
return sqrt(a*a + b*b + c*c); // Full Distance
}
Function that draw your Ballhack:
Code:
inline void drawBall( int x, int y, int r, int g, int b, int alpha, int radius=1) {
int boxradius = (30.0*9.0) / radius; // Correct the Size of the Ball that it is nearly as big as a Models head
gEngfuncs.pfnFillRGBA(x-(boxradius/2), y-(600/radius), boxradius, boxradius,r,g,b,alpha);//Draw the Ball
}
Okay next well need h1webs ESP function ( *modified*)
Code:
static void PlayerEsp()
{
float drawhere[2]; // Storring the X and Y Coordinates on where the ball will be drawn
int dist; // Distance between you and your target
int espr,espg,espb; // Variables for storring the balls color
espr = 255;
espg = 0;
espb = 0;
cl_entity_t *ent, *pLocal = pEngfuncs->GetLocalPlayer(); // Get the Information of the entity struct of the local player
hud_player_info_t pinfo;
for(int i = 0; i < 33; i++) // Loop for all player that cold be connected on the server
{
if(i == pLocal->index) continue; // Check if a Player with this id is connected
cl_entity_s *ent = pEngfuncs->GetEntityByIndex(i); //Get the coordinates of him
pEngfuncs->pfnGetPlayerInfo(i, &pinfo); //store the coordinates in pinfo
dist = GetDistance(ent->origin)/ 22.0f; // Calculate the distance between you and every other player
if(ent != NULL && isValidEnt(ent)/*Credits to tabris*/) // Check if Ent is a Player and if he is alive
{
if(CalcScreen(ent->origin,drawhere)) // Calculate the Screencoordinate from the World Coordinates of ever Player
float drawhere[2];
CalcScreen(ent->origin, drawhere); // Dont know why h1web Calculate the screen more then 1 time but it works
CalcScreen(ent->origin, drawhere);// Dont know why h1web Calculate the screen more then 1 time but it works
if ( GetTeamByModel(pinfo.model) == 0 ) { // Check if Player ist Terrorist
espr = 255;
espg = 0; // Set color RED
espb = 0;
}
if ( GetTeamByModel(pinfo.model) == 1 ) { // Check if Player is Counter
espr = 0;
espg = 0; // Set color BLUE
espb = 255;
}
drawBall(drawhere[0],drawhere[1],espr,espg,espb,255,dist); //Draw Ball
}
}
}
}
At last we´ll call the PlayerEsp() Function in DrawOnHud or in every 5th glViewport
Hope you have fun with your Ballhack
![Grin](file:///E:/Upan/tutus/Game%20Deception%20-%20Forums%20-%20Tutorial%20Ballhack.........get%20model%20stuff_files/grin.gif)
Plz dont copy this tutorial anyware just link to it on this page.
If you use this Code in your Hack Credit to Panzer, Patrick, h1web, tabris and me.
edit : Added Comments
![Grin](file:///E:/Upan/tutus/Game%20Deception%20-%20Forums%20-%20Tutorial%20Ballhack.........get%20model%20stuff_files/grin.gif)
- Hope that De-Sire could understand this Code now
![Cool(2)](file:///E:/Upan/tutus/Game%20Deception%20-%20Forums%20-%20Tutorial%20Ballhack.........get%20model%20stuff_files/cool(2).gif)