You are viewing our Forum Archives. To view or take place in current topics click here.
C# HUD Elem Help! ()MW2
Posted:

C# HUD Elem Help! ()MW2Posted:

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 am trying to add HUD Elems to my tool, but whenever I go to spawn one in, the tool freezes and I get " Exception from HRESULT: 0x82DA0004 "

I have removed 'static' as I was getting multiple errors, sometimes it spawns a black line, vertical up the screen (which is not ment to happen) but mainly it just crashes


        public class HElems
        {
            public static uint
            locString = 0x8220C838,
            material = 0x8220C9F8,
            elem = 0x821DF9C0,
            xOffset = 0x08,
            yOffset = 0x04,
            textOffset = 0x84,
            fontOffset = 0x28,
            fontSizeOffset = 0x14,
            colorOffset = 0x34,
            relativeOffset = 0x2c,
            widthOffset = 0x48,
            heightOffset = 0x44,
            shaderOffset = 0x4C,
            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 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 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 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.textOffset + 4, ReverseBytes(BitConverter.GetBytes(sort)));
            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] });
        }
        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] });
        }
           


        public void DestroyElems(int clientID)
        {
            Jtag.Call(0x821DFAF0, clientID);
        }
        public void ElemMove(int client, uint elem, float x, float y)
        {
            Jtag.SetMemory(elem + HElems.xOffset, ReverseBytes(BitConverter.GetBytes(x)));
            Jtag.SetMemory(elem + HElems.yOffset, ReverseBytes(BitConverter.GetBytes(y)));
            spawnElem(client, elem);
        }


anyone know how to fix it? <3


Last edited by TheGamersBoards ; edited 1 time in total
#2. Posted:
IDA
  • Powerhouse
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
what game is this for ? might help
#3. Posted:
Escent
  • Rising Star
Status: Offline
Joined: Nov 26, 201014Year Member
Posts: 756
Reputation Power: 50
Status: Offline
Joined: Nov 26, 201014Year Member
Posts: 756
Reputation Power: 50
Elem Move? looks liek hes tryna make a mw3 menu lol
#4. Posted:
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
IDA wrote what game is this for ? might help

shit sorry lol, and its mw2

and im not making a mw3 menu, would be cool though lol, maybe once I get this fixed ;)
#5. Posted:
xAcme
  • Junior Member
Status: Offline
Joined: Mar 24, 201410Year Member
Posts: 53
Reputation Power: 2
Status: Offline
Joined: Mar 24, 201410Year Member
Posts: 53
Reputation Power: 2
TheGamersBoards wrote
IDA wrote what game is this for ? might help

**** sorry lol, and its mw2

and im not making a mw3 menu, would be cool though lol, maybe once I get this fixed ;)

It's too laggy, will freeze on you. Make a .dll
#6. Posted:
IDA
  • Powerhouse
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
And let's see how you would spawn in a HUD ( how you call it )?
#7. Posted:
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
IDA wrote And let's see how you would spawn in a HUD ( how you call it )?

        public void Newsbar(int clientID)
        {
            uint[] NewsbarshaderMat = new uint[18];
            uint[] Newsbarshader = new uint[18];
            uint[] Newsbar = new uint[18];
            string Newsbartext = "^2Welcome To The Lobby ^7<||>^2Pimp Yo Sheit Here ^5<||> ^7FyreHax! ^3<||>^7Donate for Lobbies > PM me for Info^9<||>^1FyreHax is Sexy as ****";
            for (int i = 0; i < 18; i++)
            {
                Newsbar[i] = createElem(i);
                setText(Newsbar[i], uintBytes(createText(Newsbartext)), 6, 2, 300, 500, 1);
                spawnElem(i, Newsbar[i]);
                Newsbarshader[i] = createElem(i);
                NewsbarshaderMat[i] = getMaterialIndex("Black");
                setIcon(Newsbarshader[i], NewsbarshaderMat[i], 20, 1000, 300, 500, 1, 0, 0, 0, 0, 130);
            }
            while (true)
            {
                for (int i = 0; i < 18; i++)
                {
                    for (int POS = 300; POS > -150; POS -= 2)
                    {
                        ElemMove(i, Newsbar[i], POS, 500);
                        Thread.Sleep(5);
                        if (POS < 149)
                        {
                            POS = 300;
                        }
                    }
                }
            }
        }


