diff --git a/include/core/offsets.hpp b/include/core/offsets.hpp index 08d7d70c..d7c1153d 100644 --- a/include/core/offsets.hpp +++ b/include/core/offsets.hpp @@ -180,4 +180,8 @@ struct offsets { return PlatformOffset(77, undefined, 77); } + static constexpr uint32_t RegisterFileWhitelist() + { + return PlatformOffset(94, undefined, undefined); + } }; diff --git a/src/hacks/AntiAntiAim.cpp b/src/hacks/AntiAntiAim.cpp index 388a37e6..dc5d4acc 100644 --- a/src/hacks/AntiAntiAim.cpp +++ b/src/hacks/AntiAntiAim.cpp @@ -15,7 +15,7 @@ void hacks::shared::anti_anti_aim::createMove() return; IClientEntity *entity{ nullptr }; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { resolveEnt(i, entity); } diff --git a/src/hacks/AntiCheat.cpp b/src/hacks/AntiCheat.cpp index 2cc634c1..7d47aeea 100644 --- a/src/hacks/AntiCheat.cpp +++ b/src/hacks/AntiCheat.cpp @@ -52,7 +52,7 @@ void CreateMove() return; angles::Update(); ac::aimbot::player_orgs().clear(); - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { if (skip_local && (i == g_IEngine->GetLocalPlayer())) continue; diff --git a/src/hacks/AntiDisguise.cpp b/src/hacks/AntiDisguise.cpp index ec457721..8c732b0a 100644 --- a/src/hacks/AntiDisguise.cpp +++ b/src/hacks/AntiDisguise.cpp @@ -20,7 +20,7 @@ void Draw() if (!*enable && !*no_invisibility) return; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { ent = ENTITY(i); if (CE_BAD(ent) || ent == LOCAL_E || ent->m_Type() != ENTITY_PLAYER || CE_INT(ent, netvar.iClass) != tf_class::tf_spy) diff --git a/src/hacks/AutoBackstab.cpp b/src/hacks/AutoBackstab.cpp index d554e270..51a9a404 100644 --- a/src/hacks/AutoBackstab.cpp +++ b/src/hacks/AutoBackstab.cpp @@ -126,6 +126,11 @@ static void doBacktrackStab() continue; Vector &min = btp.collidable.min; Vector &max = btp.collidable.max; + // Shrink by 5% + min.x += (max.x - min.x) / 100.0f * 5.0f; + max.x -= (max.x - min.x) / 100.0f * 5.0f; + min.y += (max.y - min.y) / 100.0f * 5.0f; + max.y -= (max.y - min.y) / 100.0f * 5.0f; Vector hit; if (hacks::shared::triggerbot::CheckLineBox(min, max, g_pLocalPlayer->v_Eye, GetForwardVector(g_pLocalPlayer->v_Eye, newangle, swingrange), hit)) { diff --git a/src/hacks/AutoHeal.cpp b/src/hacks/AutoHeal.cpp index d2506540..c41c26aa 100644 --- a/src/hacks/AutoHeal.cpp +++ b/src/hacks/AutoHeal.cpp @@ -81,7 +81,7 @@ int BulletDangerValue(CachedEntity *patient) return 0; bool any_zoomed_snipers = false; // Find dangerous snipers in other team - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent)) @@ -126,7 +126,7 @@ int FireDangerValue(CachedEntity *patient) uint8_t should_switch = 0; if (auto_vacc_pop_if_pyro) { - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent)) @@ -525,7 +525,7 @@ int BestTarget() int best_score = INT_MIN; if (steamid_only) return best; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { int score = HealingPriority(i); if (score > best_score && score != -1) @@ -577,7 +577,7 @@ void CreateMove() } else if (steamid) { - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent) || !ent->player_info.friendsID) @@ -601,7 +601,7 @@ void CreateMove() } if (current_id != steamid) { - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent) || !ent->player_info.friendsID) diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index e4ea0dae..3ecae7b6 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -116,7 +116,7 @@ static void Run() // Fill backtrack data (stored in headPositions) { PROF_SECTION(cm_bt_ent_loop) - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *pEntity = ENTITY(i); if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer()) @@ -222,7 +222,7 @@ static void Draw() return; // :b:ones for non drawable ents if (draw_skeleton) - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent) || !ent->m_bAlivePlayer() || i == g_IEngine->GetLocalPlayer()) @@ -249,7 +249,7 @@ static void Draw() } if (!draw_bt) return; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent)) @@ -376,7 +376,7 @@ std::pair getBestEntBestTick() if (GetWeaponMode() == weapon_melee) { float bestDist = 9999.0f; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *tar = ENTITY(i); if (CE_GOOD(tar)) @@ -406,7 +406,7 @@ std::pair getBestEntBestTick() else { float bestFov = 180.0f; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *tar = ENTITY(i); if (CE_GOOD(tar)) diff --git a/src/hacks/CatBot.cpp b/src/hacks/CatBot.cpp index 99b1927f..d4efac21 100644 --- a/src/hacks/CatBot.cpp +++ b/src/hacks/CatBot.cpp @@ -194,7 +194,7 @@ void reportall() patch.Patch(); patched_report = true; } - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); // We only want a nullptr check since dormant entities are still on the @@ -262,7 +262,7 @@ void smart_crouch() static bool crouch = false; if (crouchcdr.test_and_set(2000)) { - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { auto ent = ENTITY(i); if (CE_BAD(ent) || ent->m_Type() != ENTITY_PLAYER || ent->m_iTeam() == LOCAL_E->m_iTeam() || !(ent->hitboxes.GetHitbox(0)) || !(ent->m_bAlivePlayer()) || !player_tools::shouldTarget(ent) || should_ignore_player(ent)) diff --git a/src/hacks/DominateMark.cpp b/src/hacks/DominateMark.cpp index 1410b124..a7bf8add 100644 --- a/src/hacks/DominateMark.cpp +++ b/src/hacks/DominateMark.cpp @@ -17,7 +17,7 @@ static InitRoutine init([]() { if (CE_BAD(LOCAL_E)) return; re::CTFPlayerShared *shared_player = &re::C_BasePlayer::shared_(RAW_ENT(LOCAL_E)); - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_GOOD(ent) && ent->m_bAlivePlayer() && re::CTFPlayerShared::IsDominatingPlayer(shared_player, i)) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 2af9c6dc..cb581a1c 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -53,7 +53,7 @@ static CatCommand follow_steam("fb_steam", "Follow Steam Id", [](const CCommand }); static CatCommand steam_debug("debug_steamid", "Print steamids", []() { - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { auto ent = ENTITY(i); logging::Info("%u", ent->player_info.friendsID); diff --git a/src/hacks/LightESP.cpp b/src/hacks/LightESP.cpp index 2080668e..15d3f492 100644 --- a/src/hacks/LightESP.cpp +++ b/src/hacks/LightESP.cpp @@ -25,7 +25,7 @@ static void cm() { if (!*enable) return; - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { if (g_pLocalPlayer->entity_idx == i) continue; @@ -53,7 +53,7 @@ void draw() { if (!enable) return; - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { if (!drawEsp[i]) continue; diff --git a/src/hacks/MiscAimbot.cpp b/src/hacks/MiscAimbot.cpp index fa8e19c8..58c5af3f 100644 --- a/src/hacks/MiscAimbot.cpp +++ b/src/hacks/MiscAimbot.cpp @@ -60,7 +60,7 @@ std::pair FindBestEnt(bool teammate, bool Predict, bool return { bestent, predicted }; } prevent = -1; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent) || !(ent->m_bAlivePlayer()) || (teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) || ent == LOCAL_E) diff --git a/src/hacks/MiscPlayerInfo.cpp b/src/hacks/MiscPlayerInfo.cpp index 9c04b164..f97da587 100644 --- a/src/hacks/MiscPlayerInfo.cpp +++ b/src/hacks/MiscPlayerInfo.cpp @@ -51,7 +51,7 @@ void Paint() { if (!*draw_kda && !*mafia_city) return; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent)) diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index 34c8f6b4..b01cc4e0 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -131,7 +131,7 @@ static std::pair getNearestPlayerDistance() { float distance = FLT_MAX; CachedEntity *best_ent = nullptr; - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_GOOD(ent) && ent->m_bAlivePlayer() && ent->m_bEnemy() && g_pLocalPlayer->v_Origin.DistTo(ent->m_vecOrigin()) < distance && player_tools::shouldTarget(ent) && VisCheckEntFromEnt(LOCAL_E, ent)) @@ -224,7 +224,7 @@ static bool stayNearPlayer(CachedEntity *&ent, const bot_class_config &config, C static bool stayNearPlayers(const bot_class_config &config, CachedEntity *&result_ent, CNavArea *&result_area) { std::vector players; - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent) || !ent->m_bAlivePlayer() || !ent->m_bEnemy() || !player_tools::shouldTarget(ent)) diff --git a/src/hacks/PureBypass.cpp b/src/hacks/PureBypass.cpp index 4727cf47..d5fc5e86 100644 --- a/src/hacks/PureBypass.cpp +++ b/src/hacks/PureBypass.cpp @@ -1,35 +1,15 @@ #include #include "common.hpp" -static settings::Bool enabled{ "pure-bypass.enable", "false" }; -static void *pure_orig, **pure_addr; - -static void toggle(bool on) +hooks::VMTHook svpurehook{}; +static void (*orig_RegisterFileWhilelist)(void *, void *, void *); +static void RegisterFileWhitelist(void *_this, void *a, void *b) { - if (on) - { - if (!pure_addr) - { - pure_addr = *reinterpret_cast(gSignatures.GetEngineSignature("A1 ? ? ? ? 85 C0 74 ? C7 44 24 ? ? ? ? ? 89 04 24") + 1); - if (!pure_addr) - { - logging::Info("Pure bypass broken, failed to find signature"); - return; - } - } - if (*pure_addr) - pure_orig = *pure_addr; - - *pure_addr = nullptr; - } - else if (pure_orig) - { - *pure_addr = pure_orig; - pure_orig = nullptr; - } + logging::Info("git gud sv_pure !"); } static InitRoutine init([] { - toggle(*enabled); - enabled.installChangeCallback([](settings::VariableBase &, bool on) { toggle(on); }); + svpurehook.Set(g_IFileSystem); + svpurehook.HookMethod(RegisterFileWhitelist, offsets::RegisterFileWhitelist(), &orig_RegisterFileWhilelist); + svpurehook.Apply(); }); diff --git a/src/hacks/Spam.cpp b/src/hacks/Spam.cpp index 87b37dde..b788365b 100644 --- a/src/hacks/Spam.cpp +++ b/src/hacks/Spam.cpp @@ -181,7 +181,7 @@ int QueryPlayer(Query query) } std::vector candidates{}; int index_result = 0; - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { if (PlayerPassesQuery(query, i)) { diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 81d95202..969130c1 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -424,7 +424,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs } if (cmd && (cmd->buttons & IN_ATTACK || !(hacks::shared::antiaim::isEnabled() && *fakelag_amount && *bSendPackets))) g_Settings.brute.last_angles[LOCAL_E->m_IDX] = cmd->viewangles; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); diff --git a/src/hooks/GetFriendPersonaName.cpp b/src/hooks/GetFriendPersonaName.cpp index c7ffa5d5..bf108996 100644 --- a/src/hooks/GetFriendPersonaName.cpp +++ b/src/hooks/GetFriendPersonaName.cpp @@ -35,7 +35,7 @@ bool StolenName() int potential_targets_length = 0; // Go through entities looking for potential targets - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { CachedEntity *ent = ENTITY(i); diff --git a/src/hooks/visual/DrawModelExecute.cpp b/src/hooks/visual/DrawModelExecute.cpp index 5962bc98..c8912188 100644 --- a/src/hooks/visual/DrawModelExecute.cpp +++ b/src/hooks/visual/DrawModelExecute.cpp @@ -71,7 +71,7 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod if (sname.find("models/player") || sname.find("models/weapons") || sname.find("models/workshop/player") || sname.find("models/workshop/weapons")) { - if (IDX_GOOD(info.entity_index) && info.entity_index < g_IEngine->GetMaxClients() && info.entity_index != g_IEngine->GetLocalPlayer()) + if (IDX_GOOD(info.entity_index) && info.entity_index <= g_IEngine->GetMaxClients() && info.entity_index != g_IEngine->GetLocalPlayer()) { CachedEntity *ent = ENTITY(info.entity_index); if (CE_GOOD(ent) && ent->m_bAlivePlayer()) @@ -96,15 +96,14 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod // Sort std::sort(usable.begin(), usable.end(), [](hacks::shared::backtrack::BacktrackData &a, hacks::shared::backtrack::BacktrackData &b) { return a.tickcount < b.tickcount; }); // Make our own Chamsish Material - static CMaterialReference mat_lit; + static CMaterialReference mat_unlit; static bool init = false; if (!init) { - KeyValues *kv = new KeyValues("VertexLitGeneric"); + KeyValues *kv = new KeyValues("UnlitGeneric"); kv->SetString("$basetexture", "vgui/white_additive"); kv->SetInt("$ignorez", 0); - kv->SetInt("$halflambert", 1); - mat_lit.Init("__cathook_echams_lit", kv); + mat_unlit.Init("__cathook_glow_unlit", kv); init = true; } // Render Chams/Glow stuff @@ -116,7 +115,7 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod // Important for Depth ptr->DepthRange(0.0f, 1.0f); // Apply our material - g_IVModelRender->ForcedMaterialOverride(mat_lit); + g_IVModelRender->ForcedMaterialOverride(mat_unlit); // Run Original original::DrawModelExecute(this_, state, info, usable[0].bones); // Revert diff --git a/src/irc.cpp b/src/irc.cpp index 6a20c304..7b0638b7 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -74,7 +74,7 @@ void authreq(std::string &msg) else steamidhash = msg.substr(4); - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { if (i == g_pLocalPlayer->entity_idx) continue; diff --git a/src/playerlist.cpp b/src/playerlist.cpp index 686882c9..3826d686 100644 --- a/src/playerlist.cpp +++ b/src/playerlist.cpp @@ -235,7 +235,7 @@ CatCommand pl_set_state("pl_set_state", "cat_pl_set_state [playername] [state] ( } auto name = args.Arg(1); int id = -1; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { player_info_s info; if (!g_IEngine->GetPlayerInfo(i, &info)) @@ -301,7 +301,7 @@ static int cat_pl_set_state_completionCallback(const char *c_partial, char comma std::vector names; - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + for (int i = 0; i <= g_IEngine->GetMaxClients(); i++) { player_info_s info; if (!g_IEngine->GetPlayerInfo(i, &info)) diff --git a/src/votelogger.cpp b/src/votelogger.cpp index c5f9bdbe..a94af1c1 100644 --- a/src/votelogger.cpp +++ b/src/votelogger.cpp @@ -29,7 +29,7 @@ static void vote_rage_back() if (!g_IEngine->IsInGame() || !attempt_vote_time.test_and_set(1000)) return; - for (int i = 1; i < g_IEngine->GetMaxClients(); i++) + for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) { auto ent = ENTITY(i); // TO DO: m_bEnemy check only when you can't vote off players from the opposite team