Posted September 8, 20177 yr I am having a problem with a code, with the following message value was either too large or too small for an unsigned byte. code is private static void ByteWrite(IntPtr address, byte[] bytes) { int lpNumberOfBytesWritten = 2; Player.WriteProcessMemory((int) Proc.Handle, address, bytes, bytes.Length, ref lpNumberOfBytesWritten); } public static void UsarItem(int Slot) { Player.ByteWrite(new IntPtr(7875792), new byte[32] { (byte) 36, (byte) 0, (byte) 0, (byte) 0, (byte) 115, (byte) 3, Player.ClientID[0], Player.ClientID[1], (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 0, (byte) 0, (byte) 0, Convert.ToByte(Slot), (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, Player.IntToArrayByte(Player.Loc.X)[0], Player.IntToArrayByte(Player.Loc.X)[1], Player.IntToArrayByte(Player.Loc.Y)[0], Player.IntToArrayByte(Player.Loc.Y)[1] }); Player.SendPacket((byte) 36); Thread.Sleep(100); Could someone give me some help?
September 9, 20177 yr The error is easy to understand, if you try to cast an int to a byte you must make sure the int is within this range 0..255 , if the int is outside this range then an exception will be thrown.
Create an account or sign in to comment