Post: [Updated/1.10] Hud Elements
03-05-2014, 03:55 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); I updated hud elements today aswell. It's everything you need for a mod menu now. Goodluck!

These scripts were originally Bad Luck Brians for 1.05, I don't use my hud elements like this so yeah... here you go.

Thanks to Shark the ppc is fixed :p


Hud Elements 1.10

    
public static class Hud
{
public static class HElems
{
public static uint //0xb8 4 = icon, 1 = text

ELEM = 0xD87888, //patched
FIX_ELEM = 0x335c7,
FPS = 0x36B260,

xOffset = 0x04,
yOffset = 0x08,
textOffset = 0x40,
fontOffset = 0x24,
fontSizeOffset = 0x14, //43 30 ..
colorOffset = 0x30,
relativeOffset = 0x28, //no idea idc.. set it to 0
widthOffset = 0x44,
heightOffset = 0x48,
shaderOffset = 0x4C,
GlowColor = 0x8C,
clientOffset = 0x10,
alignOffset = 0x2C; //set it to 0 also..


}


public static void Enable_Cacher()
{
PS3.SetMemory(0x2100000, new byte[32]);
PS3.SetMemory(0x2106000, new byte[32]);
PS3.SetMemory(0x36B260, new byte[] { 0x3C, 0x60, 0x02, 0x10, 0x80, 0x83, 0x00, 0x00, 0x2C, 0x04, 0x00, 0x00, 0x41, 0x82, 0x00, 0x8C, 0x4B, 0xCC, 0x83, 0x11, 0x3C, 0x80, 0x02, 0x10, 0x90, 0x64, 0x60, 0x00, 0x38, 0x60, 0x00, 0x00, 0x90, 0x64, 0x00, 0x00, 0x48, 0x00, 0x00, 0x74 });
PS3.SetMemory(0x335C7, new byte[] { 0x01 });
}


public static void ActivateIndex(int index, int type)
{

byte[] Typ = BitConverter.GetBytes(type);
Array.Reverse(Typ);
PS3.SetMemory(Hud.HElems.ELEM + 0xb8 * (uint)index, Typ);


}
public static byte[] ToHexFloat(float Axis)
{

byte[] bytes = BitConverter.GetBytes(Axis);
Array.Reverse(bytes);
return bytes;
}


public static byte[] RGBA(decimal R, decimal G, decimal B, decimal A)
{
byte[] RGBA = new byte[4];
byte[] RVal = BitConverter.GetBytes(Convert.ToInt32(R));
byte[] GVal = BitConverter.GetBytes(Convert.ToInt32(G));
byte[] BVal = BitConverter.GetBytes(Convert.ToInt32(B));
byte[] AVal = BitConverter.GetBytes(Convert.ToInt32(A));
RGBA[0] = RVal[0];
RGBA[1] = GVal[0];
RGBA[2] = BVal[0];
RGBA[3] = AVal[0];
return RGBA;
}


public static void StoreIcon(uint elemIndex, decimal client, int shader, int width, int height, float x, float y, uint align, float sort, int r, int g, int b, int a)
{
uint elem = HElems.ELEM + ((elemIndex) * 0xbCool Man (aka Tustin);
byte[] ClientID = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
PS3.SetMemory(elem, new byte[0xB8]);
PS3.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x04 });
PS3.SetMemory(elem + HElems.shaderOffset, ReverseBytes(BitConverter.GetBytes(shader)));
PS3.SetMemory(elem + HElems.heightOffset, ReverseBytes(BitConverter.GetBytes(height)));
PS3.SetMemory(elem + HElems.widthOffset, ReverseBytes(BitConverter.GetBytes(width)));
PS3.SetMemory(elem + HElems.alignOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.relativeOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.xOffset, ToHexFloat(x));
PS3.SetMemory(elem + HElems.yOffset, ToHexFloat(y));
PS3.SetMemory(elem + HElems.colorOffset, RGBA(r, g, b, a));
PS3.SetMemory(elem + HElems.clientOffset, ClientID);


}

public static byte[] CacheString(string Text)
{
PS3.SetMemory(HElems.FIX_ELEM, new byte[] { 0x01 }); //must patch this to make it work
PS3.SetMemory(0x2100000, Encoding.ASCII.GetBytes(Text + "\0"));
byte[] result = new byte[6];
Thread.Sleep(10);
PS3.GetMemory(0x2106000, ref result);
return result;
}



