Add isBot function

This commit is contained in:
2022-01-06 22:04:19 +01:00
parent 31920b0692
commit d5c0063fee
3 changed files with 29 additions and 0 deletions

View File

@ -416,6 +416,22 @@ namespace gsc
return {};
});
method::add("isbot", [](const game::scr_entref_t ent, const function_args& args) -> scripting::script_value
{
if (ent.classnum != 0)
{
throw std::runtime_error("Invalid entity");
}
const auto client = ent.entnum;
if (game::g_entities[client].client == nullptr)
{
throw std::runtime_error("entity is not a player");
}
return game::svs_clients[client].bIsTestClient;
});
utils::hook::jump(0x56C8EB, call_builtin_stub);
utils::hook::jump(0x56CBDC, call_builtin_method_stub);
}