then I use Newsbar(0); to call it in
#8. Posted:
IDA
  • Powerhouse
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
Status: Offline
Joined: Sep 21, 201311Year Member
Posts: 454
Reputation Power: 26
TheGamersBoards wrote
IDA wrote And let's see how you would spawn in a HUD ( how you call it )?

        public void Newsbar(int clientID)
        {
            uint[] NewsbarshaderMat = new uint[18];
            uint[] Newsbarshader = new uint[18];
            uint[] Newsbar = new uint[18];
            string Newsbartext = "^2Welcome To The Lobby ^7<||>^2Pimp Yo Sheit Here ^5<||> ^7FyreHax! ^3<||>^7Donate for Lobbies > PM me for Info^9<||>^1FyreHax is Sexy as ****";
            for (int i = 0; i < 18; i++)
            {
                Newsbar[i] = createElem(i);
                setText(Newsbar[i], uintBytes(createText(Newsbartext)), 6, 2, 300, 500, 1);
                spawnElem(i, Newsbar[i]);
                Newsbarshader[i] = createElem(i);
                NewsbarshaderMat[i] = getMaterialIndex("Black");
                [color=red]setIcon(Newsbarshader[i], NewsbarshaderMat[i], 20, 1000, 300, 500, 1, 0, 0, 0, 0, 130);[/color]
            }
            while (true)
            {
                for (int i = 0; i < 18; i++)
                {
                    for (int POS = 300; POS > -150; POS -= 2)
                    {
                        ElemMove(i, Newsbar[i], POS, 500);
                        Thread.Sleep(5);
                        if (POS < 149)
                        {
                            POS = 300;
                        }
                    }
                }
            }
        }


then I use Newsbar(0); to call it in


you dont have "spawnElem(" for the shader () you need to do

spawnElem(i, NewsbarShader[i]);

that should work
#9. Posted:
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
IDA wrote
TheGamersBoards wrote
IDA wrote And let's see how you would spawn in a HUD ( how you call it )?

        public void Newsbar(int clientID)
        {
            uint[] NewsbarshaderMat = new uint[18];
            uint[] Newsbarshader = new uint[18];
            uint[] Newsbar = new uint[18];
            string Newsbartext = "^2Welcome To The Lobby ^7<||>^2Pimp Yo Sheit Here ^5<||> ^7FyreHax! ^3<||>^7Donate for Lobbies > PM me for Info^9<||>^1FyreHax is Sexy as ****";
            for (int i = 0; i < 18; i++)
            {
                Newsbar[i] = createElem(i);
                setText(Newsbar[i], uintBytes(createText(Newsbartext)), 6, 2, 300, 500, 1);
                spawnElem(i, Newsbar[i]);
                Newsbarshader[i] = createElem(i);
                NewsbarshaderMat[i] = getMaterialIndex("Black");
                [color=red]setIcon(Newsbarshader[i], NewsbarshaderMat[i], 20, 1000, 300, 500, 1, 0, 0, 0, 0, 130);[/color]
            }
            while (true)
            {
                for (int i = 0; i < 18; i++)
                {
                    for (int POS = 300; POS > -150; POS -= 2)
                    {
                        ElemMove(i, Newsbar[i], POS, 500);
                        Thread.Sleep(5);
                        if (POS < 149)
                        {
                            POS = 300;
                        }
                    }
                }
            }
        }


then I use Newsbar(0); to call it in


you dont have "spawnElem(" for the shader () you need to do

spawnElem(i, NewsbarShader[i]);

that should work


ok, that fixed that, thanks ;)
but now I have a problem spawning the Element, error : Exception from HRESULT: 0x82DA0004

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


any ideas?
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.