[RELEASE] Useful Functions

Posts 1–15 of 189 · Page 1 of 13
[RELEASE] Useful Functions
Heyya.

I have put together some Useful Hack Functions.
Credits to Misc people, but mostly to UC.

I did make the crosshair function.

Mabye this could get stickied?
If anybody wants to add a function, leave me a PM and ill add it in.

Before we start, Make sure you have this in your globals:
[php]
LPD3DXFONT pFont;
LPDIRECT3DDEVICE9 pDevice;
[/php]

Draw Text:

After Globals:
[php]
void PrintText(LPD3DXFONT Font, long x, long y, D3DCOLOR fontColor, char *text, ...)//Draw Text Function
{
RECT rct;
rct.left = x - 1;
rct.right = x + 1;
rct.top = y - 1 ;
rct.bottom = y + 1;

if(!text) { return; }
va_list va_alist;
char logbuf[256] = {0};
va_start (va_alist, text);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), text, va_alist);
va_end (va_alist);
RECT FontRect = { x, y, x, y };
pFont->DrawText(NULL, logbuf, -1, &rct, DT_NOCLIP, fontColor);
}
[/php]

And to use the function (In Endscene):
[php]
PrintText(pFont, X, Y, D3DCOLOR_XRGB(0,0,0), "Your Text Here");
[/php]


NOP

After Globals:
[php]
bool Memoria( void * pDest, char * szPatch, size_t sSize )//NOP Function
{
DWORD dwOrgProtect = NULL;
if ( !VirtualProtect ( pDest, sSize, PAGE_EXECUTE_READWRITE, &dwOrgProtect ))
return FALSE;

memcpy( pDest, szPatch, sSize );
VirtualProtect( pDest, sSize, dwOrgProtect, NULL );
return TRUE;
}
[/php]

And to use it:
[php]
Memoria(0x000000, "\x90\x90\x90", 3);
[/php]


Draw Crosshair:

Globals:
[php]
float ScreenCenterX = 0.0f;//Horizontal Position
float ScreenCenterY = 0.0f;//Vertical Position
[/php]

After Globals:
[php]
void DrawXHair(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR color)
{
D3DVIEWPORT9 viewP;
pDevice->GetViewport( &viewP );
DWORD ScreenCenterX = viewP.Width / 2;
DWORD ScreenCenterY = viewP.Height / 2;

D3DRECT rec1 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25, ScreenCenterY+1};
D3DRECT rec2 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,ScreenCenterY+25};

pDevice->Clear( 1, &rec1, D3DCLEAR_TARGET, color, 0, 0 );
pDevice->Clear( 1, &rec2, D3DCLEAR_TARGET, color, 0, 0 );
}
[/php]

SetViewport:
[php]
ScreenCenterX = ( float )pViewport->Width / 2;
ScreenCenterY = ( float )pViewport->Height / 2;
[/php]

Make Crosshair (Endscene):
[php]
DrawXHair(pDevice,D3DCOLOR_XRGB(0,0,0));
[/php]


Draw Box WITH Border

After Globals:

[php]
void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
{
if( w < 0 )w = 1;
if( h < 0 )h = 1;
if( x < 0 )x = 1;
if( y < 0 )y = 1;

D3DRECT rec = { x, y, x + w, y + h };
pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
}

void DrawBorder( int x, int y, int w, int h, int px, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
FillRGB( x, (y + h - px), w, px, BorderColor, pDevice );
FillRGB( x, y, px, h, BorderColor, pDevice );
FillRGB( x, y, w, px, BorderColor, pDevice );
FillRGB( (x + w - px), y, px, h, BorderColor, pDevice );
}

void DrawBox( int x, int y, int w, int h, D3DCOLOR BoxColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
FillRGB( x, y, w, h, BoxColor, pDevice );
DrawBorder( x, y, w, h, 1, BorderColor, pDevice );
}
[/php]

And to create the box (Endscene):
[php]
DrawBox (X,Y,W,H,Back Color,Border Color,pDevice);
[/php]


