From 886dc8d95b6e429c4e5d3be55f38c0ca20db9a37 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Sat, 4 Mar 2023 09:41:56 +0100 Subject: [PATCH] add: keybind system, added it for fly can be used for anything, GetKey is to fix tho i tried using anyKeydown, no success --- DevourClient/MelonMain.cs | 13 +++++++++++-- DevourClient/Settings/Settings.cs | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/DevourClient/MelonMain.cs b/DevourClient/MelonMain.cs index f5054f1..298e9fd 100644 --- a/DevourClient/MelonMain.cs +++ b/DevourClient/MelonMain.cs @@ -76,7 +76,6 @@ namespace DevourClient try { Il2Cpp.GameUI gameUI = UnityEngine.Object.FindObjectOfType(); - if (Settings.Settings.menu_enable) { gameUI.HideMouseCursor(); @@ -130,6 +129,11 @@ namespace DevourClient Hacks.Misc.SetSteamName("patate"); } + if (Input.GetKeyDown(Settings.Settings.flyKey)) + { + fly = !fly; + } + if (fly && Player.IsInGameOrLobby()) { Hacks.Misc.Fly(fly_speed); @@ -872,7 +876,12 @@ namespace DevourClient _walkInLobby = GUI.Toggle(new Rect(Settings.Settings.x + 10, Settings.Settings.y + 330, 140, 30), _walkInLobby, "Walk In Lobby"); _IsAutoRespawn = GUI.Toggle(new Rect(Settings.Settings.x + 10, Settings.Settings.y + 360, 140, 30), _IsAutoRespawn, "Auto Respawn"); - fly = GUI.Toggle(new Rect(Settings.Settings.x + 10, Settings.Settings.y + 400, 150, 20), fly, "Fly"); + fly = GUI.Toggle(new Rect(Settings.Settings.x + 10, Settings.Settings.y + 400, 40, 20), fly, "Fly"); + if (GUI.Button(new Rect(Settings.Settings.x + 60, Settings.Settings.y + 400, 40, 20), Settings.Settings.flyKey.ToString())) + { + Settings.Settings.flyKey = Settings.Settings.GetKey(); + } + fly_speed = GUI.HorizontalSlider(new Rect(Settings.Settings.x + 10, Settings.Settings.y + 430, 100, 10), fly_speed, 5f, 20f); GUI.Label(new Rect(Settings.Settings.x + 120, Settings.Settings.y + 425, 100, 30), ((int)fly_speed).ToString()); diff --git a/DevourClient/Settings/Settings.cs b/DevourClient/Settings/Settings.cs index 121ba52..e6c81ea 100644 --- a/DevourClient/Settings/Settings.cs +++ b/DevourClient/Settings/Settings.cs @@ -14,5 +14,23 @@ namespace DevourClient.Settings public static Color azazel_esp_color = new Color(1.00f, 0.00f, 0.00f, 1); public static float speed = 1f; public const string message_to_spam = "Deez Nutz"; + public static KeyCode flyKey = KeyCode.None; + + public static KeyCode GetKey() + { + Thread.Sleep(50); //TOFIX tried using anyKeydown, no success + foreach (KeyCode vkey in System.Enum.GetValues(typeof(KeyCode))) + { + if (Input.GetKey(vkey)) + { + if (vkey != KeyCode.Delete) + { + return vkey; + } + } + } + + return KeyCode.None; + } } }