Post: [SPRX] Hudelements (Real way of using Hud Elems)
07-28-2014, 06:21 AM #1
seb5594
Proud Former Admin
(adsbygoogle = window.adsbygoogle || []).push({}); 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
    struct opd_s{
uint32_t sub;
uint32_t toc;
};


Here are the Hud Elements with all required things :p

    
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;
}


Here is how you can spawn a elem
    
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);


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
(adsbygoogle = window.adsbygoogle || []).push({});

The following 26 users say thank you to seb5594 for this useful post:

alex10998, AlexNGU, EdiTzZ, EnVatoHD, EternalHabit, FusionIsDaName, IRizerX, iTпDM, ItsLollo1000, KUSHxHERO, LaRip8, Loxy, M0T1VAT10N, John, OLDSCHOOLMODZHD, Script Kiddie, ShutTheCrunchUp, SnaY, Swaqq, Taylor, VezahMoDz, ViolentFelon, xPAQz, Yadderr, zMarcusHD
07-28-2014, 07:17 AM #2
iTпDM
Vault dweller
Great Work Seb :P
07-28-2014, 11:28 AM #3
Swaqq
Professional Thanker
Nice, but what is this? 0x00708080 is it the TOC Adress?
07-28-2014, 01:37 PM #4
Shark
Retired.
Originally posted by NGU View Post
Nice, but what is this? 0x00708080 is it the LOC Adress?


yea that would be the TOC Address (Table Of Contents), its required as its used as a lookup for the sprx to find the function pointers in the game.

The following user thanked Shark for this useful post:

Swaqq
07-28-2014, 01:45 PM #5
Swaqq
Professional Thanker
Originally posted by Shark View Post
yea that would be the TOC Address (Table Of Contents), its required as its used as a lookup for the sprx to find the function pointers in the game.


Oops I wrote LOC and thx
07-31-2014, 07:43 PM #6
Swaqq
Professional Thanker
0x00724C38 << What is this called?
07-31-2014, 07:54 PM #7
seb5594
Proud Former Admin
Originally posted by NGU View Post
0x00724C38 << What is this called?


How would i know what address this is now? lol
07-31-2014, 09:07 PM #8
Originally posted by NGU View Post
0x00724C38 << What is this called?

The toc...
08-04-2014, 10:54 PM #9
Thanks seb Enzo
08-08-2014, 10:51 PM #10
Zambie
< ^ > < ^ >
Originally posted by seb5594 View Post
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
    struct opd_s{
uint32_t sub;
uint32_t toc;
};


Here are the Hud Elements with all required things :p

    
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;
}


Here is how you can spawn a elem
    
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);


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


Thanks Seb
Anyone notice how seb said: It's similar how Xbox it does

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo