Advertisement
ScriptzMoDz

MW3 Solid Models/Stairway to Heaven [1.24]

Aug 23rd, 2014
827
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. /*This Community is really fucked, but i make my Release for People like: Mango_Knife, Seb, Bass_Haxor, xJoren :)
  2. Have Fun using this :)
  3.  
  4. Big Thanks to Seb5594 :) <3
  5.  
  6. CREDITS: http://www.nextgenupdate.com/forums/modern-warfare-3-mods-patches-tutorials/746787-c-spawn-solid-models-stairs-heaven.html
  7. xCSBKx [GMT]
  8. GMTPS3
  9.  
  10. https://www.youtube.com/watch?v=dBCfhgSXEiY
  11. */
  12. public static class Spawner
  13. {
  14. #region Read + Write
  15.  
  16. private static float[] ReadFloatLength(uint Offset, int Length)
  17. {
  18. byte[] buffer = new byte[Length * 4];
  19. PS3.GetMemory(Offset, buffer);
  20. ReverseBytes(buffer);
  21. float[] Array = new float[Length];
  22. for (int i = 0; i < Length; i++)
  23. {
  24. Array[i] = BitConverter.ToSingle(buffer, (Length - 1 - i) * 4);
  25. }
  26. return Array;
  27. }
  28.  
  29. private static void WriteByte(uint Offset, byte Byte)
  30. {
  31. byte[] buffer = new byte[1];
  32. buffer[0] = Byte;
  33. PS3.SetMemory(Offset, buffer);
  34. }
  35.  
  36. private static void WriteFloatArray(uint Offset, float[] Array)
  37. {
  38. byte[] buffer = new byte[Array.Length * 4];
  39. for (int Lenght = 0; Lenght < Array.Length; Lenght++)
  40. {
  41. ReverseBytes(BitConverter.GetBytes(Array[Lenght])).CopyTo(buffer, Lenght * 4);
  42. }
  43. PS3.SetMemory(Offset, buffer);
  44. }
  45.  
  46. private static void WriteInt(uint Offset, int Value)
  47. {
  48. PS3.SetMemory(Offset, ReverseBytes(BitConverter.GetBytes(Value)));
  49. }
  50.  
  51. private static byte[] ReverseBytes(byte[] inArray)
  52. {
  53. Array.Reverse(inArray);
  54. return inArray;
  55. }
  56.  
  57. #endregion
  58.  
  59. public enum Bush : uint//I will seach for these and Release them :)
  60. {
  61. CarePackage = 2,
  62. Bomb = 3,
  63. }
  64.  
  65. public static uint SolidModel(float[] Origin, float[] Angles, string Model = "com_plasticcase_friendly", Bush Index = Bush.CarePackage)
  66. {
  67. uint Entity = (uint)RPC.Call(0x01C058C);//G_Spawn
  68. WriteFloatArray(Entity + 0x138, Origin);//Position
  69. WriteFloatArray(Entity + 0x144, Angles);//Orientation
  70. RPC.Call(0x01BEF5C, Entity, Model);//G_SetModel
  71. RPC.Call(0x01B6F68, Entity); //SP_script_model
  72. RPC.Call(0x002377B8, Entity);//SV_UnlinkEntity
  73. WriteByte(Entity + 0x101, 4);
  74. WriteInt(Entity + 0x8C, (int)Index);
  75. RPC.Call(0x0022925C, Entity);//SV_SetBrushModel
  76. RPC.Call(0x00237848, Entity);//SV_LinkEntity
  77. return Entity;
  78. }
  79.  
  80. public static float[] GetOrigin(uint Client)
  81. {
  82. return ReadFloatLength(0x110a29c + (Client * 0x3980), 3);
  83. }
  84.  
  85. public static float[] GetAngles(uint Client)
  86. {
  87. return ReadFloatLength(0x110a3d8 + (Client * 0x3980), 3);
  88. }
  89.  
  90. public static float[] AnglesToForward(float[] Origin, float[] Angles, uint diff)
  91. {
  92. float num = ((float)Math.Sin((Angles[0] * Math.PI) / 180)) * diff;
  93. float num1 = (float)Math.Sqrt(((diff * diff) - (num * num)));
  94. float num2 = ((float)Math.Sin((Angles[1] * Math.PI) / 180)) * num1;
  95. float num3 = ((float)Math.Cos((Angles[1] * Math.PI) / 180)) * num1;
  96. return new float[] { Origin[0] + num3, Origin[1] + num2, Origin[2] - num };
  97. }
  98.  
  99. private static uint[] STHIndexes;
  100. public static void StairsToHeaven(uint Client, uint Stairs = 41, int Time = 200)//When you use STH you can Freeze dont make it to Fast 200 is Good time and dont to Much Staris 41 Stairs = 2 Rounds :)
  101. {
  102. uint[] Index = new uint[Stairs];
  103. float[] Origin = GetOrigin(Client);
  104. float[] Angles = new float[3];
  105. for (uint i = 0; i < Stairs; )
  106. {
  107. Index[i] = SolidModel(AnglesToForward(Origin, Angles, 60), Angles);
  108. Angles[1] += 18;
  109. Origin[2] += 10;
  110. i++;
  111. Thread.Sleep(Time);
  112. }
  113. STHIndexes = Index;
  114. }
  115.  
  116. public static void RemoveSTH()
  117. {
  118. for (uint i = 0; i < STHIndexes.Length; i++)
  119. PS3.SetMemory(STHIndexes[i], new byte[0x280]);
  120. }
  121. }
  122.  
  123. //Spawn a Create:
  124. uint Client = Put Client Number here!;
  125. float[] Origin = Spawner.AnglesToForward(Spawner.GetOrigin(Client), Spawner.GetAngles(Client),80);
  126. Origin[2] += 40;//
  127. Spawner.SolidModel(Origin, new float[] { 0, 0, 0 });
  128.  
  129. //Spawn the Stairs to Heaven:
  130. Spawner.StairsToHeaven(Put Client Number here!);
  131.  
  132. //Remove the STH:
  133. Spawner.RemoveSTH();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement