diff --git a/include/TConsole.h b/include/TConsole.h index 9996c3e..25cd396 100644 --- a/include/TConsole.h +++ b/include/TConsole.h @@ -37,6 +37,7 @@ private: void Command_Settings(const std::string& cmd, const std::vector& args); void Command_Clear(const std::string&, const std::vector& args); void Command_Debug(const std::string&, const std::vector& args); + void Command_Version(const std::string&, const std::vector& args); void Autocomplete_Lua(const std::string&, std::vector& suggestions); void Autocomplete_Kick(const std::string&, std::vector& suggestions); @@ -58,6 +59,7 @@ private: { "settings", [this](const auto& a, const auto& b) { Command_Settings(a, b); } }, { "clear", [this](const auto& a, const auto& b) { Command_Clear(a, b); } }, { "debug", [this](const auto& a, const auto& b) { Command_Debug(a, b); } }, + { "version", [this](const auto& a, const auto& b) { Command_Version(a, b); } }, { "say", [this](const auto&, const auto&) { Command_Say(""); } }, // shouldn't actually be called }; diff --git a/src/TConsole.cpp b/src/TConsole.cpp index 9a897e9..4cd7b1e 100644 --- a/src/TConsole.cpp +++ b/src/TConsole.cpp @@ -262,7 +262,8 @@ void TConsole::Command_Help(const std::string&, const std::vector& settings [command] sets or gets settings for the server, run `settings help` for more info status how the server is doing and what it's up to debug internal error and debug state of the server (for development) - clear clears the console window)"; + clear clears the console window + version version info)"; Application::Console().WriteRaw("BeamMP-Server Console: " + std::string(sHelpString)); } @@ -370,6 +371,13 @@ void TConsole::Command_Debug(const std::string&, const std::vector& }); } +void TConsole::Command_Version(const std::string&, const std::vector& args) { + if (!EnsureArgsCount(args, 0)) { + return; + } + Application::Console().WriteRaw(fmt::format("BeamMP Server v{} ({})", Application::ServerVersionString(), BEAMMP_GIT_HASH)); +} + void TConsole::Command_Kick(const std::string&, const std::vector& args) { if (!EnsureArgsCount(args, 1, size_t(-1))) { return; @@ -681,7 +689,6 @@ void TConsole::Autocomplete_Kick(const std::string& stub, std::vector& suggestions) { @@ -690,7 +697,8 @@ void TConsole::Autocomplete_Settings(const std::string& stub, std::vector