Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MW2 Hud Elems
- //XRPC Tutorial Part 5
- //Paste this into your Coding ;D
- 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,
- GlowColor = 0x8C,
- 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)));
- }
- 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.GlowColor, new byte[] { BitConverter.GetBytes(GlowR)[0], BitConverter.GetBytes(GlowG)[0], BitConverter.GetBytes(GlowB)[0], BitConverter.GetBytes(GlowA)[0] });
- 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)));
- }
Advertisement
Add Comment
Please, Sign In to add comment