From 234f510e983235305b530565b89b80f629902c3e Mon Sep 17 00:00:00 2001 From: FutureRave Date: Sun, 7 Nov 2021 00:04:31 +0000 Subject: [PATCH] [GSC] Add infinite sprint --- deps/GSL | 2 +- src/component/gsc.cpp | 19 +++++++++++++++++++ src/game/structs.hpp | 15 +++++++++++++++ src/game/symbols.hpp | 2 +- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/deps/GSL b/deps/GSL index c1cbb41..c31a9ad 160000 --- a/deps/GSL +++ b/deps/GSL @@ -1 +1 @@ -Subproject commit c1cbb41b428f15e53454682a45f03ea31f1da0a7 +Subproject commit c31a9ad5e8e99da8567237a7ba51a7d8f419e5bf diff --git a/src/component/gsc.cpp b/src/component/gsc.cpp index 6b30e65..a20ff3f 100644 --- a/src/component/gsc.cpp +++ b/src/component/gsc.cpp @@ -343,6 +343,25 @@ namespace gsc return {}; }); + method::add("specialtymarathon", [](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 num = ent.entnum; + const auto toggle = args[0].as(); + + auto g_client = game::g_entities[num].client; + auto playerState = &g_client->ps; + auto flags = playerState->perks[0]; + + playerState->perks[0] = toggle + ? flags | 0x4000u + : flags & ~0x4000u; + }); + utils::hook::jump(0x56C8EB, call_builtin_stub); utils::hook::jump(0x56CBDC, call_builtin_method_stub); utils::hook::jump(0x56B726, vm_execute_stub); diff --git a/src/game/structs.hpp b/src/game/structs.hpp index 5a40ecc..ce95cef 100644 --- a/src/game/structs.hpp +++ b/src/game/structs.hpp @@ -303,8 +303,23 @@ namespace game dvar_t* hashNext; }; + struct playerState_s + { + char __pad0[1260]; + unsigned int perks[2]; + unsigned int perkSlots[9]; + char __pad1[11752]; + }; + + struct gclient_s + { + playerState_s ps; + }; + struct gentity_s { int entnum; + char __pad0[340]; + gclient_s* client; }; } \ No newline at end of file diff --git a/src/game/symbols.hpp b/src/game/symbols.hpp index b393ff6..71768e1 100644 --- a/src/game/symbols.hpp +++ b/src/game/symbols.hpp @@ -74,7 +74,7 @@ namespace game WEAK symbol g_classMap{0x8B4300}; - WEAK symbol g_entities{0x0}; + WEAK symbol g_entities{0x1A66E28}; WEAK symbol levelEntityId{0x208E1A4}; namespace plutonium