Post: Typewriter [C#] [1.18]
07-05-2014, 02:06 AM #1
Chris
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({}); Hey Guys, I just learned how to make a Typewriter after a few days of messing around with it. I've decided to release the working code because who cares about keeping things private. Tustin

Credits go to Omnisciencefor helping me with this and basically finding the correct functions.


First you're going to need some new C# classes added into your project.


Class #1 = Hudelem

    
using PS3Lib;
using System;
using System.InteropServices;
using System.Threading

namespace BlackOps2Tool1._18
{

internal class Hudelem
{
public static uint abilityFlag = 0x84;
public static uint alignOrg = 0x72;
public static uint alignScreen = 0x73;
public static uint clientOffset = 0x7c;
public static uint color = 0x18;
public static uint duration = 0x38;
public static uint ElemIndex = Offset.G_HudElems;
public static uint ElemInterval = 0x88;
public static uint fadeStartTime = 0x20;
public static uint fadeTime = 0x54;
public static uint flag2 = 0x7a;
public static uint flags = 0x4c;
public static uint font = 0x71;
public static uint fontScale = 12;
public static uint fontScaleStartTime = 20;
public static uint fontScaleTime = 0x52;
public static uint fromAlignOrg = 0x76;
public static uint fromAlignScreen = 0x77;
public static uint fromColor = 0x1c;
public static uint fromFontScale = 0x10;
public static uint fromHeight = 0x5e;
public static uint fromWidth = 0x5c;
public static uint fromX = 40;
public static uint fromY = 0x2c;
public static uint fxBirthTime = 0x48;
public static uint fxDecayDuration = 0x6a;
public static uint fxDecayStartTime = 0x68;
public static uint fxLetterTime = 0x66;
public static uint fxRedactDecayDuration = 110;
public static uint fxRedactDecayStartTime = 0x6c;
public static uint glowColor = 0x44;
public static uint height = 90;
public static uint HudsLength = 0x88;
public static uint label = 0x56;
public static uint materialIndex = 0x74;
public static uint moveStartTime = 0x30;
public static uint moveTime = 0x62;
public static uint offscreenMaterialIdx = 0x75;
private static PS3API PS3 = new PS3API(SelectAPI.TargetManager);
public static uint scaleStartTime = 0x24;
public static uint scaleTime = 0x60;
public static uint sort = 0x40;
public static uint soundID = 120;
public static uint targetEntNum = 80;
public static uint team = 0x80;
public static uint text = 0x62;
public static uint time = 0x34;
public static uint type = 0x6d;
public static uint ui3dWindow = 0x4f;
public static uint value = 60;
public static uint width = 0x58;
public static uint xOffset = 0;
public static uint yOffset = 4;
public static uint zOffset = 8;

public static void WriteBytes(uint address, byte[] input)
{
PS3.SetMemory(address, input);
}

public static byte[] GetMemory(uint offset, int length)
{
byte[] buffer = new byte[length];
PS3.GetMemory(offset, buffer);
return buffer;
}

public class HUD
{
public static string centerString(string[] StringArray)
{
int num3;
int length = 0;
int num2 = 0;
string str = "";
for (num3 = 0; num3 < StringArray.Length; num3++)
{
if (StringArray[num3].Length > length)
{
length = StringArray[num3].Length;
}
}
for (num3 = 0; num3 < StringArray.Length; num3++)
{
str = "";
if (StringArray[num3].Length < length)
{
num2 = length - StringArray[num3].Length;
if (StringArray[num3].Contains("[{+"))
{
num2 += 13;
}
for (int i = 0; i < num2; i++)
{
str = str + " ";
}
}
StringArray[num3] = str + StringArray[num3];
}
string str2 = "";
for (num3 = 0; num3 < StringArray.Length; num3++)
{
str2 = str2 + StringArray[num3] + "\n";
}
return ("^7" + str2);
}

public static void ChangeAlpha(int index, int r, int g, int b, int alpha)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.SetMemory(num + Hudelem.color, RGBA(r, g, b, alpha));
}

public static void Huds_DestroyAll()
{
for (uint i = 60; i < 0x400; i++)
{
PS3.SetMemory(HudStruct.G_Hudelems + (i * HudStruct.IndexSize), new byte[HudStruct.IndexSize]);
}
}

public static void Objective_DestroyAll()
{
for (uint i = 3; i <= 0x1f; i++)
{
uint address = ObjStruct.ObjectiveIndex + (i * ObjStruct.ObjectiveIndexLength);
Hudelem.WriteBytes(address, new byte[ObjStruct.ObjectiveIndexLength]);
}
}

public static void ChangeFont(uint elemIndex, short font)
{
uint num = Offset.G_HudElems + (elemIndex * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteInt16(num + 0x70, font);
}

public static void ChangeFontScale(int elemIndex, double fontScale)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fontScale, (float)fontScale);
}

public static void ChangeFontScaleOverTime(uint elem, short Time, double OldFont, double NewFont)
{
uint num = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fromFontScale, (float)OldFont);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.fontScaleStartTime, getLevelTime());
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.fontScaleTime, Time);
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fontScale, (float)NewFont);
}

public static void ChangeText(int index, short Text)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.label, Text);
}

public static void ChangeText(uint Element, string Text)
{
Hudelem.PS3.Extension.WriteInt32(Element + Hudelem.text, G_LocalizedStringIndex(Text));
}

public static void ChangeTextSub(int index, string Text)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.SetMemory(num + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
Hudelem.PS3.SetMemory(num + 0x79, new byte[] { 0xff });
Hudelem.PS3.Extension.WriteInt32(num + Hudelem.text, G_LocalizedStringIndex(Text));
}

public static void ChangeWidth(int elemIndex, short width)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.width, width);
}

public static void DestroyAll()
{
for (int i = 0; i < 400; i++)
{
DestroyElem(i);
}
}

public static void DestroyElem(int index)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
}

public static void doTypeWriter(uint Index, int clientIndex, string Text, short font, double fontSize, float x, float y, ushort fxLetterTime, ushort fxDecayStartTime, ushort fxDecayDuration, int r, int g, int b, int a, int r1, int g1, int b1, int a1)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(Index) * 0x8Cool Man (aka Tustin);
byte[] buffer = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(clientIndex)));
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
Hudelem.PS3.SetMemory(offset + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
Hudelem.PS3.SetMemory(offset + 0x79, new byte[] { 0xff });
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.text, G_LocalizedStringIndex(Text));
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fontScale, (float)fontSize);
Hudelem.PS3.SetMemory(offset + Hudelem.xOffset, ToHexFloat(x));
Hudelem.PS3.SetMemory(offset + Hudelem.yOffset, ToHexFloat(y));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(r, g, b, a));
Hudelem.PS3.SetMemory(offset + Hudelem.glowColor, RGBA(r1, g1, b1, a1));
Hudelem.PS3.Extension.WriteInt16(offset + 0x70, font);
Hudelem.PS3.SetMemory(offset + 0x70, new byte[] { 1 });
Hudelem.PS3.SetMemory(offset + Hudelem.clientOffset, buffer);
Hudelem.PS3.Extension.WriteUInt32(offset + Hudelem.flags, Hudelem.PS3.Extension.ReadUInt32(offset + 0x4c) | 0x800);
Hudelem.PS3.Extension.WriteUInt32(offset + Hudelem.fxBirthTime, getLevelTime());
Hudelem.PS3.Extension.WriteUInt16(offset + Hudelem.fxLetterTime, fxLetterTime);
Hudelem.PS3.Extension.WriteUInt16(offset + Hudelem.fxDecayStartTime, fxDecayStartTime);
Hudelem.PS3.Extension.WriteUInt16(offset + Hudelem.fxDecayDuration, fxDecayDuration);
}