Draw Circle

Globals:
[php]
ID3DXLine *pLine;
#define PI 3.14159265
[/php]

After Globals:
[php]
void DrawCircle(int X, int Y, int radius, int numSides, DWORD Color)
{
D3DXVECTOR2 Line[128];
float Step = PI * 2.0 / numSides;
int Count = 0;
for (float a=0; a < PI*2.0; a += Step)
{
float X1 = radius * cos(a) + X;
float Y1 = radius * sin(a) + Y;
float X2 = radius * cos(a+Step) + X;
float Y2 = radius * sin(a+Step) + Y;
Line[Count].x = X1;
Line[Count].y = Y1;
Line[Count+1].x = X2;
Line[Count+1].y = Y2;
Count += 2;
}
pLine->Begin();
pLine->Draw(Line,Count,Color);
pLine->End();
}
[/php]

Create the line(with your font):
[php]
D3DXCreateLine(pDevice,&pLine);
[/php]

And to draw the circle(Endscene):
[php]
DrawCircle(X,Y,R,S,COLOR);
[/php]

I havent perfected the circle, but when i do i will update.

Universal Draw FPS: - Thanks Longevity

Globals:
[php]
float fFps = NULL;
float fLastTickCount = NULL;
float fCurrentTickCount;
char cFrameRate[50] = {NULL};
[/php]

After Globals:
[php]
char *GetFrameRate()
{
fCurrentTickCount = clock() * 0.001f;
++fFps;
if((fCurrentTickCount - fLastTickCount) > 1.0f)
{
fLastTickCount = fCurrentTickCount;
sprintf( cFrameRate, "[ Current FPS: %d ]", int( fFps ) );
fFps = 0;
}
return cFrameRate;
}
[/php]

And to show the FPS (Endscene):
[php]
pFont->DrawTextA( 5, 0, D3DCOLOR_XRGB( 255, 250, 0 ), GetFrameRate());
[/php]

Hopefully this will go to good use and help people.
Dont leech please.

& a Thanks would be good /

And heres are screenshot off what the functions are capable of:

thanks a bunch acid!

edit-1st
Very Nice Acid I will be using these!

For the print text how would you find the x and y?
Quote Originally Posted by whatup777 View Post
Very Nice Acid I will be using these!

For the print text how would you find the x and y?
Not sure actually.
I just estimate and if its wrong, change it.
Quote Originally Posted by whatup777 View Post
Very Nice Acid I will be using these!

For the print text how would you find the x and y?
lol use the guess and check method... i'm sure there is a table out there somewhere but I find it easier to guess and check xD
Quote Originally Posted by swatfx View Post
lol use the guess and check method... i'm sure there is a table out there somewhere but I find it easier to guess and check xD
That means logging in to CA like a billion time
Hmm I bet topblast knows....
Do you atleast know where to estimate. Like a number range I dont wanna be guessing -100000 to 1000000
Quote Originally Posted by whatup777 View Post
Do you atleast know where to estimate. Like a number range I dont wanna be guessing -100000 to 1000000
Its between your resolution numbers.

If you want it at the top.
Your going to put X at about 20-50.
its just common sence.

If you want the text to be half way down the screen, its gna be about 500 isnt it?
lol .... ACID
Very nice ! Hope you'll release it soon
Found Mouse coordinate calculator so i should be fine
lololol Hackshield will d/c you if it detects the string MPGH.net.. just found that out, however it is easily bypassed by packing the hack
Umm swat how do you use the D3D i dont know lol
Quote Originally Posted by swatfx View Post
lololol Hackshield will d/c you if it detects the string MPGH.net.. just found that out, however it is easily bypassed by packing the hack
LOL. Serious?

Quote Originally Posted by xXNoobAlertXx View Post
Umm swat how do you use the D3D i dont know lol
Umm. GTFO
These are pretty useful for those that can actually make hacks. I cant
Posts 1–15 of 189 · Page 1 of 13
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?