[C#] Key API 1.0

   (1 review)
Sign in to follow this  

About This File

Key.Bind - This function binds the key.

  • keycode - hexadecimal code of key.
  • keydown/keyup - true trigges on keydown, false triggers on keyup (bool)
  • handler - function-handler.
public class KeyTest: RAGE.Events.Script
{
  public KeyTest()
  {
    Key.Bind(Keys.VK_ESCAPE, true, () =>
    {
      // Code here
      return 1;
    });
  }
}

To bind multiple keys:

Key.Bind(new Keys[] { Keys.VK_T, Keys.VK_F6 }, true, ...)


Key.IsUp - Returns true if the key specified has been released. Otherwise, returns false.

  • keycode - code of the key (Keys.VK_T or 0x54)
private void Tick(List<Events.TickNametagData> nametags)
{
  if(Key.IsUp(0x62))
  {
    // NUMPAD2 up
  }
}

Key.IsDown - Returns true if the key specified is pressed. Otherwise, returns false.

  • keycode - code of the key
private void Tick(List<Events.TickNametagData> nametags)
{
  if(Key.IsDown(new int[] { 0x60, 0x61 }))
  {
    // NUMPAD0 & NUMPAD1 pressed.
  }
}

 




User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest

ragempdev

   1 of 5 members found this review helpful 1 / 5 members

why does it say the version is 0.3.5.1 . . . . . 

Share this review


Link to review