Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

value was either too large or too small c#

Featured Replies

Posted

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?
 

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.