public static void StoreTextElem(uint elemIndex, int client, string Text, int font, float fontScale, int x, int y, uint align, float sort, int r, int g, int b, int a, int r1, int g1, int b1, int a1)
{
uint elem = HElems.ELEM + ((elemIndex) * 0xBCool Man (aka Tustin);
byte[] ClientID = ReverseBytes(BitConverter.GetBytes(client));
PS3.SetMemory(elem, new byte[0xB4]);
PS3.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x01 });
PS3.SetMemory(elem + HElems.textOffset, CacheString(Text));
PS3.SetMemory(elem + HElems.fontOffset, ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(font))));
PS3.SetMemory(elem + HElems.alignOffset, ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(0))));
PS3.SetMemory(elem + HElems.relativeOffset, ReverseBytes(BitConverter.GetBytes(0)));
PS3.SetMemory(elem + HElems.fontSizeOffset, ToHexFloat(fontScale));
PS3.SetMemory(elem + HElems.xOffset, ToHexFloat(x));
PS3.SetMemory(elem + HElems.yOffset, ToHexFloat(y));
PS3.SetMemory(elem + HElems.colorOffset, RGBA(r, g, b, a));
PS3.SetMemory(elem + HElems.GlowColor, RGBA(r1, g1, b1, a1));
PS3.SetMemory(elem + HElems.clientOffset, ClientID);


}

public static byte[] UInt32ToBytes(uint input)
{
byte[] bytes = BitConverter.GetBytes(input);
Array.Reverse(bytes);
return bytes;
}

public static byte[] ReverseBytes(byte[] inArray)
{
Array.Reverse(inArray);
return inArray;
}
public static byte[] uintBytes(uint input)
{
byte[] data = BitConverter.GetBytes(input);
Array.Reverse(data);
return data;
}

}


And before you people flame and say I got this from someone else, I didn't, Bad Luck Brian Taught me how to update them from 1.06. I did this on my own, except the offsets for the hud struct :p

Credits:
    
Bad Luck Brian - Teaching PPC, and how to cache strings
Shark - Fixing PPC Bug :p
SC58
Me - Updating from 1.07 to 1.10


Here is everything for you to make a mod menu

You must login or register to view this content.
You must login or register to view this content.
Last edited by Black Panther ; 04-04-2014 at 11:27 AM. Reason: Updated to 1.10

The following 12 users say thank you to Black Panther for this useful post:

Dannie Fresh, ResistTheJamsha, M-alShammary, Mango_Knife, Notorious, xProvXKiller, RatchetBooty, SnaY, Taylors Bish, Winter, x_action_x, xHostModer
03-07-2014, 02:31 PM #20
BuC-ShoTz
TeamMvKâ?¢
03-07-2014, 02:33 PM #21
Originally posted by ShoTz View Post


I can't watch that right now I'm in class what is it?
03-07-2014, 02:36 PM #22
BuC-ShoTz
TeamMvKâ?¢
Originally posted by AlmightySo View Post
I can't watch that right now I'm in class what is it?


Hud Designer, Live Preview Smile
03-07-2014, 03:03 PM #23
Originally posted by ShoTz View Post
Hud Designer, Live Preview Smile


Nice lol. :p
03-07-2014, 03:27 PM #24
Originally posted by ShoTz View Post
Hud Designer, Live Preview Smile


Hey do you mind pm'ing me your skype. I wanna talk to you about something.
03-07-2014, 08:07 PM #25
Notorious
Caprisuns Is Back
Originally posted by AlmightySo View Post
Okay this is how your form should be.

Add this after your attaching/rpc enable:
    
Hud.Enable_Cacher();


Then when you're gonna spawn a text element call it like this.

    
public static void TestSpawn()
{
Hud.StoreTextElem(120, 0, "This is a text elem", 4, 2.2f, 200, 60, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0);
}


yeah man I have done all of that but still storetextelem wont work
03-07-2014, 08:08 PM #26
Originally posted by Prime
yeah man I have done all of that but still storetextelem wont work


Pm your skype ill fix it for you
03-07-2014, 09:13 PM #27
BuC-ShoTz
TeamMvKâ?¢
Originally posted by AlmightySo View Post
Hey do you mind pm'ing me your skype. I wanna talk to you about something.

mailbox is full, pm me your skype
03-07-2014, 10:06 PM #28
Originally posted by logiicdope View Post
Not hating or anything, but instead of doing Enable_Cacher()
you can do this
public static byte[] CacheString(string Text)
{
byte[] Index = uintBytes(CreateText(Text + "\0"));
return Index;
}
public static byte[] uintBytes(uint input)
{
byte[] data = BitConverter.GetBytes(input);
Array.Reverse(data);
return data;
}
public static uint CreateText(string text)
{
return RPC.Call(G_LocalizedString, text);
}


I guess, making it in PPC is easier for me.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo