From 8593547fecd8c13480a8d367f2c8ca45e39fb7c6 Mon Sep 17 00:00:00 2001 From: quaK <38787176+Joelrau@users.noreply.github.com> Date: Fri, 10 Mar 2023 18:37:09 +0200 Subject: [PATCH] dedi killserver --- src/client/component/dedicated.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index 19ec0f82..111ca62b 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -20,6 +20,15 @@ namespace dedicated { namespace { + utils::hook::detour com_quit_f_hook; + + void kill_server() + { + game::SV_MainMP_KillLocalServer(); + + com_quit_f_hook.invoke(); + } + std::vector& get_startup_command_queue() { static std::vector startup_command_queue; @@ -361,6 +370,12 @@ namespace dedicated console::set_title(utils::string::va("%s on %s", cleaned_hostname.data(), mapname->current.string)); }, scheduler::pipeline::main, 1s); + + scheduler::once([]() + { + command::add("killserver", kill_server); + com_quit_f_hook.create(game::Com_Quit_f, kill_server); + }, scheduler::server); } }; }