Jump to content

[C#] Key API 1.0

   (2 reviews)

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

Create an account or sign in to leave a review

You need to be a member in order to leave a review

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

ragempdev

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

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

Link to review
×
×
  • Create New...