Post: [SPRX] Hudelements with extra functions
07-31-2014, 07:04 PM #1
seb5594
Proud Former Admin
(adsbygoogle = window.adsbygoogle || []).push({});
Hey NGU Community,

Notorious asked me for a release of MW3 Hudelements, and here is it now!
Those Hud Element Functions has been optimized for SPRX Plugins (C++) and are really easy to use!
This Functions has been tested and it works flawless!

You will need this structure at first and the TOC (Table of content)
    
#define TOC 0x0072DCE8
struct opd_s
{
uint32_t sub;
uint32_t toc;
};


Paste this somewhere in your project
    union color_s
{
struct
{
int8_t r;
int8_t g;
int8_t b;
int8_t a;
};
int32_t rgba;
};
struct hudelem_s
{
int type;
float x;
float y;
float z;
int targetEntNum;
float fontScale;
float fromFontScale;
float fontScaleStartTime;
float fontScaleTime;
int font;
int alignOrg;
int alignScreen;
color_s color;
color_s fromColor;
int fadeStartTime;
int fadeTime;
int label;
int width;
int height;
int materialIndex;
int fromWidth;
int fromHeight;
int scaleStartTime;
int scaleTime;
float fromX;
float fromY;
int fromAlignOrg;
int fromAlignScreen;
int moveStartTime;
int moveTime;
int time;
int duration;
float value;
int text;
float sort;
color_s glowColor;
int fxBirthTime;
int fxLetterTime;
int fxDecayStartTime;
int fxDecayDuration;
int soundID;
int flags;
};
struct game_hudelem_s
{
hudelem_s elem;
int clientNum;
int team;
int archived;
};
int G_LocalizedStringIndex(const char* Text)
{
opd_s Localized = { 0x001BE6CC, TOC };
int(*LocalizedStringIndex)(const char* Text) = (int(*)(const char*))&Localized;
return LocalizedStringIndex(Text);
}
opd_s GMI = { 0x001BE744, TOC };
int(*GetMaterialIndex)(const char* Material) = (int(*)(const char*))&GMI;
game_hudelem_s* HudElem_Alloc()
{
for (int i = 0; i < 1024; i++)
{
game_hudelem_s* elem = (game_hudelem_s*)(0x00F0E10C + (i * 0xB4));
if (!elem->elem.type) return elem;
}
return (game_hudelem_s*)-1;
}
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)
{
game_hudelem_s* elem = HudElem_Alloc();
elem->clientNum = clientIndex;
elem->elem.type = 4;
*(int*)0x00F3B198 = 5594;
elem->elem.materialIndex = GetMaterialIndex(Shader);
*(int*)0x00F3B198 = 0;
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 = HudElem_Alloc();
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 = 0;
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;
}
void HudElem_DestroyAll()
{
opd_s HDA = { 0x001872E8, TOC };
void(*HudElemDestroyAll)() = (void(*)())&HDA;
HudElemDestroyAll();
}


void FoneScaleOverTime(game_hudelem_s* Elem, float FontSize, float Time)
{
Elem->elem.fromFontScale = Elem->elem.fontScale;
Elem->elem.fontScaleTime = Time;
Elem->elem.fontScaleStartTime = *(int*)0x00FC3DB0;
Elem->elem.fontScale = FontSize;
}
void ScaleOverTime(game_hudelem_s *Elem, int time, float width, float height)
{
Elem->elem.fromHeight = Elem->elem.height;
Elem->elem.fromWidth = Elem->elem.width;
Elem->elem.scaleStartTime = *(int*)0x00FC3DB0;
Elem->elem.scaleTime = (int)floor(time * 1000 + 0.5);
Elem->elem.height = height;
Elem->elem.width = width;
}
void MoveOverTime(game_hudelem_s *Elem, int time, float x, float y)
{
Elem->elem.fromX = Elem->elem.x;
Elem->elem.fromY = Elem->elem.y;
Elem->elem.fromAlignOrg = Elem->elem.alignOrg;
Elem->elem.fromAlignScreen = Elem->elem.alignScreen;
Elem->elem.moveStartTime = *(int*)0x00FC3DB0;
Elem->elem.moveTime = (int)floor(time * 1000 + 0.5);
Elem->elem.x = x;
Elem->elem.y = y;
}
void FadeOverTime(game_hudelem_s* Elem, float Time, int R, int G, int B, int A)
{
Elem->elem.fromColor = Elem->elem.color;
Elem->elem.color.r = R;
Elem->elem.color.g = G;
Elem->elem.color.b = B;
Elem->elem.color.a = A;
Elem->elem.fadeTime = (int)floor(Time * 1000 + 0.5);
Elem->elem.fadeStartTime = *(int*)0x00FC3DB0;
}


Usage
    game_hudelem_s* MyText = setText(0, "My Text", 0, 2, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 255);

game_hudelem_s* MyShader = setShader(0, "white", 250, 250, 0, 0, 0, 255, 255, 255, 255);

Credits
seb5594
Hacksource


Other interesting MW3 Release(s) from me:
You must login or register to view this content.

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

-JM-, Absolute Zero, Aegon Targaryen, Red-EyeX32, Geo, LaRip8, Notorious, OLDSCHOOLMODZHD, Restrain, SaberNGU, Sticky, Swaqq, xHostModer
08-01-2014, 03:07 PM #2
Swaqq
Professional Thanker
nice, i think you forgot int Elem .-. plz correct me if im wrong
08-01-2014, 06:54 PM #3
Sturmi :3
Do a barrel roll!
seb da beast Enzo
08-03-2014, 06:20 PM #4
Nice release Winky Winky
08-12-2014, 06:42 PM #5
AM|T_Alpha
Save Point
Do you have fadealphaovertime ?
08-12-2014, 07:50 PM #6
seb5594
Proud Former Admin
Originally posted by Alpha View Post
Do you have fadealphaovertime ?


Just use FadeOverTime for it :p
08-12-2014, 10:28 PM #7
AM|T_Alpha
Save Point
Ok and when i add the color_s part it says int8_t does not name a type do you know why ?
08-12-2014, 11:08 PM #8
seb5594
Proud Former Admin
Originally posted by Alpha View Post
Ok and when i add the color_s part it says int8_t does not name a type do you know why ?


Make sure you have this headers included:
#include <cellstatus.h>
#include <sys/prx.h>
08-25-2014, 04:35 PM #9
-JM-
Space Ninja
Originally posted by seb5594 View Post
Make sure you have this headers included:
#include <cellstatus.h>
#include <sys/prx.h>

Yo can you add typewriter i see you have it in your structure but I get a stupid error "argument end of list"
08-25-2014, 04:47 PM #10
seb5594
Proud Former Admin
Originally posted by JM
Yo can you add typewriter i see you have it in your structure but I get a stupid error "argument end of list"


um i never had this error msg, mind posting your code here?

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo