diff --git a/src/client/component/bots.cpp b/src/client/component/bots.cpp index 6d99ecf8..23ca2bc5 100644 --- a/src/client/component/bots.cpp +++ b/src/client/component/bots.cpp @@ -8,6 +8,7 @@ #include #include +#include "getinfo.hpp" namespace bots { @@ -126,6 +127,11 @@ namespace bots command::add("spawnBot", [](const command::params& params) { + if (!getinfo::is_host()) + { + return; + } + size_t count = 1; if (params.size() > 1) { diff --git a/src/client/component/getinfo.cpp b/src/client/component/getinfo.cpp index 0a8d92fb..5fcda151 100644 --- a/src/client/component/getinfo.cpp +++ b/src/client/component/getinfo.cpp @@ -78,6 +78,17 @@ namespace getinfo return (rand() % 2) + 1; } + bool is_host() + { + if (game::is_server()) + { + return true; + } + + const auto client_states = *reinterpret_cast(0x1576FB318_g); + return client_states == 0; + } + struct component final : generic_component { void post_unpack() override diff --git a/src/client/component/getinfo.hpp b/src/client/component/getinfo.hpp index 7d016ffa..5d9d14be 100644 --- a/src/client/component/getinfo.hpp +++ b/src/client/component/getinfo.hpp @@ -5,4 +5,5 @@ namespace getinfo int get_max_client_count(); int get_client_count(); int get_bot_count(); + bool is_host(); }