BluntGod_ (09-07-2012),Nightmare (09-10-2012),pDevice (10-15-2012),ronaldowynnek (09-26-2012),Shadow` (09-16-2012)
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
Last edited by luizimloko; 09-07-2012 at 07:49 PM.
BluntGod_ (09-07-2012),Nightmare (09-10-2012),pDevice (10-15-2012),ronaldowynnek (09-26-2012),Shadow` (09-16-2012)
that's a sick menu bro. should share XD
commando: You're probably the best non-coder coder I know LOL
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
I Read All Of My PM's & VM'sIf you need help with anything, just let me know.
Staff Administrator Since 10.13.2019
Publicist Since 04.04.2015
Middleman Since 04.14.2014
Global Moderator Since 08.01.2013
Premium Since 05.29.2013
Minion+ Since 04.18.2013
Combat Arms Minion Since 12.26.2012
Contributor Since 11.16.2012
Member Since 05.11.2010
[MPGH]Flengo (09-08-2012),luizimloko (09-09-2012)
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:
Then call it in Present: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(); }
PS: myFile is your image byte arrayCode:DrawSprite(pDevice);![]()
Haters Gon' Hate
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
commando: You're probably the best non-coder coder I know LOL
Synthesised (10-28-2012)
easy too supercarz![]()
Haters Gon' Hate