Hey Guys,
Some of you might start to make a MW2 SPRX Menu, here's something which will help you to start. It's pretty easy to use and the best way also. It's similar how Xbox it does, i just made my own Functions out of it :p
You will need this structure at first
Here are the Hud Elements with all required things :p
Here is how you can spawn a elem
Just set the Alpha to 0 if you want to hide anything :p
Credits:
Hacksource - Hudelem Structure
seb5594 - Building Functions
Therifboy - Way to call Functions using TOC
Some of you might start to make a MW2 SPRX Menu, here's something which will help you to start. It's pretty easy to use and the best way also. It's similar how Xbox it does, i just made my own Functions out of it :p
You will need this structure at first
Code:
struct opd_s{
uint32_t sub;
uint32_t toc;
};
Code:
union color_s
{
struct
{
int8_t r;
int8_t g;
int8_t b;
int8_t a;
};
int32_t rgba;
};
struct hudelem_s
{
int type; // 0x00-0x04
float x; // 0x04-0x08
float y; // 0x08-0x0C
float z; // 0x0C-0x10
int targetEntNum; // 0x10-0x14
float fontScale; // 0x14-0x18
float fromFontScale; // 0x18-0x1C
int fontScaleStartTime; // 0x1C-0x20
int fontScaleTime; // 0x20-0x24
int label; // 0x24-0x28
int font; // 0x28-0x2C
int alignOrg; // 0x2C-0x30
int alignScreen; // 0x30-0x34
color_s color; // 0x34-0x38
color_s fromColor; // 0x38-0x3C
int fadeStartTime; // 0x3C-0x40
int fadeTime; // 0x40-0x44
int height; // 0x44-0x48
int width; // 0x48-0x4C
int materialIndex; // 0x4C-0x50
int fromHeight; // 0x50-0x54
int fromWidth; // 0x54-0x58
int scaleStartTime; // 0x58-0x5C
int scaleTime; // 0x5C-0x60
float fromY; // 0x60-0x64
float fromX; // 0x64-0x68
int fromAlignOrg; // 0x68-0x6C
int fromAlignScreen; // 0x6C-0x70
int moveStartTime; // 0x70-0x74
int moveTime; // 0x74-0x78
float value; // 0x78-0x7C
int time; // 0x7C-0x80
int duration; // 0x80-0x84
int text; // 0x84-0x88
float sort; // 0x88-0x8C
color_s glowColor; // 0x8C-0x90
int fxBirthTime; // 0x90-0x94
int fxLetterTime; // 0x94-0x98
int fxDecayStartTime; // 0x98-0x9C
int fxDecayDuration; // 0x9C-0xA0
int soundID; // 0xA0-0xA4
int flags; // 0xA4-0xA8
};
struct game_hudelem_s
{
hudelem_s elem;
long clientNum;
long team;
long archived;
};
int G_LocalizedStringIndex(const char* Text)
{
int(*LocalizedStringIndex)(const char* Text) = (int(*)(const char*))0x00708080;
return LocalizedStringIndex(Text);
}
opd_s HDA = { 0x001826B0, 0x00724C38 };
void(*HudElem_DestroyAll)() = (void(*)())&HDA;
opd_s GMI = { 0x001BE758, 0x00724C38 };
int(*GetMaterialIndex)(const char* Material) = (int(*)(const char*))&GMI;
opd_s HEA = { 0x001806E0, 0x00724C38 };
game_hudelem_s*(*HudElemAlloc)(int32_t client, int32_t teamNum) = (game_hudelem_s*(*)(int32_t, int32_t))&HEA;
game_hudelem_s* setShader(int clientIndex, const char* Shader, int Width, int Height, float X, float Y, int Allign = 5, unsigned char R = 0, unsigned char G = 0, unsigned char B = 0, unsigned char A = 0)
{
*(int*)0x131689C = 1; //Allows to use precached Shaders
game_hudelem_s* elem = HudElemAlloc(clientIndex, 0);
elem->clientNum = clientIndex;
elem->elem.type = 6;
elem->elem.materialIndex = GetMaterialIndex(Shader);
elem->elem.width = Width;
elem->elem.height = Height;
elem->elem.x = X;
elem->elem.y = Y;
elem->elem.alignOrg = Allign;
elem->elem.color.r = R;
elem->elem.color.g = G;
elem->elem.color.b = B;
elem->elem.color.a = A;
return elem;
}
game_hudelem_s* setText(int clientIndex, const char* Text, int Font, float FontScale, float X, float Y, int Allign, unsigned char R = 0, unsigned char G = 0, unsigned char B = 0, unsigned char A = 0,unsigned char glowR = 0, unsigned char glowG = 0, unsigned char glowB = 0, unsigned char glowA = 0)
{
game_hudelem_s* elem = HudElemAlloc(clientIndex, 0);
elem->clientNum = clientIndex;
elem->elem.type = 1;
elem->elem.text = G_LocalizedStringIndex(Text);
elem->elem.font = Font;
elem->elem.fontScale = FontScale;
elem->elem.x = X;
elem->elem.y = Y;
elem->elem.alignOrg = Allign;
elem->elem.alignScreen = 6;
elem->elem.color.r = R;
elem->elem.color.g = G;
elem->elem.color.b = B;
elem->elem.color.a = A;
elem->elem.glowColor.r = glowR;
elem->elem.glowColor.g = glowG;
elem->elem.glowColor.b = glowB;
elem->elem.glowColor.a = glowA;
return elem;
}
Code:
game_hudelem_s* MyElem = setText(0, "My sexy Text y0", 7, 2, 120, 220, 8, 255, 255, 255, 0, 0, 100, 255);
game_hudelem_s* MyShader = setShader(0, "white", 250, 100, 0, 0, 5, 255, 255, 255, 255);
Credits:
Hacksource - Hudelem Structure
seb5594 - Building Functions
Therifboy - Way to call Functions using TOC