From c962074eb4a63e740a1608af2114ce86c94d050b Mon Sep 17 00:00:00 2001 From: julianacat Date: Wed, 19 Jul 2017 15:06:34 -0500 Subject: [PATCH 01/11] Rewrote wait for charge + added tracers --- src/hacks/Aimbot.cpp | 51 ++++++++++++++++++++++++++++++++++------- src/hacks/ESP.cpp | 21 +++++++++++++++++ src/hacks/FollowBot.cpp | 9 +------- 3 files changed, 65 insertions(+), 16 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 1d8a84ed..d9dc4fef 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -52,6 +52,7 @@ static CatVar priority_mode(priority_mode_enum, "aimbot_prioritymode", "0", "Pri "SMART: Basically Auto-Threat. Will be tweakable eventually. " "FOV, DISTANCE, HEALTH are self-explainable. HEALTH picks the weakest enemy"); static CatVar wait_for_charge(CV_SWITCH, "aimbot_charge", "0", "Wait for sniper rifle charge", "Aimbot waits until it has enough charge to kill"); +static CatVar ambassador_wait(CV_SWITCH, "aimbot_ambassador", "1", "Wait for headshot", "Aimbot waits until it has enough charge to headshot with the ambassador"); static CatVar ignore_vaccinator(CV_SWITCH, "aimbot_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "aimbot_ignore_hoovy", "0", "Ignore Hoovies", "Aimbot won't attack hoovies"); static CatVar ignore_cloak(CV_SWITCH, "aimbot_ignore_cloak", "1", "Ignore cloaked", "Don't aim at invisible enemies"); @@ -96,9 +97,7 @@ static CatVar aimbot_debug(CV_SWITCH, "aimbot_debug", "0", "Aimbot Debug", "Disp static CatVar engine_projpred(CV_SWITCH, "debug_aimbot_engine_pp", "0", "Engine ProjPred"); // Followbot vars static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Spin up minigun if you can see target, useful for followbots"); -/* TODO IMPLEMENT static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automatically zoom in if you can see target, useful for followbots"); -*/ // Current Entity int target_eid { 0 }; @@ -362,9 +361,26 @@ bool IsTargetStateGood(CachedEntity* entity) { IF_GAME (IsTF()) { // If settings allow waiting for charge, and current charge cant kill target, dont aim if (wait_for_charge && g_pLocalPlayer->holding_sniper_rifle) { - float bdmg = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flChargedDamage); - if (g_GlobalVars->curtime - g_pLocalPlayer->flZoomBegin <= 1.0f) bdmg = 50.0f; - if ((bdmg * 3) < (HasDarwins(entity) ? (entity->m_iHealth * 1.15) : entity->m_iHealth)) { + + // Grab netvar for current charge damage and multiply by 3 for headshot + float cdmg = CE_FLOAT(LOCAL_W, netvar.flChargedDamage) * 3; + + // Darwins damage correction, Darwins protects against 15% of damage + if (HasDarwins(entity)) + cdmg = (cdmg * .85) - 1; + // Vaccinator damage correction, Vac charge protects against 75% of damage + if (HasCondition(entity)) { + cdmg = (cdmg * .25) - 1; + // Passive bullet resist protects against 10% of damage + } else if (HasCondition(entity)) { + cdmg = (cdmg * .90) - 1; + } + // Invis damage correction, Invis spies get protection from 10% of damage + if (IsPlayerInvisible(entity)) + cdmg = (cdmg * .80) - 1; + + // Check if player will die from headshot or if target has more health than normal overheal allows. + if ( !(entity->m_iHealth <= 150 || entity->m_iHealth <= cdmg || !g_pLocalPlayer->bZoomed || entity->m_iHealth > entity->m_iMaxHealth + (entity->m_iMaxHealth * 0.5)) ) { return false; } } @@ -493,6 +509,7 @@ void Aim(CachedEntity* entity) { // Grab the targets vector, and vector it for the eye angles tr = (PredictEntity(entity) - g_pLocalPlayer->v_Eye); VectorAngles(tr, angles); + // Clamp angles fClampAngle(angles); @@ -508,8 +525,10 @@ void Aim(CachedEntity* entity) { // A function to check whether player can autoshoot bool CanAutoShoot() { + // First check whether user settings allow autoshoot if (autoshoot) { + // A var for weapons not to use with autoshoot static int forbiddenWeapons[] = { CL_CLASS(CTFCompoundBow), CL_CLASS(CTFKnife) }; int weapon_class; @@ -524,10 +543,21 @@ bool CanAutoShoot() { } } + // Check if zoomed, and zoom if not, then zoom + IF_GAME (IsTF()) { + if (g_pLocalPlayer->clazz == tf_class::tf_sniper) { + if (g_pLocalPlayer->holding_sniper_rifle) { + if (auto_zoom && !HasCondition(LOCAL_E)) { + g_pUserCmd->buttons |= IN_ATTACK2; + attack = false; + } + } + } + } + // Check if ambassador can headshot IF_GAME (IsTF2()) { - // Check if players current weapon is an ambasador - if (IsAmbassador(g_pLocalPlayer->weapon())) { + if (ambassador_wait && IsAmbassador(g_pLocalPlayer->weapon())) { // Check if ambasador can headshot if (!AmbassadorCanHeadshot()) return false; } @@ -614,7 +644,12 @@ int BestHitbox(CachedEntity* target) { headonly = true; // If player is using an ambassador, set headonly to true } else if (IsAmbassador(g_pLocalPlayer->weapon())) { - headonly = true; + // We only want to aim for the head if the ambassador can headshot + if (AmbassadorCanHeadshot()) { + headonly = true; + // 18 health is a good number to use as thats the usual minimum damage it can do with a bodyshot, but damage could potentially be higher + if (target->m_iHealth <= 18) headonly = false; + } // If player is using a rocket based weapon, prefer the hip } else if (ci == CL_CLASS(CTFRocketLauncher) || ci == CL_CLASS(CTFRocketLauncher_AirStrike) || diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 4ba4ca9b..9f357ec5 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -13,6 +13,8 @@ namespace hacks { namespace shared { namespace esp { CatVar show_weapon(CV_SWITCH, "esp_weapon", "1", "Show weapon name", "Show which weapon does the enemy use"); +CatEnum tracers_enum({ "OFF", "CENTER", "BOTTOM" }); +CatVar tracers(tracers_enum, "esp_tracers", "0", "Tracers", "SDraws a line from the player to a position on your screen"); CatVar local_esp(CV_SWITCH, "esp_local", "1", "ESP Local Player", "Shows local player ESP in thirdperson"); CatVar buildings(CV_SWITCH, "esp_buildings", "1", "Building ESP", "Show buildings"); CatVar enabled(CV_SWITCH, "esp_enabled", "0", "ESP", "Master ESP switch"); @@ -650,6 +652,25 @@ void _FASTCALL ProcessEntityPT(CachedEntity* ent) { } } + if (tracers && ent->m_Type == ENTITY_PLAYER) { + + // Grab the screen resolution and save to some vars + int width, height; + g_IEngine->GetScreenSize(width, height); + + // Center values on screen + width = width / 2; + // Only center height if we are using center mode + if ((int)tracers == 2) height = height / 2; + + // Get world to screen + Vector scn; + draw::WorldToScreen(ent->m_vecOrigin, scn); + + // Draw a line + drawgl::Line(scn.x, scn.y, width - scn.x, height - scn.y, fg); + } + if (ent->m_Type == ENTITY_PLAYER) { if (joy_esp) { auto hb = ent->hitboxes.GetHitbox(0); diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 767378b0..f558939f 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -14,17 +14,10 @@ namespace hacks { namespace shared { namespace followbot { - - - /* Big Followbot TODO list 1. Fix crash when setting followbot_idx var and remove the fix var in its place -2. Test with followbots to ensure that vector followbot and crumb followbot work as intended -3. Clean the finished code and push to main from fork */ - - - + // User settings CatVar bot(CV_SWITCH, "fb_bot", "0", "Master Followbot Switch", "Set to 1 in followbots' configs"); From ee9056e4a3767f9001c28819d8f7acac13a2b89c Mon Sep 17 00:00:00 2001 From: julianacat Date: Wed, 19 Jul 2017 15:12:59 -0500 Subject: [PATCH 02/11] General fixes --- src/hacks/Aimbot.cpp | 11 ++++------- src/hacks/ESP.cpp | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index d9dc4fef..8520b19a 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -52,7 +52,6 @@ static CatVar priority_mode(priority_mode_enum, "aimbot_prioritymode", "0", "Pri "SMART: Basically Auto-Threat. Will be tweakable eventually. " "FOV, DISTANCE, HEALTH are self-explainable. HEALTH picks the weakest enemy"); static CatVar wait_for_charge(CV_SWITCH, "aimbot_charge", "0", "Wait for sniper rifle charge", "Aimbot waits until it has enough charge to kill"); -static CatVar ambassador_wait(CV_SWITCH, "aimbot_ambassador", "1", "Wait for headshot", "Aimbot waits until it has enough charge to headshot with the ambassador"); static CatVar ignore_vaccinator(CV_SWITCH, "aimbot_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "aimbot_ignore_hoovy", "0", "Ignore Hoovies", "Aimbot won't attack hoovies"); static CatVar ignore_cloak(CV_SWITCH, "aimbot_ignore_cloak", "1", "Ignore cloaked", "Don't aim at invisible enemies"); @@ -557,7 +556,7 @@ bool CanAutoShoot() { // Check if ambassador can headshot IF_GAME (IsTF2()) { - if (ambassador_wait && IsAmbassador(g_pLocalPlayer->weapon())) { + if (IsAmbassador(g_pLocalPlayer->weapon())) { // Check if ambasador can headshot if (!AmbassadorCanHeadshot()) return false; } @@ -645,11 +644,9 @@ int BestHitbox(CachedEntity* target) { // If player is using an ambassador, set headonly to true } else if (IsAmbassador(g_pLocalPlayer->weapon())) { // We only want to aim for the head if the ambassador can headshot - if (AmbassadorCanHeadshot()) { - headonly = true; - // 18 health is a good number to use as thats the usual minimum damage it can do with a bodyshot, but damage could potentially be higher - if (target->m_iHealth <= 18) headonly = false; - } + headonly = AmbassadorCanHeadshot(); + // 18 health is a good number to use as thats the usual minimum damage it can do with a bodyshot, but damage could potentially be higher + if (target->m_iHealth <= 18) headonly = false; // If player is using a rocket based weapon, prefer the hip } else if (ci == CL_CLASS(CTFRocketLauncher) || ci == CL_CLASS(CTFRocketLauncher_AirStrike) || diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 9f357ec5..b6ecfbc1 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -661,7 +661,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity* ent) { // Center values on screen width = width / 2; // Only center height if we are using center mode - if ((int)tracers == 2) height = height / 2; + if ((int)tracers == 1) height = height / 2; // Get world to screen Vector scn; From 0d9850099013a201a85e7e9dcfb8920305faa085 Mon Sep 17 00:00:00 2001 From: julianacat Date: Wed, 19 Jul 2017 15:21:12 -0500 Subject: [PATCH 03/11] Updated Menu --- tf-settings/menu.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 91ee2899..9bf6924a 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -182,6 +182,7 @@ "esp_buildings", "esp_local", "esp_powerups", + "esp_tracers", { "type": "list", "name": "Emoji ESP", From 24bd3bb78a530430a639a9858575e3a4aed21ded Mon Sep 17 00:00:00 2001 From: julianacat Date: Wed, 19 Jul 2017 22:35:54 -0500 Subject: [PATCH 04/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ebd583f..8ec5fb66 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ You will want to update these files if you wish to have an updated menu. ## Followbots `cathook-ipc-server` allows you to run and control Followbots to do your evil bidding in-game. The installation for Followbots is quite complex, and will not be covered on this page. Obviously, you must have several user accounts ready to run TF2. -A guide for Followbots can be found here: [How to setup and use followbots.](https://www.youtube.com/watch?v=kns5-nw7xUg) +A guide for Followbots can be found here: [How to setup followbots.](https://github.com/nullifiedcat/cathook/wiki/Setting-up-Followbots) [How to use followbots.](https://github.com/nullifiedcat/cathook/wiki/Using-Followbots) You may also ask someone in our discord server to help you out. The installation script is as followed: From eba7c7b92bf85e45ea88c09bbe8966dea11bc955 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 00:56:49 -0500 Subject: [PATCH 05/11] Added Namestealer + Fixed anti-afk --- src/hacks/Misc.cpp | 24 ++++++++------ src/hooks/others.cpp | 75 +++++++++++++++++++++++++++++++++++++++++++ tf-settings/menu.json | 1 + 3 files changed, 91 insertions(+), 9 deletions(-) diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index f8adb551..db828fe2 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -322,19 +322,25 @@ void CreateMove() { // Check if user settings allow anti-afk if (anti_afk) { + // If the timer exceeds 1 minute, jump and reset the timer - if ( g_GlobalVars->curtime - afkTimeIdle > 60 ) { + if (g_GlobalVars->curtime - 60 > afkTimeIdle) { + + // Send random commands + g_pUserCmd->sidemove = RandFloatRange(-450.0, 450.0); + g_pUserCmd->forwardmove = RandFloatRange(-450.0, 450.0); + g_pUserCmd->buttons = rand(); - // If player didnt jump, then we dont reset the timer - if (CE_INT(g_pLocalPlayer->entity, netvar.movetype) == MOVETYPE_FLY) + // After 1 second we reset the idletime + if (g_GlobalVars->curtime - 61 > afkTimeIdle) { + logging::Info("Finish idle"); + afkTimeIdle = g_GlobalVars->curtime; + } + } else { + // If the player uses a button, reset the timer + if (g_pUserCmd->buttons & IN_FORWARD || g_pUserCmd->buttons & IN_BACK || g_pUserCmd->buttons & IN_MOVELEFT || g_pUserCmd->buttons & IN_MOVERIGHT || g_pUserCmd->buttons & IN_JUMP || !LOCAL_E->m_bAlivePlayer) afkTimeIdle = g_GlobalVars->curtime; - - // Attemt to jump - g_pUserCmd->buttons = g_pUserCmd->buttons &~ IN_JUMP; } - // If the player uses a button, reset the timer - if ( g_pUserCmd->buttons & IN_FORWARD || g_pUserCmd->buttons & IN_BACK || g_pUserCmd->buttons & IN_MOVELEFT || g_pUserCmd->buttons & IN_MOVERIGHT || g_pUserCmd->buttons & IN_JUMP || !LOCAL_E->m_bAlivePlayer ) - afkTimeIdle = g_GlobalVars->curtime; } IF_GAME (IsTF2()) { diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 9d3a0b20..12783e75 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -213,8 +213,83 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); +CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks"); + +static std::string stolen_name; + +// Func to get a new entity to steal name from +bool StolenName(){ + + // Array to store potential namestealer targets with a bookkeeper to tell how full it is + int potential_targets[32]; + int potential_targets_length = 0; + + // Go through entities looking for potential targets + for (int i = 1; i < HIGHEST_ENTITY; i++) { + CachedEntity* ent = ENTITY(i); + + // Check if ent is a good target + if (!ent) continue; + if (ent == LOCAL_E) continue; + if (!ent->m_Type == ENTITY_PLAYER) continue; + if (ent->m_bEnemy) continue; + + // Check if name is current one + player_info_s info; + if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) { + + // If our name is the same as current, than change it + if (std::string(info.name) == stolen_name) continue; + + // a ent without a name is no ent we need, contine for a different one + } else continue; + + // Save the ent to our array + potential_targets[potential_targets_length] = i; + potential_targets_length++; + if (potential_targets_length >= 32) break; + } + + // Get random number that we can use with our array + int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); + + // Get a idx from our random array position + int new_target = potential_targets[target_random_num]; + + // Checks to prevent crashes + if (!ENTITY(new_target) || potential_targets_length == 0) return false; + + // Grab username of user + player_info_s info; + if (g_IEngine->GetPlayerInfo(new_target, &info)) { + + // If our name is the same as current, than change it and return true + stolen_name = std::string(info.name); + return true; + } + + // Didnt get playerinfo + return false; +} + const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName()); + + // Check User settings if namesteal is allowed + if (namesteal && steamID == g_ISteamUser->GetSteamID()) { + + // We dont want to steal names while not in-game as there are no targets to steal from + if (g_IEngine->IsInGame()) { + + // Check if we have a username to steal, func automaticly steals a name in it. + if (StolenName()) { + + // Return the name that has changed from the func above + return format(stolen_name, "\x0F").c_str(); + } + } + } + if ((force_name.convar->m_StringLength > 3) && steamID == g_ISteamUser->GetSteamID()) { return force_name_newlined; } diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 9bf6924a..94ac78a4 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -407,6 +407,7 @@ "name", "fakelag", "disconnect_reason", + "name_stealer", "minigun_jump", "spycrab", "skinchanger", From 4d77bfcfb123bc4f584000c61422394f37757914 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:12:01 -0500 Subject: [PATCH 06/11] Added more control to name stealer --- src/hooks/others.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 12783e75..2a0cb6be 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -213,7 +213,8 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); -CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks"); +CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); +CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); static std::string stolen_name; @@ -239,7 +240,13 @@ bool StolenName(){ if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) { // If our name is the same as current, than change it - if (std::string(info.name) == stolen_name) continue; + if (std::string(info.name) == stolen_name) { + // Since we found the ent we stole our name from and it is still good, if user settings are passive, then we return true and dont alter our name + if ((int)namesteal == 1) { + return true; + // Otherwise we continue to change our name to something else + } else continue; + } // a ent without a name is no ent we need, contine for a different one } else continue; From 28921a5a30ede15cfcf756f6aa1ed80157dd5c3a Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:23:10 -0500 Subject: [PATCH 07/11] Fixed double accuracy settings --- simple-ipc | 2 +- tf-settings/menu.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/simple-ipc b/simple-ipc index 94a287d6..e532876f 160000 --- a/simple-ipc +++ b/simple-ipc @@ -1 +1 @@ -Subproject commit 94a287d6faa00d44e1084b04e602842849858443 +Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839 diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 6ca2e5ce..94ac78a4 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -135,7 +135,6 @@ "type": "list", "name": "Triggerbot Preferences", "list": [ - "trigger_accuracy", "trigger_zoomed", "trigger_maxrange", "trigger_charge", From c8534cc8716313f3c48a58c5300b10cbc2cf8dfe Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:25:50 -0500 Subject: [PATCH 08/11] Fix github --- src/hooks/others.cpp | 80 -------------------------------------------- 1 file changed, 80 deletions(-) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 273b147b..d4ee1270 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -213,89 +213,9 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); -CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); -CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); - -static std::string stolen_name; - -// Func to get a new entity to steal name from -bool StolenName(){ - - // Array to store potential namestealer targets with a bookkeeper to tell how full it is - int potential_targets[32]; - int potential_targets_length = 0; - - // Go through entities looking for potential targets - for (int i = 1; i < HIGHEST_ENTITY; i++) { - CachedEntity* ent = ENTITY(i); - - // Check if ent is a good target - if (!ent) continue; - if (ent == LOCAL_E) continue; - if (!ent->m_Type == ENTITY_PLAYER) continue; - if (ent->m_bEnemy) continue; - - // Check if name is current one - player_info_s info; - if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) { - - // If our name is the same as current, than change it - if (std::string(info.name) == stolen_name) { - // Since we found the ent we stole our name from and it is still good, if user settings are passive, then we return true and dont alter our name - if ((int)namesteal == 1) { - return true; - // Otherwise we continue to change our name to something else - } else continue; - } - - // a ent without a name is no ent we need, contine for a different one - } else continue; - - // Save the ent to our array - potential_targets[potential_targets_length] = i; - potential_targets_length++; - if (potential_targets_length >= 32) break; - } - - // Get random number that we can use with our array - int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); - - // Get a idx from our random array position - int new_target = potential_targets[target_random_num]; - - // Checks to prevent crashes - if (!ENTITY(new_target) || potential_targets_length == 0) return false; - - // Grab username of user - player_info_s info; - if (g_IEngine->GetPlayerInfo(new_target, &info)) { - - // If our name is the same as current, than change it and return true - stolen_name = std::string(info.name); - return true; - } - - // Didnt get playerinfo - return false; -} const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName()); - - // Check User settings if namesteal is allowed - if (namesteal && steamID == g_ISteamUser->GetSteamID()) { - - // We dont want to steal names while not in-game as there are no targets to steal from - if (g_IEngine->IsInGame()) { - - // Check if we have a username to steal, func automaticly steals a name in it. - if (StolenName()) { - - // Return the name that has changed from the func above - return format(stolen_name, "\x0F").c_str(); - } - } - } if ((strlen(force_name.GetString()) > 1) && steamID == g_ISteamUser->GetSteamID()) { From ace8447fcbd2f0e63ccd0cb4241177d1165e7903 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:26:06 -0500 Subject: [PATCH 09/11] Fix github revert --- src/hooks/others.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index d4ee1270..273b147b 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -213,9 +213,89 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); +CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); +CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); + +static std::string stolen_name; + +// Func to get a new entity to steal name from +bool StolenName(){ + + // Array to store potential namestealer targets with a bookkeeper to tell how full it is + int potential_targets[32]; + int potential_targets_length = 0; + + // Go through entities looking for potential targets + for (int i = 1; i < HIGHEST_ENTITY; i++) { + CachedEntity* ent = ENTITY(i); + + // Check if ent is a good target + if (!ent) continue; + if (ent == LOCAL_E) continue; + if (!ent->m_Type == ENTITY_PLAYER) continue; + if (ent->m_bEnemy) continue; + + // Check if name is current one + player_info_s info; + if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) { + + // If our name is the same as current, than change it + if (std::string(info.name) == stolen_name) { + // Since we found the ent we stole our name from and it is still good, if user settings are passive, then we return true and dont alter our name + if ((int)namesteal == 1) { + return true; + // Otherwise we continue to change our name to something else + } else continue; + } + + // a ent without a name is no ent we need, contine for a different one + } else continue; + + // Save the ent to our array + potential_targets[potential_targets_length] = i; + potential_targets_length++; + if (potential_targets_length >= 32) break; + } + + // Get random number that we can use with our array + int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); + + // Get a idx from our random array position + int new_target = potential_targets[target_random_num]; + + // Checks to prevent crashes + if (!ENTITY(new_target) || potential_targets_length == 0) return false; + + // Grab username of user + player_info_s info; + if (g_IEngine->GetPlayerInfo(new_target, &info)) { + + // If our name is the same as current, than change it and return true + stolen_name = std::string(info.name); + return true; + } + + // Didnt get playerinfo + return false; +} const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName()); + + // Check User settings if namesteal is allowed + if (namesteal && steamID == g_ISteamUser->GetSteamID()) { + + // We dont want to steal names while not in-game as there are no targets to steal from + if (g_IEngine->IsInGame()) { + + // Check if we have a username to steal, func automaticly steals a name in it. + if (StolenName()) { + + // Return the name that has changed from the func above + return format(stolen_name, "\x0F").c_str(); + } + } + } if ((strlen(force_name.GetString()) > 1) && steamID == g_ISteamUser->GetSteamID()) { From d9031c6f95632e743bc796523eee95a6a11d7d1d Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:41:08 -0500 Subject: [PATCH 10/11] Fixed namesteal not using enum --- src/hacks/Aimbot.cpp | 3 +++ src/hooks/others.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 24843770..ef90bc0f 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -472,6 +472,9 @@ bool IsTargetStateGood(CachedEntity* entity) { // Check if sticky aimbot is enabled if (!stickybot) return false; + // Only hitscan weapons can break stickys so check for them. + if (!(GetWeaponMode() == weapon_hitscan || GetWeaponMode() == weapon_melee)) return false; + // Check if target is within range if (EffectiveTargetingRange()) { if (entity->m_flDistance > (int)EffectiveTargetingRange()) return false; diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 273b147b..2dc351cb 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -214,7 +214,7 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); -CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); +CatVar namesteal(namesteal_enum, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); static std::string stolen_name; From 4bcd4f0ae0f187cfbda5c8c1ba60233bcfd333e9 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 02:53:39 -0500 Subject: [PATCH 11/11] Fixed Name stealer not working + crashing --- src/hooks/others.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 2dc351cb..17a2aaa2 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -254,18 +254,20 @@ bool StolenName(){ // Save the ent to our array potential_targets[potential_targets_length] = i; potential_targets_length++; + + // With our maximum amount of players reached, dont search for anymore if (potential_targets_length >= 32) break; } + // Checks to prevent crashes + if (potential_targets_length == 0) return false; + // Get random number that we can use with our array int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); // Get a idx from our random array position int new_target = potential_targets[target_random_num]; - // Checks to prevent crashes - if (!ENTITY(new_target) || potential_targets_length == 0) return false; - // Grab username of user player_info_s info; if (g_IEngine->GetPlayerInfo(new_target, &info)) {