ESPHealth Bars/String

Posts 115 of 32 · Page 1 of 3
ESPHealth Bars/String
Hello guys, todday i posting a Simple Function ESPHealth with two options Bars/String, Hope you enjoy

Code:
struct cVertex 
{ 
 	float x, y, z, h;
	D3DCOLOR color;
	float tu, tv;
	static DWORD FVF; 
};

VOID cD3D::DrawFilledRectangle(FLOAT x, FLOAT y, FLOAT w, FLOAT h, DWORD dwColor, LPDIRECT3DDEVICE9 pDevice)
{
	if(!pDevice)
		return;

	cVertex vertices[4] =
	{
		x, y, 0.0f, 1.0f, dwColor, 0.0f, 0.0f,
		x + w, y, 0.0f, 1.0f, dwColor, 1.0f, 0.0f,

		x + w, y + h, 0.0f, 1.0f, dwColor, 1.0f, 1.0f,
		x, y + h, 0.0f, 1.0f, dwColor, 0.0f, 1.0f,
	};
	pDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, vertices, sizeof(cVertex));
}

VOID cD3D::DrawHealthBars(INT Bars, INT String, INT x, INT y, WORD health, BOOL bCheckSpawnS, BOOL iSpawnCheck, LPDIRECT3DDEVICE9 pDevice)
{
	// Original Bars Function By: Gellin, Modified for Bars/String Options By: luizimloko

	DWORD dwColor;
	CHAR szHealth[256];

	if(health > 100) 
		health = 100; 

	if(health > 75) 
		dwColor = 0xFF00FF00; 
	else if(health > 40) 
		dwColor = 0xFFFF9B00;
	else 
		dwColor = 0xFFFF0000; 

	if(bCheckSpawnS)
		if(iSpawnCheck)
			dwColor = 0xFF000000;

	DWORD dwDrawWidth = health / 4;

	if(dwDrawWidth <= 2)
		dwDrawWidth = 4;

	if(Bars) { // Gellin
		DrawFilledRectangle(x - 1, y - 1, 27, 5, 0xFF000000, pDevice);
		DrawFilledRectangle(x, y, dwDrawWidth, 3, dwColor, pDevice);
	}
	if(String) { // luizimloko
		sprintf(szHealth,  "Health: %d %%", health);
		D3D->PrintText(D3D->pFont, x, y, TCenter, dwColor, szHealth);
	}
}
How to use:

Code:
Bars:

D3D->DrawHealthBars(TRUE, FALSE, ScreenPosition.x - 10, ScreenPosition.y - 35, Health->nHealth, TRUE, Health->bSpawnSheild, pDevice);

String:

D3D->DrawHealthBars(FALSE, TRUE, ScreenPosition.x, ScreenPosition.y - 35, Health->nHealth, TRUE, Health->bSpawnSheild, pDevice);
Crédits:
@gellin, donoob




that's a sick menu bro. should share XD
Quote Originally Posted by supercarz1991 View Post
that's a sick menu bro. should share XD
Well, the concept of his menu is actually quite simple. He basically draws a sprite, and has a static number of page numbers or something as an integer. When the arrows are clicked, the number is changed (however he changes it is up to him). Well, that's how I assume he did it. It's still sick though :3
Quote Originally Posted by Shadow` View Post
Well, the concept of his menu is actually quite simple. He basically draws a sprite, and has a static number of page numbers or something as an integer. When the arrows are clicked, the number is changed (however he changes it is up to him). Well, that's how I assume he did it. It's still sick though :3
every time i've tried to do a sprite, it wont compile...
Quote Originally Posted by supercarz1991 View Post
every time i've tried to do a sprite, it wont compile...
Whits Base v2->Download->Change Sprite
Quote Originally Posted by Flengo View Post


Whits Base v2->Download->Change Sprite
this base is not Withs Base v2
Quote Originally Posted by luizimloko View Post


this base is not Withs Base v2
He was just explaining how to correctly do a sprite by telling him to look in whit's base v2
Menu system looks very simple, though the sprite is kinda cool looking its just a sprite and nothing special.

Good post, I made a system with very similar code on my own for WarRock.
Just do it like this:

Code:
LPDIRECT3DTEXTURE9 Banner;
LPD3DXSPRITE Sprite;

void CreateSprite(LPDIRECT3DDEVICE9 pDevice)
{
	{
		D3DXCreateTextureFromFileInMemoryEx(pDevice, &myFile, sizeof(myFile), 600 ,500, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &Banner);
	    D3DXCreateSprite(pDevice,&Sprite);
   }
}

void DrawSprite(LPDIRECT3DDEVICE9 pDevice){
	D3DXVECTOR3 POS;
	POS.x = MenX;
	POS.y = MenY;
	POS.z = 0;
	if(Banner==NULL){CreateSprite(pDevice);}
	Sprite->Begin(D3DXSPRITE_ALPHABLEND); 
	Sprite->Draw(Banner,NULL,NULL,&POS,0xFFFFFFFF);
	Sprite->End();
}
Then call it in Present:
Code:
DrawSprite(pDevice);
PS: myFile is your image byte array
i was thinkin about doin sprites for health boxes

you know

Green while above 50HP
change to Yellow 49 and under
red under 15

pokemon style
Quote Originally Posted by RedAppleCoder View Post
easy too supercarz
why so active ?
Quote Originally Posted by wraithkilla View Post
why so active ?
why not
Quote Originally Posted by RedAppleCoder View Post
why not
becaus you think this is time waste ?
Posts 115 of 32 · Page 1 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?