CMHDev

[C#] 0.3.7 Metoda Key Bind

Recommended Posts

 public class KeysManager : RAGE.Events.Script
    {
        private static bool _keyStatus = true;

        private const int KeyMouse = 0xC0;    //    Tasta [~]
   
        public KeysManager()
        {
            RAGE.Events.Tick = TickEvent;
        }

        private static void TickEvent(List<RAGE.Events.TickNametagData> nametags)
        {     
            if (Input.IsDown(KeyMouse) && _keyStatus) // Activam / Dezactivam cusor mouse.
            {
                if (_keyStatus)
                {
                    Cursor.Visible = !Cursor.Visible;
                    ResetKeyStatus();
                }
            }
        }

        private static void ResetKeyStatus()
        {
            _keyStatus = false;
            Task.Delay(250).ContinueWith((task) => { _keyStatus = true; });
        }

In 0.3.7 Key Bind nu exista si acest cod este o metoda de a implementa oarecum aceastra functie.

Edited by CMHDev
  • Like 1
  • Mask 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

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

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

  • Recently Browsing   0 members

    No registered users viewing this page.