diff --git a/src/component/gsc.cpp b/src/component/gsc.cpp index ff56063..25ffa00 100644 --- a/src/component/gsc.cpp +++ b/src/component/gsc.cpp @@ -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); } diff --git a/src/game/structs.hpp b/src/game/structs.hpp index a4c5e14..a67cc97 100644 --- a/src/game/structs.hpp +++ b/src/game/structs.hpp @@ -327,4 +327,15 @@ namespace game int flags; char __pad2[0xEC]; }; + + struct client_s + { + char __pad0[0x41CB2]; + unsigned __int16 scriptId; // 269490 + int bIsTestClient; // 269492 + int serverId; // 269496 + char __pad1[0x369DC]; + }; + + static_assert(sizeof(client_s) == 0x78698); } \ No newline at end of file diff --git a/src/game/symbols.hpp b/src/game/symbols.hpp index 3a2116e..1b06746 100644 --- a/src/game/symbols.hpp +++ b/src/game/symbols.hpp @@ -79,6 +79,8 @@ namespace game WEAK symbol g_entities{0x1A66E28}; WEAK symbol levelEntityId{0x208E1A4}; + WEAK symbol svs_clients{0x4B5CF90}; + namespace plutonium { WEAK symbol> function_map_rev{0x20693038};