[Dev] HP Bar (97d)

djagripnos

Banned
Joined
Jun 10, 2012
Messages
566
Reaction score
134
HealthBar.cpp:

Code:
#include "StdAfx.h"

std::vector<HEALTH_BAR> HealthBar;

void cHealthBar::ClearNewHealthBar()
{
    HealthBar.clear();
}

void cHealthBar::InsertNewHealthBar(short Index, BYTE Rate)
{
    HEALTH_BAR Bar;

    Bar.Index = Index;
    Bar.Rate = Rate;

    HealthBar.push_back(Bar);
}

HEALTH_BAR* cHealthBar::GetNewHealthBar(short Index)
{
    for (std::vector<HEALTH_BAR>::iterator it = HealthBar.begin(); it != HealthBar.end(); ++it)
    {
        if (it->Index == Index)
        {
            return &(*it);
        }
    }

    return NULL;
}


void cHealthBar::DrawHealthBar()
{
    ((void(*)())0x4B8300)();

    float LifeBarWidth = 50.0f;

    VAngle Angle;

    HEALTH_BAR* NewHealthBar;

    for (int i = 0; i < 390; i++)
    {
        DWORD ViewPort = *(DWORD*)(0x08033C38) + (i * 916);

        if ((*(BYTE*)ViewPort != 0x0) && (*(BYTE*)(ViewPort + 132) == 2))
        {
            NewHealthBar = HPBar.GetNewHealthBar(*(WORD*)(ViewPort + 476));

            if (Health[0] == true)
            {
                continue;
            }

            if (NewHealthBar == 0)
            {
                continue;
            }

            Angle.X = *(float*)(ViewPort + 16);
            Angle.Y = *(float*)(ViewPort + 20);
            Angle.Z = *(float*)(ViewPort + 300) + *(float*)(ViewPort + 24) + 100.0f;

            GetPosFromAngle(&Angle, &HPBar._X, &HPBar._Y);

            HPBar._X -= (int)floor(LifeBarWidth / (double) 2.0);

            SetBlend(true);

            glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
            DrawBarForm((float)(HPBar._X), (float)(HPBar._Y + 1.7), LifeBarWidth + 5.0f, 5.0f);

            GLSwitchBlend();

            glColor4f(2.0f, 0.0f, 0.0f, 0.6f);

            DrawBarForm((float)(HPBar._X) + 2.5f, (float)(HPBar._Y) + 2.5f, (float)((NewHealthBar->Rate * LifeBarWidth) / 100.0f), 3.0f);

            GLSwitch();
        }

        GLSwitch();

        glColor3f(1.0, 1.0, 1.0);
    }
}

cHealthBar HPBar;

HealthBar.h:

Code:
#pragma once

struct VAngle
{
    float X;
    float Y;
    float Z;
};

struct HEALTH_BAR
{
    short Index;
    BYTE Rate;
};

class cHealthBar
{
public:
    void ClearNewHealthBar();
    void InsertNewHealthBar(short Index, BYTE Rate);
    HEALTH_BAR* GetNewHealthBar(short Index);
    static void DrawHealthBar();
 
private:
    int  _X;
    int  _Y;
    char _Buffer[80];
};

extern cHealthBar HPBar;

Defines:

Code:
#define GLSwitchBlend ((void(__cdecl*)()) 0x50C610)
#define GLSwitch ((void(__cdecl*)()) 0x50C580 )
#define SetBlend ((void(__cdecl*)(BYTE Mode)) 0x50C500)
#define GetPosFromAngle ((void(__cdecl*)(VAngle * Angle, int * PosX, int * PosY))0x50C2F0)
#define DrawBarForm    ((void(__cdecl*)(float PosX, float PosY, float Width, float Height)) 0x50D3D0)
#define GetCursorWorkSize ((int(__cdecl*)(int PosX,int PosY,int Width,int Height,int Mode)) 0x40C330)
#define Text ((int(*)(int x, int y, LPCSTR Text, int BackgroundWidth, int AlignCenter, int a6)) 0x47D3F0)

Hook:
Code:
HookCall(0x4B798E, HPBar.DrawHealthBar);
Credits: Maykon
 
Last edited:
HookCall(0x4B798E, HPBar.DrawHealthBar);
I understand you don’t understand what you are throwing here, I asked for the full function!!!!

Аnd the server side is HP Bar?


AND this text
Health[0] --- no definition
 
can you show an example of using? screenshots/video