diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index e02bade7..2839858a 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -2,6 +2,10 @@ #include "loader/component_loader.hpp" #include "game/game.hpp" +#include "command.hpp" +#include "network.hpp" +#include "scheduler.hpp" +#include "server_list.hpp" #include @@ -13,6 +17,15 @@ namespace dedicated { game::SV_SendServerCommand(cl_0, type, "%c \"GAME_SERVER\x15: %s\"", 79, text); } + + void send_heartbeat() + { + game::netadr_t target{}; + if (server_list::get_master_server(target)) + { + network::send(target, "heartbeat", "T7"); + } + } } struct component final : server_component @@ -25,6 +38,10 @@ namespace dedicated // Fix tell command for IW4M utils::hook::call(0x14052A8CF_g, sv_con_tell_f_stub); + + scheduler::once(send_heartbeat, scheduler::pipeline::server); + scheduler::loop(send_heartbeat, scheduler::pipeline::server, 10min); + command::add("heartbeat", send_heartbeat); } }; }