public static void doTypeWriterCustom(uint Index, ushort fxLetterTime, ushort fxDecayStartTime, ushort fxDecayDuration)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(Index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.flags, Hudelem.PS3.Extension.ReadUInt32(num + 0x4c) | 0x800);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.fxBirthTime, getLevelTime());
Hudelem.PS3.Extension.WriteUInt16(num + Hudelem.fxLetterTime, fxLetterTime);
Hudelem.PS3.Extension.WriteUInt16(num + Hudelem.fxDecayStartTime, fxDecayStartTime);
Hudelem.PS3.Extension.WriteUInt16(num + Hudelem.fxDecayDuration, fxDecayDuration);
}

public static void FadeAlphaOverTime(uint elem, short Time, int OldAlpha, int NewAlpha)
{
uint num = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
byte[] bytes = BitConverter.GetBytes(Convert.ToInt32(OldAlpha));
Hudelem.PS3.SetMemory(num + 0x1f, bytes);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.fadeStartTime, getLevelTime());
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.fadeTime, Time);
byte[] buffer = BitConverter.GetBytes(Convert.ToInt32(NewAlpha));
Hudelem.PS3.SetMemory(num + 0x1b, buffer);
}

public static void FadeOverTime(uint elem, short Time, int R, int G, int B, int A)
{
uint num = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
byte[] memory = Hudelem.GetMemory(num + Hudelem.color, 1);
byte[] buffer = Hudelem.GetMemory((num + Hudelem.color) + 1, 1);
byte[] buffer3 = Hudelem.GetMemory((num + Hudelem.color) + 2, 1);
byte[] buffer4 = Hudelem.GetMemory((num + Hudelem.color) + 3, 1);
Hudelem.PS3.SetMemory(num + Hudelem.fromColor, memory);
Hudelem.PS3.SetMemory((num + Hudelem.fromColor) + 1, buffer);
Hudelem.PS3.SetMemory((num + Hudelem.fromColor) + 2, buffer3);
Hudelem.PS3.SetMemory((num + Hudelem.fromColor) + 3, buffer4);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.fadeStartTime, getLevelTime());
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.fadeTime, Time);
Hudelem.PS3.SetMemory(num + Hudelem.color, RGBA(R, G, B, A));
}

public static int G_LocalizedStringIndex(string Text)
{
return BO2.RPC.Call(Offset.G_LocalizedStringIndex, new object[] { Text });
}

private static int GetClientTime(uint clientIndex)
{
byte[] buffer = new byte[4];
Hudelem.PS3.GetMemory(0x177b828 + (clientIndex * 0x580Cool Man (aka Tustin), buffer);
return BitConverter.ToInt32(BlackOps2Tool1._18.Form1.Functions.ReverseBytes(buffer), 0);
}

public static uint getLevelTime()
{
return Hudelem.PS3.Extension.ReadUInt32(Offset.level_locals_t + 0x79Cool Man (aka Tustin);
}

public static uint HudElem_Alloc(bool Reset = false)
{
if (Reset)
{
HudAlloc.IndexSlot = 50;
}
uint num = Hudelem.ElemIndex + (HudAlloc.IndexSlot * Hudelem.ElemInterval);
HudAlloc.IndexSlot++;
return num;
}

public static uint MoveOverTime(uint elem, short Time, float X, float Y)
{
uint offset = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fromX, Hudelem.PS3.Extension.ReadFloat(offset));
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fromY, Hudelem.PS3.Extension.ReadFloat(offset + Hudelem.yOffset));
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.moveStartTime, (int)getLevelTime());
Hudelem.PS3.Extension.WriteInt16(offset + Hudelem.moveTime, Time);
Hudelem.PS3.Extension.WriteFloat(offset, X);
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.yOffset, Y);
return offset;
}

public static void MoveShaderX(uint index, float X)
{
Hudelem.PS3.Extension.WriteFloat((Offset.G_HudElems + (index * 0x8Cool Man (aka Tustin)) + Hudelem.xOffset, X);
}

public static void MoveShaderXY(uint index, float X, float Y)
{
Hudelem.PS3.Extension.WriteFloat((Offset.G_HudElems + (index * 0x8Cool Man (aka Tustin)) + Hudelem.xOffset, X);
Hudelem.PS3.Extension.WriteFloat((Offset.G_HudElems + (index * 0x8Cool Man (aka Tustin)) + Hudelem.yOffset, Y);
}

public static void MoveShaderY(uint index, float Y)
{
Hudelem.PS3.Extension.WriteFloat((Offset.G_HudElems + (index * 0x8Cool Man (aka Tustin)) + Hudelem.yOffset, Y);
}

public static void PlaySound(uint elemIndex, string SoundID, uint Duration)
{
uint num = Offset.G_HudElems + (elemIndex * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteString(num + Hudelem.soundID, SoundID);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.duration, Duration);
}

public static byte[] ReverseBytes(byte[] inArray)
{
Array.Reverse(inArray);
return inArray;
}

public static byte[] RGBA(decimal R, decimal G, decimal B, decimal A)
{
byte[] buffer = new byte[4];
byte[] bytes = BitConverter.GetBytes(Convert.ToInt32(R));
byte[] buffer3 = BitConverter.GetBytes(Convert.ToInt32(G));
byte[] buffer4 = BitConverter.GetBytes(Convert.ToInt32(B));
byte[] buffer5 = BitConverter.GetBytes(Convert.ToInt32(A));
buffer[0] = bytes[0];
buffer[1] = buffer3[0];
buffer[2] = buffer4[0];
buffer[3] = buffer5[0];
return buffer;
}

public static void ScaleOverTime(uint elem, short Time, short Width, short Height)
{
uint num = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fromHeight, Hudelem.PS3.Extension.ReadFloat(num + Hudelem.height));
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fromWidth, Hudelem.PS3.Extension.ReadFloat(num + Hudelem.width));
Hudelem.PS3.Extension.WriteInt32(num + Hudelem.scaleStartTime, (int)getLevelTime());
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.scaleTime, Time);
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.height, Height);
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.width, Width);
}

public static void SetGlow(int elemIndex, int r1, int g1, int b1, int a1)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.SetMemory(num + Hudelem.glowColor, RGBA(r1, g1, b1, a1));
Thread.Sleep(20);
}

public static void SetGlowText(int elemIndex, int client, string Text, short font, double fontScale, float x, float y, uint align, int sort, int R, int G, int B, int A, int R1, int G1, int B1, int A1)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
byte[] buffer = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
Hudelem.PS3.SetMemory(offset + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
Hudelem.PS3.SetMemory(offset + 0x79, new byte[] { 0xff });
Hudelem.PS3.SetMemory(offset + Hudelem.fontScale, new byte[] { 0x3f, 0xc0 });
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.text, G_LocalizedStringIndex(Text));
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fontScale, (float)fontScale);
Hudelem.PS3.Extension.WriteInt16(offset + 0x70, font);
Hudelem.PS3.SetMemory(offset + 0x70, new byte[] { 1 });
Hudelem.PS3.SetMemory(offset + Hudelem.xOffset, ToHexFloat(x));
Hudelem.PS3.SetMemory(offset + Hudelem.yOffset, ToHexFloat(y));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(R, G, B, A));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(R1, G1, B1, A1));
Hudelem.PS3.SetMemory(offset + Hudelem.clientOffset, buffer);
Hudelem.PS3.Extension.WriteByte(offset + Hudelem.flags, 1);
}

public static void SpinText(uint Index, int Radius, int X, int Y)
{
int num = X;
int num2 = Y;
int num3 = Radius;
int num4 = 0;
while (true)
{
double num5 = num + (Math.Sin((double)num4) * num3);
double num6 = num2 + (Math.Cos((double)num4) * num3);
MoveShaderXY(Index, (float)((int)num5), (float)((int)num6));
Thread.Sleep(100);
num4++;
}
}

public static void StoreIcon(int elemIndex, uint client, short shader, short Width, short Height, float x, float y, uint align, float sort, int r, int g, int b, int a)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
byte[] buffer = ReverseBytes(BitConverter.GetBytes(client));
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
Hudelem.PS3.SetMemory(offset + Hudelem.type, ReverseBytes(BitConverter.GetBytes(Cool Man (aka Tustin)));
Hudelem.PS3.SetMemory(offset + 0x79, new byte[] { 0xff });
Hudelem.PS3.SetMemory(offset + Hudelem.fontScale, new byte[] { 0x3f, 0xc0 });
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.font, shader);
Hudelem.PS3.Extension.WriteInt16(offset + Hudelem.height, Height);
Hudelem.PS3.Extension.WriteInt16(offset + Hudelem.width, Width);
Hudelem.PS3.SetMemory((offset + Hudelem.moveTime) + 4, ReverseBytes(BitConverter.GetBytes(sort)));
Hudelem.PS3.SetMemory(offset + Hudelem.xOffset, ToHexFloat(x));
Hudelem.PS3.SetMemory(offset + Hudelem.yOffset, ToHexFloat(y));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(r, g, b, a));
Hudelem.PS3.SetMemory(offset + Hudelem.clientOffset, buffer);
}

public static void StoreTextElem(int elemIndex, int client, string Text, short font, double fontScale, float x, float y, uint align, int sort, int R, int G, int B, int A)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
byte[] buffer = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
Hudelem.PS3.SetMemory(offset + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
Hudelem.PS3.SetMemory(offset + 0x79, new byte[] { 0xff });
Hudelem.PS3.SetMemory(offset + Hudelem.fontScale, new byte[] { 0x3f, 0xc0 });
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.text, G_LocalizedStringIndex(Text));
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fontScale, (float)fontScale);
Hudelem.PS3.Extension.WriteInt16(offset + 0x70, font);
Hudelem.PS3.SetMemory(offset + 0x70, new byte[] { 1 });
Hudelem.PS3.SetMemory(offset + Hudelem.xOffset, ToHexFloat(x));
Hudelem.PS3.SetMemory(offset + Hudelem.yOffset, ToHexFloat(y));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(R, G, B, A));
Hudelem.PS3.SetMemory(offset + Hudelem.clientOffset, buffer);
Hudelem.PS3.Extension.WriteByte(offset + Hudelem.flags, 1);
}

public static byte[] ToHexFloat(float Axis)
{
byte[] bytes = BitConverter.GetBytes(Axis);
Array.Reverse(bytes);
return bytes;
}

public static void ZigZagText(uint elemIndex, short Speed)
{
uint num = Offset.G_HudElems + (elemIndex * 0x8Cool Man (aka Tustin);
float num2 = 0f;
Hudelem.PS3.SetMemory(num + Hudelem.xOffset, ToHexFloat(-400f));
while (true)
{
float num4;
float num5;
float num3 = Hudelem.PS3.Extension.ReadFloat(num + Hudelem.xOffset);
if (num2 == 480f)
{
return;
}
switch (0)
{
case -400:
num4 = num2 += 120f;
num5 = 800f;
MoveOverTime(elemIndex, Speed, num5, num4);
break;

case 800:
num4 = num2 += 120f;
num5 = -400f;
MoveOverTime(elemIndex, Speed, num5, num4);
break;
}
Thread.Sleep(Speed);
}
}

public static class HudAlloc
{
public static uint g_hudelem = Offset.G_HudElems;
public static uint IndexSlot = 50;
}

public class HudStruct
{
public static uint abilityFlag = 0x84;
public static uint alignOrg = 0x72;
public static uint alignScreen = 0x73;
public static uint clientOffset = 0x7c;
public static uint color = 0x18;
public static uint duration = 0x38;
public static uint fadeStartTime = 0x20;
public static uint fadeTime = 0x54;
public static uint flag2 = 0x7a;
public static uint flags = 0x4c;
public static uint Font = 0x71;
public static uint fontScaleStartTime = 20;
public static uint fontScaleTime = 0x52;
public static uint FontSize = 12;
public static uint fromAlignOrg = 0x76;
public static uint fromAlignScreen = 0x77;
public static uint fromColor = 0x1c;
public static uint fromFontScale = 0x10;
public static uint fromHeight = 0x5e;
public static uint fromWidth = 0x5c;
public static uint fromX = 40;
public static uint fromY = 0x2c;
public static uint fxBirthTime = 0x48;
public static uint fxDecayDuration = 0x6a;
public static uint fxDecayStartTime = 0x68;
public static uint fxLetterTime = 0x66;
public static uint fxRedactDecayDuration = 110;
public static uint fxRedactDecayStartTime = 0x6c;
public static uint G_Hudelems = BlackOps2Tool1._18.Offset.G_HudElems;
public static uint glowColor = 0x44;
public static uint Height = 90;
public static uint IndexSize = 0x88;
public static uint label = 0x56;
public static uint materialIndex = 0x74;
public static uint moveStartTime = 0x30;
public static uint moveTime = 0x62;
public static uint offscreenMaterialIndex = 0x75;
public static uint scaleStartTime = 0x24;
public static uint scaleTime = 0x60;
public static uint sort = 0x40;
public static uint soundID = 120;
public static uint targetEntNum = 80;
public static uint team = 0x80;
public static uint text = 100;
public static uint time = 0x34;
public static uint type = 0x70;
public static uint ui3dWindow = 0x79;
public static uint value = 60;
public static uint Width = 0x58;
public static uint X = 0;
public static uint Y = 4;
public static uint Z = 8;

public class Align
{
public static uint BOTTOM_CENTER = 0x9a;
public static uint BOTTOM_LEFT = 0x8a;
public static uint BOTTOM_RIGHT = 170;
public static uint CENTER_LEFT = 130;
public static uint CENTER_MIDDLE = 0x92;
public static uint CENTER_RIGHT = 0xa2;
public static uint TOP_CENTERED = 120;
public static uint TOP_LEFT = 0x88;
public static uint TOP_RIGHT = 0xa8;
}

public class Typewriter
{
public static uint Classic = 0x4000;
public static uint Normal = 0x800;
}
}

public class ObjStruct
{
public static uint MaterialIndex = 0x1c;
public static uint ObjectiveIndex = 0x1608194;
public static uint ObjectiveIndexLength = 0x30;
public static uint Origin = 4;
public static uint State = 40;
public static uint targetEntNum = 0x10;
public static uint Team = 0x2d;
public static uint X = 4;
public static uint Y = 8;
public static uint Z = 12;
}
}
}
}



Class #2 = Offset

    using System;

namespace BlackOps2Tool1._18
{
internal class Offset
{
public static uint AllowPrecache = (level_locals_t + 0x40);
public static uint ButtonMonitoring = 0x1783da4;
public static uint Cbuf_AddText = 0x313e88;
public static uint CheatProtection = 0x3dbf70;
public static uint cl_ingame = 0x1cb68e8;
public static uint client_s = 0x1bb6cc0;
public static uint ClientAngles = 0x56bc;
public static uint ClientName = 0x178646c;
public static uint ClientOrigin = 40;
public static uint ClientTeam = 0x5504;
public static uint ClientVelocity = 0x34;
public static uint ClientWeapIndex = 440;
public static uint EntAngles = 320;
public static uint EntModelIndex = 0x16c;
public static uint EntOrigin = 0x134;
public static uint FPS = 0x3979ec;
public static uint FreezeClient = 0x17865bf;
public static uint G_AddEvent = 0x279950;
public static uint G_Client = 0x1780f28;
public static uint G_ClientSize = 0x5808;
public static uint G_Entity = 0x16b9f20;
public static uint G_EntitySize = 0x31c;
public static uint G_EntLink = 0x2ad440;
public static uint G_EntUnlink = 0x2ad5c0;
public static uint G_GetPlayerViewOrigin = 0x1e60d0;
public static uint G_GivePlayerWeapon = 0x2a8364;
public static uint G_HudElems = 0x15ddb00;
public static uint G_InitializeAmmo = 0x1e6838;
public static uint G_LocalizedStringIndex = 0x275d24;
public static uint G_LocationalTrace = 0x35c5a8;
public static uint G_MaterialIndex = 0x276020;
public static uint G_ModelIndex = 0x276180;
public static uint G_SetModel = 0x277644;
public static uint G_SetOrigin = 0x279698;
public static uint G_Spawn = 0x278c60;
public static uint G_SpawnHelicopter = 0x22c558;
public static uint G_SpawnTurret = 0x2ba5c8;
public static uint G_TempEntity = 0x279740;
public static uint HeadsUpDisplay = 0x1783f3f;
public static uint HudelemSize = 0x88;
public static uint InGameName = 0x178646c;
public static uint level_locals_t = 0x1608100;
public static uint LevelTime = (level_locals_t + 0x79Cool Man (aka Tustin);
public static uint Player_Die = 0x1fd510;
public static uint PlayerName = 0x178646c;
public static uint RPC = 0x7aa1e0;
public static uint RPCFix = 0x7aa1e0;
public static uint Scr_PlayerKilled = 0x248f20;
public static uint ScriptEntCmdGetCommandTimes = 0x267208;
public static uint ScriptMover_SetupMove = 0x268a38;
public static uint setClientViewAngles = 0x1e1d90;
public static uint SetClientViewAngles = 0x1e1d90;
public static uint SP_Script_Model = 0x2670e8;
public static uint SP_Turret = 0x2bae58;
public static uint SV_GameSendServerCommand = 0x34a1dc;
public static uint SV_LinkEntity = 0x359c00;
public static uint TeleportOffset = 0x1780f50;
public static uint Trace_GetEntityHitID = 0x306f30;
}
}



You will need roughly 16 NumericUpDown's and labels to correspond, a button in addition to a textbox. It should look as so:

You must login or register to view this content.

In the 'Spawn Text' Button the code should be written out as so:

