ScriptzMoDz

BO1 RPC

Aug 25th, 2014
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.87 KB | None | 0 0
  1. public static class RPC
  2.     {
  3.         public static UInt32 function_address = 0x7A21E0; //MP = 0x7A21E0  ||  ZM = 0x6E34E0
  4.  
  5.         public static void Enable_RPC()
  6.         {
  7.             PS3.SetMemory(function_address, new byte[] { 0x4e, 0x80, 0, 0x20 });
  8.             System.Threading.Thread.Sleep(20);
  9.             byte[] memory = new byte[] {
  10.             0x7c, 8, 2, 0xa6, 0xf8, 1, 0, 0x80, 60, 0x60, 0x10, 5, 0x81, 0x83, 0, 0x4c,
  11.             0x2c, 12, 0, 0, 0x41, 130, 0, 100, 0x80, 0x83, 0, 4, 0x80, 0xa3, 0, 8,
  12.             0x80, 0xc3, 0, 12, 0x80, 0xe3, 0, 0x10, 0x81, 3, 0, 20, 0x81, 0x23, 0, 0x18,
  13.             0x81, 0x43, 0, 0x1c, 0x81, 0x63, 0, 0x20, 0xc0, 0x23, 0, 0x24, 0xc0, 0x43, 0, 40,
  14.             0xc0, 0x63, 0, 0x2c, 0xc0, 0x83, 0, 0x30, 0xc0, 0xa3, 0, 0x34, 0xc0, 0xc3, 0, 0x38,
  15.             0xc0, 0xe3, 0, 60, 0xc1, 3, 0, 0x40, 0xc1, 0x23, 0, 0x48, 0x80, 0x63, 0, 0,
  16.             0x7d, 0x89, 3, 0xa6, 0x4e, 0x80, 4, 0x21, 60, 0x80, 0x10, 5, 0x38, 160, 0, 0,
  17.             0x90, 0xa4, 0, 0x4c, 0x90, 100, 0, 80, 0xe8, 1, 0, 0x80, 0x7c, 8, 3, 0xa6,
  18.             0x38, 0x21, 0, 0x70, 0x4e, 0x80, 0, 0x20
  19.          };
  20.             PS3.SetMemory(function_address + 4, memory);
  21.             PS3.SetMemory(0x10050000, new byte[0x2854]);
  22.             PS3.SetMemory(function_address, new byte[] { 0xf8, 0x21, 0xff, 0x91 });
  23.         }
  24.  
  25.         public static uint Call(uint func_address, params object[] parameters)
  26.         {
  27.             int length = parameters.Length;
  28.             uint num2 = 0;
  29.             for (uint i = 0; i < length; i++)
  30.             {
  31.                 if (parameters[i] is int)
  32.                 {
  33.                     byte[] array = BitConverter.GetBytes((int)parameters[i]);
  34.                     Array.Reverse(array);
  35.                     PS3.SetMemory(0x10050000 + ((i + num2) * 4), array);
  36.                 }
  37.                 else if (parameters[i] is uint)
  38.                 {
  39.                     byte[] buffer2 = BitConverter.GetBytes((uint)parameters[i]);
  40.                     Array.Reverse(buffer2);
  41.                     PS3.SetMemory(0x10050000 + ((i + num2) * 4), buffer2);
  42.                 }
  43.                 else if (parameters[i] is string)
  44.                 {
  45.                     byte[] buffer3 = Encoding.UTF8.GetBytes(Convert.ToString(parameters[i]) + "\0");
  46.                     PS3.SetMemory(0x10050054 + (i * 0x400), buffer3);
  47.                     uint num4 = 0x10050054 + (i * 0x400);
  48.                     byte[] buffer4 = BitConverter.GetBytes(num4);
  49.                     Array.Reverse(buffer4);
  50.                     PS3.SetMemory(0x10050000 + ((i + num2) * 4), buffer4);
  51.                 }
  52.                 else if (parameters[i] is float)
  53.                 {
  54.                     num2++;
  55.                     byte[] buffer5 = BitConverter.GetBytes((float)parameters[i]);
  56.                     Array.Reverse(buffer5);
  57.                     PS3.SetMemory(0x10050024 + ((num2 - 1) * 4), buffer5);
  58.                 }
  59.             }
  60.             byte[] bytes = BitConverter.GetBytes(func_address);
  61.             Array.Reverse(bytes);
  62.             PS3.SetMemory(0x1005004c, bytes);
  63.             System.Threading.Thread.Sleep(20);
  64.             byte[] memory = new byte[4];
  65.             PS3.GetMemory(0x10050050, memory);
  66.             Array.Reverse(memory);
  67.             return BitConverter.ToUInt32(memory, 0);
  68.         }
  69.  
  70.         public static void SV_GameSendServerCommad(Int32 client, Int32 Type, String command)
  71.         {
  72.             RPC1.Call(0x003E95F0, new Object[] { client, Type, command }); //MP = 0x003E95F0  ||  ZM = 0x003C33A8
  73.         }
  74.  
  75.         public static void iPrintln(Int32 ClientNum, String Message)
  76.         {
  77.             SV_GameSendServerCommad(ClientNum, 0, "f \"" + Message + "\"");
  78.         }
  79.  
  80.         public static void iPrintlnBold(Int32 ClientNum, String Message)
  81.         {
  82.             SV_GameSendServerCommad(ClientNum, 0, "c \"" + Message + "\"");
  83.         }
  84.     }
Add Comment
Please, Sign In to add comment