move check if ESCAPE to ItemVariable, didn't work in CKeyInput

This commit is contained in:
LIghty 2018-03-20 16:58:44 +01:00
parent 5f73829bb9
commit 3befee0f6f
2 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,9 @@
#include "common.hpp"
#include "sdk.hpp"
CatVar var0(CV_SWITCH, "var0", "0", "Enable Aimbot",
"Main aimbot switch");
CKeyInput::CKeyInput(std::string name, IWidget* parent) : CBaseWidget(name, parent) {
Props()->SetInt("value", 0);
Props()->SetBool("capturing", false);
@ -62,7 +65,6 @@ bool CKeyInput::ConsumesKey(ButtonCode_t key) {
void CKeyInput::OnKeyPress(ButtonCode_t key, bool repeat) {
if (Props()->GetBool("capturing")) {
if (key == KEY_ESCAPE) key = (ButtonCode_t)0;
SetValue(key);
if (m_pCallback) m_pCallback(this, key);
Props()->SetBool("capturing", false);

View File

@ -60,6 +60,8 @@ void ItemVariable::OnFocusLose() {
void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat) {
if (capturing) {
if (key == 70)
key = (ButtonCode_t)0;
catvar = (int)key;
capturing = false;
return;