     Hudelem.HUD.doTypeWriter((uint)numericUpDownX.Value, (int)AllClientHUD, metroTextBoxX.Text, (short)numericUpDownX.Value, (double)numericUpDownX.Value, (float)numericUpDownX.Value, (float)numericUpDownX.Value, (ushort)numericUpDownX.Value, (ushort)numericUpDownX.Value, (ushort)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value);


Also, there is a nice little trick to find out what function should come after another, if you can't seem to figure out which order the colors and decay's go in. If you simply remove a comma and add it back, you should see the entire function pop up and from there, you can find out which goes next.

Heres what it should look like: You must login or register to view this content.

Of course these functions can more than likely be written out in a different way, but if you use this, be sure to credit me, Omniscience and Shark for the Classes.

The following 5 users say thank you to Chris for this useful post:

ALI ALHILFI, HeyParah, John, Dacoco, xDebugKiller

The following 2 users groaned at Chris for this awful post:

FusionIsDaName, OLDSCHOOLMODZHD
07-06-2014, 12:02 AM #20
Originally posted by Omniscience View Post
You really dont understand what i am saying right? You you first started to mod CoD, or whatever game out argument has progressed to, and whenever this was first released, AS SOON AS IT WAS RELEASED, You knew how to code it, no errors the first time? Nothing, not even a conversion error. Thats what im trying to get across, no matter how smart you are now, I dont care if you are Einstein, you HAVE to and i repeat HAVE TO start somewhere, whether that somewhere is Modding Cod, or learning how to code, you will not know how to do this, the first time you try it.



You kinda would tho, like you just copy and paste huds, then you go HudElements.Typewriter, and once you put the bracket it prompts you to what you need to do from there.... Not hard at all :/

The following user thanked UnknownNightmare for this useful post:

OLDSCHOOLMODZHD
07-06-2014, 12:30 AM #21
Dacoco
I void warranties.
Originally posted by UnknownNightmar View Post
You kinda would tho, like you just copy and paste huds, then you go HudElements.Typewriter, and once you put the bracket it prompts you to what you need to do from there.... Not hard at all :/


thats why i said when you started modding/coding, i know that isnt hard to understand once you have learned it. Bailey dont argue with me right now
07-06-2014, 04:41 AM #22
Originally posted by Vessel View Post
Hey Guys, I just learned how to make a Typewriter after a few days of messing around with it. I've decided to release the working code because who cares about keeping things private. Tustin

Credits go to Omnisciencefor helping me with this and basically finding the correct functions.


First you're going to need some new C# classes added into your project.


Class #1 = Hudelem

    
using PS3Lib;
using System;
using System.InteropServices;
using System.Threading

namespace BlackOps2Tool1._18
{

internal class Hudelem
{
public static uint abilityFlag = 0x84;
public static uint alignOrg = 0x72;
public static uint alignScreen = 0x73;
public static uint clientOffset = 0x7c;
public static uint color = 0x18;
public static uint duration = 0x38;
public static uint ElemIndex = Offset.G_HudElems;
public static uint ElemInterval = 0x88;
public static uint fadeStartTime = 0x20;
public static uint fadeTime = 0x54;
public static uint flag2 = 0x7a;
public static uint flags = 0x4c;
public static uint font = 0x71;
public static uint fontScale = 12;
public static uint fontScaleStartTime = 20;
public static uint fontScaleTime = 0x52;
public static uint fromAlignOrg = 0x76;
public static uint fromAlignScreen = 0x77;
public static uint fromColor = 0x1c;
public static uint fromFontScale = 0x10;
public static uint fromHeight = 0x5e;
public static uint fromWidth = 0x5c;
public static uint fromX = 40;
public static uint fromY = 0x2c;
public static uint fxBirthTime = 0x48;
public static uint fxDecayDuration = 0x6a;
public static uint fxDecayStartTime = 0x68;
public static uint fxLetterTime = 0x66;
public static uint fxRedactDecayDuration = 110;
public static uint fxRedactDecayStartTime = 0x6c;
public static uint glowColor = 0x44;
public static uint height = 90;
public static uint HudsLength = 0x88;
public static uint label = 0x56;
public static uint materialIndex = 0x74;
public static uint moveStartTime = 0x30;
public static uint moveTime = 0x62;
public static uint offscreenMaterialIdx = 0x75;
private static PS3API PS3 = new PS3API(SelectAPI.TargetManager);
public static uint scaleStartTime = 0x24;
public static uint scaleTime = 0x60;
public static uint sort = 0x40;
public static uint soundID = 120;
public static uint targetEntNum = 80;
public static uint team = 0x80;
public static uint text = 0x62;
public static uint time = 0x34;
public static uint type = 0x6d;
public static uint ui3dWindow = 0x4f;
public static uint value = 60;
public static uint width = 0x58;
public static uint xOffset = 0;
public static uint yOffset = 4;
public static uint zOffset = 8;

public static void WriteBytes(uint address, byte[] input)
{
PS3.SetMemory(address, input);
}

public static byte[] GetMemory(uint offset, int length)
{
byte[] buffer = new byte[length];
PS3.GetMemory(offset, buffer);
return buffer;
}

public class HUD
{
public static string centerString(string[] StringArray)
{
int num3;
int length = 0;
int num2 = 0;
string str = "";
for (num3 = 0; num3 < StringArray.Length; num3++)
{
if (StringArray[num3].Length > length)
{
length = StringArray[num3].Length;
}
}
for (num3 = 0; num3 < StringArray.Length; num3++)
{
str = "";
if (StringArray[num3].Length < length)
{
num2 = length - StringArray[num3].Length;
if (StringArray[num3].Contains("[{+"))
{
num2 += 13;
}
for (int i = 0; i < num2; i++)
{
str = str + " ";
}
}
StringArray[num3] = str + StringArray[num3];
}
string str2 = "";
for (num3 = 0; num3 < StringArray.Length; num3++)
{
str2 = str2 + StringArray[num3] + "\n";
}
return ("^7" + str2);
}

public static void ChangeAlpha(int index, int r, int g, int b, int alpha)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.SetMemory(num + Hudelem.color, RGBA(r, g, b, alpha));
}

public static void Huds_DestroyAll()
{
for (uint i = 60; i < 0x400; i++)
{
PS3.SetMemory(HudStruct.G_Hudelems + (i * HudStruct.IndexSize), new byte[HudStruct.IndexSize]);
}
}

public static void Objective_DestroyAll()
{
for (uint i = 3; i <= 0x1f; i++)
{
uint address = ObjStruct.ObjectiveIndex + (i * ObjStruct.ObjectiveIndexLength);
Hudelem.WriteBytes(address, new byte[ObjStruct.ObjectiveIndexLength]);
}
}

public static void ChangeFont(uint elemIndex, short font)
{
uint num = Offset.G_HudElems + (elemIndex * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteInt16(num + 0x70, font);
}

public static void ChangeFontScale(int elemIndex, double fontScale)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fontScale, (float)fontScale);
}

public static void ChangeFontScaleOverTime(uint elem, short Time, double OldFont, double NewFont)
{
uint num = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fromFontScale, (float)OldFont);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.fontScaleStartTime, getLevelTime());
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.fontScaleTime, Time);
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fontScale, (float)NewFont);
}

public static void ChangeText(int index, short Text)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.label, Text);
}

public static void ChangeText(uint Element, string Text)
{
Hudelem.PS3.Extension.WriteInt32(Element + Hudelem.text, G_LocalizedStringIndex(Text));
}

public static void ChangeTextSub(int index, string Text)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.SetMemory(num + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
Hudelem.PS3.SetMemory(num + 0x79, new byte[] { 0xff });
Hudelem.PS3.Extension.WriteInt32(num + Hudelem.text, G_LocalizedStringIndex(Text));
}

public static void ChangeWidth(int elemIndex, short width)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.width, width);
}

public static void DestroyAll()
{
for (int i = 0; i < 400; i++)
{
DestroyElem(i);
}
}

public static void DestroyElem(int index)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
}

public static void doTypeWriter(uint Index, int clientIndex, string Text, short font, double fontSize, float x, float y, ushort fxLetterTime, ushort fxDecayStartTime, ushort fxDecayDuration, int r, int g, int b, int a, int r1, int g1, int b1, int a1)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(Index) * 0x8Cool Man (aka Tustin);
byte[] buffer = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(clientIndex)));
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
Hudelem.PS3.SetMemory(offset + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
Hudelem.PS3.SetMemory(offset + 0x79, new byte[] { 0xff });
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.text, G_LocalizedStringIndex(Text));
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fontScale, (float)fontSize);
Hudelem.PS3.SetMemory(offset + Hudelem.xOffset, ToHexFloat(x));
Hudelem.PS3.SetMemory(offset + Hudelem.yOffset, ToHexFloat(y));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(r, g, b, a));
Hudelem.PS3.SetMemory(offset + Hudelem.glowColor, RGBA(r1, g1, b1, a1));
Hudelem.PS3.Extension.WriteInt16(offset + 0x70, font);
Hudelem.PS3.SetMemory(offset + 0x70, new byte[] { 1 });
Hudelem.PS3.SetMemory(offset + Hudelem.clientOffset, buffer);
Hudelem.PS3.Extension.WriteUInt32(offset + Hudelem.flags, Hudelem.PS3.Extension.ReadUInt32(offset + 0x4c) | 0x800);
Hudelem.PS3.Extension.WriteUInt32(offset + Hudelem.fxBirthTime, getLevelTime());
Hudelem.PS3.Extension.WriteUInt16(offset + Hudelem.fxLetterTime, fxLetterTime);
Hudelem.PS3.Extension.WriteUInt16(offset + Hudelem.fxDecayStartTime, fxDecayStartTime);
Hudelem.PS3.Extension.WriteUInt16(offset + Hudelem.fxDecayDuration, fxDecayDuration);
}

