diff --git a/src/Components/Modules/RCon.cpp b/src/Components/Modules/RCon.cpp index 1ab6fc59..8d506708 100644 --- a/src/Components/Modules/RCon.cpp +++ b/src/Components/Modules/RCon.cpp @@ -7,6 +7,9 @@ namespace Components std::string RCon::Password; + Dvar::Var RCon::RconPassword; + Dvar::Var RCon::RconLogRequests; + RCon::RCon() { Command::Add("rcon", [](Command::Params* params) @@ -75,8 +78,8 @@ namespace Components Dvar::OnInit([]() { - Dvar::Register("rcon_password", "", Game::dvar_flag::DVAR_FLAG_NONE, "The password for rcon"); - Dvar::Register("log_rcon_requests", false, Game::dvar_flag::DVAR_FLAG_NONE, "Print remote commands in the output log"); + RCon::RconPassword = Dvar::Register("rcon_password", "", Game::dvar_flag::DVAR_FLAG_NONE, "The password for rcon"); + RCon::RconLogRequests = Dvar::Register("rcon_log_requests", false, Game::dvar_flag::DVAR_FLAG_NONE, "Print remote commands in the output log"); }); Network::Handle("rcon", [](Network::Address address, const std::string& _data) @@ -100,7 +103,7 @@ namespace Components password.erase(password.begin()); } - std::string svPassword = Dvar::Var("rcon_password").get(); + const std::string svPassword = RCon::RconPassword.get(); if (svPassword.empty()) { @@ -114,7 +117,7 @@ namespace Components outputBuffer.clear(); #ifndef DEBUG - if (Dvar::Var("log_rcon_requests").get()) + if (RCon::RconLogRequests.get()) #endif { Logger::Print("Executing RCon request from %s: %s\n", address.getCString(), command.data()); diff --git a/src/Components/Modules/RCon.hpp b/src/Components/Modules/RCon.hpp index 1cc486e5..b5ec83cd 100644 --- a/src/Components/Modules/RCon.hpp +++ b/src/Components/Modules/RCon.hpp @@ -25,5 +25,8 @@ namespace Components // For sr0's fucking rcon command // Son of a bitch! Annoying me day and night with that shit... static std::string Password; + + static Dvar::Var RconPassword; + static Dvar::Var RconLogRequests; }; }