Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Show friendly decoy owner #699

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions src/Hacks/esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "../Utils/skins.h"

bool Settings::ESP::enabled = false;
bool Settings::ESP::decoyShowOwner = false;
TeamColorType Settings::ESP::teamColorType = TeamColorType::RELATIVE;
ImColor Settings::ESP::enemyColor = ImColor(240, 60, 60, 255);
ImColor Settings::ESP::enemyVisibleColor = ImColor(240, 185, 60, 255);
Expand Down Expand Up @@ -801,18 +802,40 @@ void ESP::DrawThrowable(C_BaseEntity* throwable, ClientClass* client)
nadeColor = Settings::ESP::smokeColor;
break;
}
else if (strstr(mat->GetName(), "decoy"))
{
nadeName = "Decoy";
nadeColor = Settings::ESP::decoyColor;
break;
}
else if (strstr(mat->GetName(), "incendiary") || strstr(mat->GetName(), "molotov"))
{
nadeName = "Molotov";
nadeColor = Settings::ESP::molotovColor;
break;
}
else if (strstr(mat->GetName(), "decoy"))
{
nadeName = "Decoy";
nadeColor = Settings::ESP::decoyColor;

if (!Settings::ESP::decoyShowOwner)
break;

C_BasePlayer* localplayer = (C_BasePlayer*) entityList->GetClientEntity(engine->GetLocalPlayer());
if (!localplayer)
break;

if (throwable->GetTeam() == localplayer->GetTeam())
{
int owner = throwable->GetOwnerEntity() & 0xFFF;
if (!owner)
break;

IEngineClient::player_info_t entityInformation;
engine->GetPlayerInfo(owner, &entityInformation);

nadeName += "(";
nadeName += entityInformation.name;
nadeName += ")";
}

break;
}
}

DrawEntity(throwable, nadeName.c_str(), Color::FromImColor(nadeColor));
Expand Down
5 changes: 5 additions & 0 deletions src/SDK/IClientEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ class C_BaseEntity : public IClientEntity
{
return *(TeamID*)((uintptr_t)this + offsets.DT_BaseEntity.m_iTeamNum);
}

int GetOwnerEntity()
{
return *(int*)((uintptr_t)this + offsets.DT_BaseEntity.m_hOwnerEntity);
}

Vector GetVecOrigin()
{
Expand Down
1 change: 1 addition & 0 deletions src/offsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void Offsets::GetOffsets()
offsets.DT_BaseEntity.m_MoveType = offsets.DT_BaseEntity.m_nRenderMode + 1;
offsets.DT_BaseEntity.m_Collision = NetVarManager::GetOffset(tables, "DT_BaseEntity", "m_Collision");
offsets.DT_BaseEntity.m_bSpotted = NetVarManager::GetOffset(tables, "DT_BaseEntity", "m_bSpotted");
offsets.DT_BaseEntity.m_hOwnerEntity = NetVarManager::GetOffset(tables, "DT_BaseEntity", "m_hOwnerEntity");

offsets.DT_BaseCombatCharacter.m_hActiveWeapon = NetVarManager::GetOffset(tables, "DT_BaseCombatCharacter", "m_hActiveWeapon");
offsets.DT_BaseCombatCharacter.m_hMyWeapons = NetVarManager::GetOffset(tables, "DT_BaseCombatCharacter", "m_hMyWeapons") / 2;
Expand Down
1 change: 1 addition & 0 deletions src/offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct COffsets
std::ptrdiff_t m_MoveType;
std::ptrdiff_t m_Collision;
std::ptrdiff_t m_bSpotted;
std::ptrdiff_t m_hOwnerEntity;
} DT_BaseEntity;

struct
Expand Down
2 changes: 2 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ void Settings::LoadDefaultsOrSave(std::string path)
settings["AntiAim"]["AutoDisable"]["knife_held"] = Settings::AntiAim::AutoDisable::knifeHeld;

settings["ESP"]["enabled"] = Settings::ESP::enabled;
settings["ESP"]["decoy_show_owner"] = Settings::ESP::decoyShowOwner;
LoadUIColor(settings["ESP"]["enemy_color"], Settings::ESP::enemyColor);
LoadUIColor(settings["ESP"]["enemy_visible_color"], Settings::ESP::enemyVisibleColor);
LoadUIColor(settings["ESP"]["ally_color"], Settings::ESP::allyColor);
Expand Down Expand Up @@ -566,6 +567,7 @@ void Settings::LoadConfig(std::string path)
GetVal(settings["AntiAim"]["AutoDisable"]["no_enemy"], &Settings::AntiAim::AutoDisable::noEnemy);

GetVal(settings["ESP"]["enabled"], &Settings::ESP::enabled);
GetVal(settings["ESP"]["decoy_show_owner"], &Settings::ESP::decoyShowOwner);
GetVal(settings["ESP"]["enemy_color"], &Settings::ESP::enemyColor);
GetVal(settings["ESP"]["enemy_visible_color"], &Settings::ESP::enemyVisibleColor);
GetVal(settings["ESP"]["ally_color"], &Settings::ESP::allyColor);
Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ namespace Settings
namespace ESP
{
extern bool enabled;
extern bool decoyShowOwner;
extern TeamColorType teamColorType;
extern ImColor enemyColor;
extern ImColor allyColor;
Expand Down