public static void doTypeWriterCustom(uint Index, ushort fxLetterTime, ushort fxDecayStartTime, ushort fxDecayDuration)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(Index) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.flags, Hudelem.PS3.Extension.ReadUInt32(num + 0x4c) | 0x800);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.fxBirthTime, getLevelTime());
Hudelem.PS3.Extension.WriteUInt16(num + Hudelem.fxLetterTime, fxLetterTime);
Hudelem.PS3.Extension.WriteUInt16(num + Hudelem.fxDecayStartTime, fxDecayStartTime);
Hudelem.PS3.Extension.WriteUInt16(num + Hudelem.fxDecayDuration, fxDecayDuration);
}

public static void FadeAlphaOverTime(uint elem, short Time, int OldAlpha, int NewAlpha)
{
uint num = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
byte[] bytes = BitConverter.GetBytes(Convert.ToInt32(OldAlpha));
Hudelem.PS3.SetMemory(num + 0x1f, bytes);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.fadeStartTime, getLevelTime());
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.fadeTime, Time);
byte[] buffer = BitConverter.GetBytes(Convert.ToInt32(NewAlpha));
Hudelem.PS3.SetMemory(num + 0x1b, buffer);
}

public static void FadeOverTime(uint elem, short Time, int R, int G, int B, int A)
{
uint num = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
byte[] memory = Hudelem.GetMemory(num + Hudelem.color, 1);
byte[] buffer = Hudelem.GetMemory((num + Hudelem.color) + 1, 1);
byte[] buffer3 = Hudelem.GetMemory((num + Hudelem.color) + 2, 1);
byte[] buffer4 = Hudelem.GetMemory((num + Hudelem.color) + 3, 1);
Hudelem.PS3.SetMemory(num + Hudelem.fromColor, memory);
Hudelem.PS3.SetMemory((num + Hudelem.fromColor) + 1, buffer);
Hudelem.PS3.SetMemory((num + Hudelem.fromColor) + 2, buffer3);
Hudelem.PS3.SetMemory((num + Hudelem.fromColor) + 3, buffer4);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.fadeStartTime, getLevelTime());
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.fadeTime, Time);
Hudelem.PS3.SetMemory(num + Hudelem.color, RGBA(R, G, B, A));
}

public static int G_LocalizedStringIndex(string Text)
{
return BO2.RPC.Call(Offset.G_LocalizedStringIndex, new object[] { Text });
}

private static int GetClientTime(uint clientIndex)
{
byte[] buffer = new byte[4];
Hudelem.PS3.GetMemory(0x177b828 + (clientIndex * 0x580Cool Man (aka Tustin), buffer);
return BitConverter.ToInt32(BlackOps2Tool1._18.Form1.Functions.ReverseBytes(buffer), 0);
}

public static uint getLevelTime()
{
return Hudelem.PS3.Extension.ReadUInt32(Offset.level_locals_t + 0x79Cool Man (aka Tustin);
}

public static uint HudElem_Alloc(bool Reset = false)
{
if (Reset)
{
HudAlloc.IndexSlot = 50;
}
uint num = Hudelem.ElemIndex + (HudAlloc.IndexSlot * Hudelem.ElemInterval);
HudAlloc.IndexSlot++;
return num;
}

public static uint MoveOverTime(uint elem, short Time, float X, float Y)
{
uint offset = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fromX, Hudelem.PS3.Extension.ReadFloat(offset));
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fromY, Hudelem.PS3.Extension.ReadFloat(offset + Hudelem.yOffset));
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.moveStartTime, (int)getLevelTime());
Hudelem.PS3.Extension.WriteInt16(offset + Hudelem.moveTime, Time);
Hudelem.PS3.Extension.WriteFloat(offset, X);
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.yOffset, Y);
return offset;
}

public static void MoveShaderX(uint index, float X)
{
Hudelem.PS3.Extension.WriteFloat((Offset.G_HudElems + (index * 0x8Cool Man (aka Tustin)) + Hudelem.xOffset, X);
}

public static void MoveShaderXY(uint index, float X, float Y)
{
Hudelem.PS3.Extension.WriteFloat((Offset.G_HudElems + (index * 0x8Cool Man (aka Tustin)) + Hudelem.xOffset, X);
Hudelem.PS3.Extension.WriteFloat((Offset.G_HudElems + (index * 0x8Cool Man (aka Tustin)) + Hudelem.yOffset, Y);
}

public static void MoveShaderY(uint index, float Y)
{
Hudelem.PS3.Extension.WriteFloat((Offset.G_HudElems + (index * 0x8Cool Man (aka Tustin)) + Hudelem.yOffset, Y);
}

public static void PlaySound(uint elemIndex, string SoundID, uint Duration)
{
uint num = Offset.G_HudElems + (elemIndex * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteString(num + Hudelem.soundID, SoundID);
Hudelem.PS3.Extension.WriteUInt32(num + Hudelem.duration, Duration);
}

public static byte[] ReverseBytes(byte[] inArray)
{
Array.Reverse(inArray);
return inArray;
}

public static byte[] RGBA(decimal R, decimal G, decimal B, decimal A)
{
byte[] buffer = new byte[4];
byte[] bytes = BitConverter.GetBytes(Convert.ToInt32(R));
byte[] buffer3 = BitConverter.GetBytes(Convert.ToInt32(G));
byte[] buffer4 = BitConverter.GetBytes(Convert.ToInt32(B));
byte[] buffer5 = BitConverter.GetBytes(Convert.ToInt32(A));
buffer[0] = bytes[0];
buffer[1] = buffer3[0];
buffer[2] = buffer4[0];
buffer[3] = buffer5[0];
return buffer;
}

public static void ScaleOverTime(uint elem, short Time, short Width, short Height)
{
uint num = Offset.G_HudElems + (elem * 0x8Cool Man (aka Tustin);
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fromHeight, Hudelem.PS3.Extension.ReadFloat(num + Hudelem.height));
Hudelem.PS3.Extension.WriteFloat(num + Hudelem.fromWidth, Hudelem.PS3.Extension.ReadFloat(num + Hudelem.width));
Hudelem.PS3.Extension.WriteInt32(num + Hudelem.scaleStartTime, (int)getLevelTime());
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.scaleTime, Time);
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.height, Height);
Hudelem.PS3.Extension.WriteInt16(num + Hudelem.width, Width);
}

public static void SetGlow(int elemIndex, int r1, int g1, int b1, int a1)
{
uint num = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
Hudelem.PS3.SetMemory(num + Hudelem.glowColor, RGBA(r1, g1, b1, a1));
Thread.Sleep(20);
}

public static void SetGlowText(int elemIndex, int client, string Text, short font, double fontScale, float x, float y, uint align, int sort, int R, int G, int B, int A, int R1, int G1, int B1, int A1)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
byte[] buffer = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
Hudelem.PS3.SetMemory(offset + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
Hudelem.PS3.SetMemory(offset + 0x79, new byte[] { 0xff });
Hudelem.PS3.SetMemory(offset + Hudelem.fontScale, new byte[] { 0x3f, 0xc0 });
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.text, G_LocalizedStringIndex(Text));
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fontScale, (float)fontScale);
Hudelem.PS3.Extension.WriteInt16(offset + 0x70, font);
Hudelem.PS3.SetMemory(offset + 0x70, new byte[] { 1 });
Hudelem.PS3.SetMemory(offset + Hudelem.xOffset, ToHexFloat(x));
Hudelem.PS3.SetMemory(offset + Hudelem.yOffset, ToHexFloat(y));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(R, G, B, A));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(R1, G1, B1, A1));
Hudelem.PS3.SetMemory(offset + Hudelem.clientOffset, buffer);
Hudelem.PS3.Extension.WriteByte(offset + Hudelem.flags, 1);
}

