You are viewing our Forum Archives. To view or take place in current topics click here.
MW3 HUD Elems Help
Posted:

MW3 HUD Elems HelpPosted:

TheGamersBoards
  • New Member
Status: Offline
Joined: Mar 07, 201410Year Member
Posts: 48
Reputation Power: 2
Status: Offline
Joined: Mar 07, 201410Year Member
Posts: 48
Reputation Power: 2
I know I posted something about this for mw2 yesterday, but I had mw3 hud elems working, changed a bit of code and it stopped working.


        public class HElems
        {
            public static uint
            locString = 0x8226E020,
            material = 0x8226E100,
            elem = 0x8223D1E0,
            xOffset = 0x08,
            yOffset = 0x04,
            textOffset = 0x84,
            fontOffset = 0x24,
            fontSizeOffset = 0x14,
            colorOffset = 0x30,
            relativeOffset = 0x2c,
            widthOffset = 0x44,
            heightOffset = 0x48,
            shaderOffset = 0x4c,
            GlowColor = 0x8C,
            alignOffset = 0x30;
        }
        public uint createElem(int client)
        {
            return Jtag.Call(HElems.elem, client, 0);
        }

        public uint spawnElem(int client, uint elemAddress)
        {
            Jtag.SetMemory(elemAddress + 0xA8, ReverseBytes(BitConverter.GetBytes(client)));

            return elemAddress;
        }

        public uint createText(string text)
        {
            return Jtag.Call(HElems.locString, text);
        }

        public uint getMaterialIndex(string material)
        {
            return Jtag.Call(HElems.material, material);
        }

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

        public byte[] ReverseBytes(byte[] inArray)
        {
            byte temp;
            int highCtr = inArray.Length - 1;

            for (int ctr = 0; ctr < inArray.Length / 2; ctr++)
            {
                temp = inArray[ctr];
                inArray[ctr] = inArray[highCtr];
                inArray[highCtr] = temp;
                highCtr -= 1;
            }
            return inArray;
        }

        public void setIcon(uint elem, uint shader, int width, int height, float x, float y, uint align, float sort = 0, int r = 255, int g = 255, int b = 255, int a = 255)
        {
            Jtag.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x04 });

            Jtag.SetMemory(elem + HElems.relativeOffset, uintBytes(0x05));
            Jtag.SetMemory(elem + HElems.relativeOffset - 4, uintBytes(0x06));
            Jtag.SetMemory(elem + HElems.shaderOffset, uintBytes(shader));
            Jtag.SetMemory(elem + HElems.heightOffset, ReverseBytes(BitConverter.GetBytes(height)));
            Jtag.SetMemory(elem + HElems.widthOffset, ReverseBytes(BitConverter.GetBytes(width)));
            Jtag.SetMemory(elem + HElems.alignOffset, uintBytes(align));
            Jtag.SetMemory(elem + HElems.colorOffset, new byte[] { BitConverter.GetBytes(r)[0], BitConverter.GetBytes(g)[0], BitConverter.GetBytes(b)[0], BitConverter.GetBytes(a)[0] });
            Jtag.SetMemory(elem + HElems.textOffset + 4, ReverseBytes(BitConverter.GetBytes(sort)));
            Jtag.SetMemory(elem + HElems.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
            Jtag.SetMemory(elem + HElems.yOffset, ReverseBytes(BitConverter.GetBytes(y)));
        }

        public void setText(uint elem, byte[] text, uint font, float fontScale, float x, float y, uint align, int r = 255, int g = 255, int b = 255, int a = 255)
        {
            Jtag.SetMemory(elem, new byte[] { 0x00, 0x00, 0x00, 0x01 });

            Jtag.SetMemory(elem + HElems.textOffset, text);
            Jtag.SetMemory(elem + HElems.relativeOffset, uintBytes(0x05));
            Jtag.SetMemory(elem + HElems.relativeOffset - 4, uintBytes(0x06));
            Jtag.SetMemory(elem + HElems.fontOffset, uintBytes(font));
            Jtag.SetMemory(elem + HElems.alignOffset, uintBytes(align));
            Jtag.SetMemory(elem + HElems.textOffset + 4, new byte[] { 0x40, 0x00 });
            Jtag.SetMemory(elem + HElems.fontSizeOffset, ReverseBytes(BitConverter.GetBytes(fontScale)));
            Jtag.SetMemory(elem + HElems.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
            Jtag.SetMemory(elem + HElems.yOffset, ReverseBytes(BitConverter.GetBytes(y)));
            Jtag.SetMemory(elem + HElems.colorOffset, new byte[] { BitConverter.GetBytes(r)[0], BitConverter.GetBytes(g)[0], BitConverter.GetBytes(b)[0], BitConverter.GetBytes(a)[0] });
        }

        private void button49_Click_1(object sender, EventArgs e)
        {
                    uint elemshader1 = createElem(0);
                    uint shader1 = getMaterialIndex("white");
                    setIcon(elemshader1, shader1, 240, 49, 250, 190, 1, 0, 255, 100, 150, 250);
                    spawnElem(0, elemshader1);
                    uint subname = createElem(0);
                    string elemtext3 = "" + textBox5.Text;
                    setText(subname, uintBytes(createText(elemtext3)), 6, 20, 240, 170, 1);
        }


I don't know the problem, please help!
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.