diff --git a/src/client/game/scripting/lua/context.cpp b/src/client/game/scripting/lua/context.cpp index 14e16d7..716bb76 100644 --- a/src/client/game/scripting/lua/context.cpp +++ b/src/client/game/scripting/lua/context.cpp @@ -11,6 +11,8 @@ #include +namespace _game = game; + namespace scripting::lua { namespace @@ -259,6 +261,19 @@ namespace scripting::lua { logfile::add_player_killed_callback(callback); }; + + game_type["getgamevar"] = [](const sol::this_state s) + { + const auto id = *reinterpret_cast(0x14815DEB4); + + const auto value = _game::scr_VarGlob->childVariableValue[id]; + + _game::VariableValue variable{}; + variable.type = value.type; + variable.u.uintValue = value.u.u.uintValue; + + return convert(s, variable); + }; } }