public static void SpinText(uint Index, int Radius, int X, int Y)
{
int num = X;
int num2 = Y;
int num3 = Radius;
int num4 = 0;
while (true)
{
double num5 = num + (Math.Sin((double)num4) * num3);
double num6 = num2 + (Math.Cos((double)num4) * num3);
MoveShaderXY(Index, (float)((int)num5), (float)((int)num6));
Thread.Sleep(100);
num4++;
}
}

public static void StoreIcon(int elemIndex, uint client, short shader, short Width, short Height, float x, float y, uint align, float sort, int r, int g, int b, int a)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
byte[] buffer = ReverseBytes(BitConverter.GetBytes(client));
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
Hudelem.PS3.SetMemory(offset + Hudelem.type, ReverseBytes(BitConverter.GetBytes(Cool Man (aka Tustin)));
Hudelem.PS3.SetMemory(offset + 0x79, new byte[] { 0xff });
Hudelem.PS3.SetMemory(offset + Hudelem.fontScale, new byte[] { 0x3f, 0xc0 });
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.font, shader);
Hudelem.PS3.Extension.WriteInt16(offset + Hudelem.height, Height);
Hudelem.PS3.Extension.WriteInt16(offset + Hudelem.width, Width);
Hudelem.PS3.SetMemory((offset + Hudelem.moveTime) + 4, ReverseBytes(BitConverter.GetBytes(sort)));
Hudelem.PS3.SetMemory(offset + Hudelem.xOffset, ToHexFloat(x));
Hudelem.PS3.SetMemory(offset + Hudelem.yOffset, ToHexFloat(y));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(r, g, b, a));
Hudelem.PS3.SetMemory(offset + Hudelem.clientOffset, buffer);
}

public static void StoreTextElem(int elemIndex, int client, string Text, short font, double fontScale, float x, float y, uint align, int sort, int R, int G, int B, int A)
{
uint offset = Offset.G_HudElems + (Convert.ToUInt32(elemIndex) * 0x8Cool Man (aka Tustin);
byte[] buffer = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
Hudelem.PS3.SetMemory(offset, new byte[0x88]);
Hudelem.PS3.SetMemory(offset + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
Hudelem.PS3.SetMemory(offset + 0x79, new byte[] { 0xff });
Hudelem.PS3.SetMemory(offset + Hudelem.fontScale, new byte[] { 0x3f, 0xc0 });
Hudelem.PS3.Extension.WriteInt32(offset + Hudelem.text, G_LocalizedStringIndex(Text));
Hudelem.PS3.Extension.WriteFloat(offset + Hudelem.fontScale, (float)fontScale);
Hudelem.PS3.Extension.WriteInt16(offset + 0x70, font);
Hudelem.PS3.SetMemory(offset + 0x70, new byte[] { 1 });
Hudelem.PS3.SetMemory(offset + Hudelem.xOffset, ToHexFloat(x));
Hudelem.PS3.SetMemory(offset + Hudelem.yOffset, ToHexFloat(y));
Hudelem.PS3.SetMemory(offset + Hudelem.color, RGBA(R, G, B, A));
Hudelem.PS3.SetMemory(offset + Hudelem.clientOffset, buffer);
Hudelem.PS3.Extension.WriteByte(offset + Hudelem.flags, 1);
}

public static byte[] ToHexFloat(float Axis)
{
byte[] bytes = BitConverter.GetBytes(Axis);
Array.Reverse(bytes);
return bytes;
}

public static void ZigZagText(uint elemIndex, short Speed)
{
uint num = Offset.G_HudElems + (elemIndex * 0x8Cool Man (aka Tustin);
float num2 = 0f;
Hudelem.PS3.SetMemory(num + Hudelem.xOffset, ToHexFloat(-400f));
while (true)
{
float num4;
float num5;
float num3 = Hudelem.PS3.Extension.ReadFloat(num + Hudelem.xOffset);
if (num2 == 480f)
{
return;
}
switch (0)
{
case -400:
num4 = num2 += 120f;
num5 = 800f;
MoveOverTime(elemIndex, Speed, num5, num4);
break;

case 800:
num4 = num2 += 120f;
num5 = -400f;
MoveOverTime(elemIndex, Speed, num5, num4);
break;
}
Thread.Sleep(Speed);
}
}

public static class HudAlloc
{
public static uint g_hudelem = Offset.G_HudElems;
public static uint IndexSlot = 50;
}

public class HudStruct
{
public static uint abilityFlag = 0x84;
public static uint alignOrg = 0x72;
public static uint alignScreen = 0x73;
public static uint clientOffset = 0x7c;
public static uint color = 0x18;
public static uint duration = 0x38;
public static uint fadeStartTime = 0x20;
public static uint fadeTime = 0x54;
public static uint flag2 = 0x7a;
public static uint flags = 0x4c;
public static uint Font = 0x71;
public static uint fontScaleStartTime = 20;
public static uint fontScaleTime = 0x52;
public static uint FontSize = 12;
public static uint fromAlignOrg = 0x76;
public static uint fromAlignScreen = 0x77;
public static uint fromColor = 0x1c;
public static uint fromFontScale = 0x10;
public static uint fromHeight = 0x5e;
public static uint fromWidth = 0x5c;
public static uint fromX = 40;
public static uint fromY = 0x2c;
public static uint fxBirthTime = 0x48;
public static uint fxDecayDuration = 0x6a;
public static uint fxDecayStartTime = 0x68;
public static uint fxLetterTime = 0x66;
public static uint fxRedactDecayDuration = 110;
public static uint fxRedactDecayStartTime = 0x6c;
public static uint G_Hudelems = BlackOps2Tool1._18.Offset.G_HudElems;
public static uint glowColor = 0x44;
public static uint Height = 90;
public static uint IndexSize = 0x88;
public static uint label = 0x56;
public static uint materialIndex = 0x74;
public static uint moveStartTime = 0x30;
public static uint moveTime = 0x62;
public static uint offscreenMaterialIndex = 0x75;
public static uint scaleStartTime = 0x24;
public static uint scaleTime = 0x60;
public static uint sort = 0x40;
public static uint soundID = 120;
public static uint targetEntNum = 80;
public static uint team = 0x80;
public static uint text = 100;
public static uint time = 0x34;
public static uint type = 0x70;
public static uint ui3dWindow = 0x79;
public static uint value = 60;
public static uint Width = 0x58;
public static uint X = 0;
public static uint Y = 4;
public static uint Z = 8;

public class Align
{
public static uint BOTTOM_CENTER = 0x9a;
public static uint BOTTOM_LEFT = 0x8a;
public static uint BOTTOM_RIGHT = 170;
public static uint CENTER_LEFT = 130;
public static uint CENTER_MIDDLE = 0x92;
public static uint CENTER_RIGHT = 0xa2;
public static uint TOP_CENTERED = 120;
public static uint TOP_LEFT = 0x88;
public static uint TOP_RIGHT = 0xa8;
}

public class Typewriter
{
public static uint Classic = 0x4000;
public static uint Normal = 0x800;
}
}

public class ObjStruct
{
public static uint MaterialIndex = 0x1c;
public static uint ObjectiveIndex = 0x1608194;
public static uint ObjectiveIndexLength = 0x30;
public static uint Origin = 4;
public static uint State = 40;
public static uint targetEntNum = 0x10;
public static uint Team = 0x2d;
public static uint X = 4;
public static uint Y = 8;
public static uint Z = 12;
}
}
}
}



