You are viewing our Forum Archives. To view or take place in current topics click here.
Please delete this topic!
Posted:

Please delete this topic!Posted:

MHUTricK
  • Powerhouse
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Hello, me again, having a little problem with adding a hud. If you could help me that would be fantastic, and I need help on changing something else. But here is the code for the hud:
        private void button10_Click(object sender, EventArgs e)// createElem(0);
        {
            uint elem = createElem(0);
            string elemtext = " " + textBox3.Text; //textbox9's text
            setText(elem, uintBytes(createText(elemtext)), 1, 20, 330, 0, 1); //top
            spawnElem(0, elem);
            uint elemshader = createElem(0);
            uint shader = getMaterialIndex("black"); //spawned black HUd elem
            setIcon(elemshader, shader, 1000, 40, 355, 400, 1);
            spawnElem(0, elemshader);




        }
        public static 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 void ChangeShaderLocation(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 + 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 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)));
        }

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

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
The error is that: Error 1 The name 'B' does not exist in the current context.

And I would like some help on something else aswell, how would I change this to where I press a button and it changes, instead of changing when I type in it? The code for it:
private void textBox1_TextChanged(object sender, EventArgs e)
        {
            int client = (int)numericUpDown1.Value;
            Jtag.Call(SV, client, 1, textBox1.Text);
        }


Last edited by MHUTricK ; edited 1 time in total
#2. Posted:
isocool123
  • Resident Elite
Status: Offline
Joined: Feb 12, 201410Year Member
Posts: 260
Reputation Power: 10
Status: Offline
Joined: Feb 12, 201410Year Member
Posts: 260
Reputation Power: 10
My god someone add him on skype so he can just ask you on skype and not spam the jtag section every day
#3. Posted:
XeXStozza
  • Powerhouse
Status: Offline
Joined: Jun 08, 201211Year Member
Posts: 407
Reputation Power: 18
Status: Offline
Joined: Jun 08, 201211Year Member
Posts: 407
Reputation Power: 18
MHU_Lobbies wrote Hello, me again, having a little problem with adding a hud. If you could help me that would be fantastic, and I need help on changing something else. But here is the code for the hud:
        private void button10_Click(object sender, EventArgs e)// createElem(0);
        {
            uint elem = createElem(0);
            string elemtext = " " + textBox3.Text; //textbox9's text
            setText(elem, uintBytes(createText(elemtext)), 1, 20, 330, 0, 1); //top
            spawnElem(0, elem);
            uint elemshader = createElem(0);
            uint shader = getMaterialIndex("black"); //spawned black HUd elem
            setIcon(elemshader, shader, 1000, 40, 355, 400, 1);
            spawnElem(0, elemshader);




        }
        public static 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 void ChangeShaderLocation(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 + 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 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)));
        }

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

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
The error is that: Error 1 The name 'B' does not exist in the current context.

And I would like some help on something else aswell, how would I change this to where I press a button and it changes, instead of changing when I type in it? The code for it:
private void textBox1_TextChanged(object sender, EventArgs e)
        {
            int client = (int)numericUpDown1.Value;
            Jtag.Call(SV, client, 1, textBox1.Text);
        }

You don't know how to use an OnButtonClick event? And your saying you coded all of that by yourself?
#4. Posted:
MHUTricK
  • Powerhouse
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
The error is right here HElems.colorOffset, new byte[] { BitConverter.GetBytes(r)[0], BitConverter.GetBytes(g)[0], BitConverter.GetBytes(B)[0], BitConverter.GetBytes(a)[0] });
At the capitalized B.
#5. Posted:
MHUTricK
  • Powerhouse
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
XeXStozza wrote
MHU_Lobbies wrote Hello, me again, having a little problem with adding a hud. If you could help me that would be fantastic, and I need help on changing something else. But here is the code for the hud:
        private void button10_Click(object sender, EventArgs e)// createElem(0);
        {
            uint elem = createElem(0);
            string elemtext = " " + textBox3.Text; //textbox9's text
            setText(elem, uintBytes(createText(elemtext)), 1, 20, 330, 0, 1); //top
            spawnElem(0, elem);
            uint elemshader = createElem(0);
            uint shader = getMaterialIndex("black"); //spawned black HUd elem
            setIcon(elemshader, shader, 1000, 40, 355, 400, 1);
            spawnElem(0, elemshader);




        }
        public static 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 void ChangeShaderLocation(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 + 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 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)));
        }

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

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
The error is that: Error 1 The name 'B' does not exist in the current context.

And I would like some help on something else aswell, how would I change this to where I press a button and it changes, instead of changing when I type in it? The code for it:
private void textBox1_TextChanged(object sender, EventArgs e)
        {
            int client = (int)numericUpDown1.Value;
            Jtag.Call(SV, client, 1, textBox1.Text);
        }

You don't know how to use an OnButtonClick event? And your saying you coded all of that by yourself?


I know some parts, not all of it, and i'm asking for help, not for someone to come here and yell at me. So please do not post again on my topic if your not going to help me.
#6. Posted:
Botch
  • TTG Senior
Status: Offline
Joined: Aug 31, 201211Year Member
Posts: 1,553
Reputation Power: 65
Status: Offline
Joined: Aug 31, 201211Year Member
Posts: 1,553
Reputation Power: 65
What exactly do you mean by "press a button and it changes"? If you want something like a table of options that you can select and change, then make a comboBox.
#7. Posted:
MHUTricK
  • Powerhouse
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Botch wrote What exactly do you mean by "press a button and it changes"? If you want something like a table of options that you can select and change, then make a comboBox.


Like Link a button, to that textbox, to send a code to the game, like for example I have:s cg_fov 120 // And right now, when I type it in, it automatically sends it, but I want to link a button, to the text, so when I click the button, it sends/pokes it in.
#8. Posted:
XeXStozza
  • Powerhouse
Status: Offline
Joined: Jun 08, 201211Year Member
Posts: 407
Reputation Power: 18
Status: Offline
Joined: Jun 08, 201211Year Member
Posts: 407
Reputation Power: 18
double click on the button in your design view, then copy the code you want executed into the OnButtonClick which appears if you double click on the button
#9. Posted:
MHUTricK
  • Powerhouse
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
XeXStozza wrote double click on the button in your design view, then copy the code you want executed into the OnButtonClick which appears if you double click on the button

Ok thanks alot. I see what I messed up now, I put the code in the textbox, instead of the button.

I will just delete the hud then.
#10. Posted:
MHUTricK
  • Powerhouse
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Status: Offline
Joined: Oct 30, 201112Year Member
Posts: 414
Reputation Power: 17
Nvm, It was a minor error, I capitalized it on accident.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.