Class #2 = Offset

    using System;

namespace BlackOps2Tool1._18
{
internal class Offset
{
public static uint AllowPrecache = (level_locals_t + 0x40);
public static uint ButtonMonitoring = 0x1783da4;
public static uint Cbuf_AddText = 0x313e88;
public static uint CheatProtection = 0x3dbf70;
public static uint cl_ingame = 0x1cb68e8;
public static uint client_s = 0x1bb6cc0;
public static uint ClientAngles = 0x56bc;
public static uint ClientName = 0x178646c;
public static uint ClientOrigin = 40;
public static uint ClientTeam = 0x5504;
public static uint ClientVelocity = 0x34;
public static uint ClientWeapIndex = 440;
public static uint EntAngles = 320;
public static uint EntModelIndex = 0x16c;
public static uint EntOrigin = 0x134;
public static uint FPS = 0x3979ec;
public static uint FreezeClient = 0x17865bf;
public static uint G_AddEvent = 0x279950;
public static uint G_Client = 0x1780f28;
public static uint G_ClientSize = 0x5808;
public static uint G_Entity = 0x16b9f20;
public static uint G_EntitySize = 0x31c;
public static uint G_EntLink = 0x2ad440;
public static uint G_EntUnlink = 0x2ad5c0;
public static uint G_GetPlayerViewOrigin = 0x1e60d0;
public static uint G_GivePlayerWeapon = 0x2a8364;
public static uint G_HudElems = 0x15ddb00;
public static uint G_InitializeAmmo = 0x1e6838;
public static uint G_LocalizedStringIndex = 0x275d24;
public static uint G_LocationalTrace = 0x35c5a8;
public static uint G_MaterialIndex = 0x276020;
public static uint G_ModelIndex = 0x276180;
public static uint G_SetModel = 0x277644;
public static uint G_SetOrigin = 0x279698;
public static uint G_Spawn = 0x278c60;
public static uint G_SpawnHelicopter = 0x22c558;
public static uint G_SpawnTurret = 0x2ba5c8;
public static uint G_TempEntity = 0x279740;
public static uint HeadsUpDisplay = 0x1783f3f;
public static uint HudelemSize = 0x88;
public static uint InGameName = 0x178646c;
public static uint level_locals_t = 0x1608100;
public static uint LevelTime = (level_locals_t + 0x79Cool Man (aka Tustin);
public static uint Player_Die = 0x1fd510;
public static uint PlayerName = 0x178646c;
public static uint RPC = 0x7aa1e0;
public static uint RPCFix = 0x7aa1e0;
public static uint Scr_PlayerKilled = 0x248f20;
public static uint ScriptEntCmdGetCommandTimes = 0x267208;
public static uint ScriptMover_SetupMove = 0x268a38;
public static uint setClientViewAngles = 0x1e1d90;
public static uint SetClientViewAngles = 0x1e1d90;
public static uint SP_Script_Model = 0x2670e8;
public static uint SP_Turret = 0x2bae58;
public static uint SV_GameSendServerCommand = 0x34a1dc;
public static uint SV_LinkEntity = 0x359c00;
public static uint TeleportOffset = 0x1780f50;
public static uint Trace_GetEntityHitID = 0x306f30;
}
}



You will need roughly 16 NumericUpDown's and labels to correspond, a button in addition to a textbox. It should look as so:

You must login or register to view this content.

In the 'Spawn Text' Button the code should be written out as so:

     Hudelem.HUD.doTypeWriter((uint)numericUpDownX.Value, (int)AllClientHUD, metroTextBoxX.Text, (short)numericUpDownX.Value, (double)numericUpDownX.Value, (float)numericUpDownX.Value, (float)numericUpDownX.Value, (ushort)numericUpDownX.Value, (ushort)numericUpDownX.Value, (ushort)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value, (int)numericUpDownX.Value);


Also, there is a nice little trick to find out what function should come after another, if you can't seem to figure out which order the colors and decay's go in. If you simply remove a comma and add it back, you should see the entire function pop up and from there, you can find out which goes next.

Heres what it should look like: You must login or register to view this content.

Of course these functions can more than likely be written out in a different way, but if you use this, be sure to credit me, Omniscience and Shark for the Classes.


where the f**k is RPC And Functions Code??

The following user thanked xSyntheticPatch for this useful post:

saudxd9
07-06-2014, 07:07 AM #23
Originally posted by Omniscience View Post
thats why i said when you started modding/coding, i know that isnt hard to understand once you have learned it. Bailey dont argue with me right now


I was just saying, it tells you everything to do once you put the bracket...
07-06-2014, 06:31 PM #24
Dacoco
I void warranties.
Originally posted by UnknownNightmar View Post
I was just saying, it tells you everything to do once you put the bracket...


I know that, but i didnt know that when i was a noob, chances are most other people didnt either
07-09-2014, 07:10 AM #25
Dacoco
I void warranties.
Originally posted by UnknownNightmar View Post
I was just saying, it tells you everything to do once you put the bracket...


when is a bracket used in that?
07-09-2014, 08:24 AM #26
Originally posted by Omniscience View Post
when is a bracket used in that?

You must login or register to view this content. That is a bracket.... Right after you put setTypeWriter, you opened it witha bracket like this "setTypeWriter(" << You open it with a bracket, code, close bracket, and end the code with ";"
07-09-2014, 08:24 PM #27
Dacoco
I void warranties.
Originally posted by UnknownNightmar View Post
You must login or register to view this content. That is a bracket.... Right after you put setTypeWriter, you opened it witha bracket like this "setTypeWriter(" << You open it with a bracket, code, close bracket, and end the code with ";"


those are parenthesis, this is a bracket [ ] this is a curly brace { } semicolon ;
07-09-2014, 10:16 PM #28
Originally posted by Omniscience View Post
those are parenthesis, this is a bracket [ ] this is a curly brace { } semicolon ;

Really, ohh... Sorry then...

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo