This commit is contained in:
nullifiedcat 2016-11-12 13:07:39 +03:00
parent c317a2ac3e
commit e55ab1a3ad
9 changed files with 49 additions and 15 deletions

View File

@ -33,9 +33,12 @@ Color colors::black(0, 0, 0, 255);
Color colors::tf_red(184, 56, 59, 255);
Color colors::tf_blu(88, 133, 162, 255);
Color colors::yellow(255, 255, 0, 255);
Color colors::orange(255, 128, 0, 255);
Color colors::green(0, 255, 0, 255);
Color colors::dk_red(100, 40, 40, 255);
Color colors::dk_blu(40, 40, 100, 255);
Color colors::GetTeamColor(int team, bool dark) {
if (team == 2) {
if (dark)

View File

@ -28,6 +28,8 @@ extern Color black;
extern Color tf_red;
extern Color tf_blu;
extern Color yellow;
extern Color orange;
extern Color green;
extern Color dk_red;
extern Color dk_blu;
Color GetTeamColor(int team, bool dark);

View File

@ -539,4 +539,10 @@ enum weapons {
WP_FLAREGUN = 205
};
enum relation {
NEUTRAL = 0,
FRIEND = 1,
RAGE = 2
};
#endif /* ENUMS_H_ */

View File

@ -56,6 +56,10 @@ void HEsp::Create() {
this->v_bVisCheck = CreateConVar("u_esp_vischeck", "1", "Visibility Checking");
this->v_bLegit = CreateConVar("u_esp_legit", "0", "'legit' esp mode");
this->v_iLegitSeenTicks = CreateConVar("u_esp_legit_seenticks", "150", "Ticks the entity is still shown after being hidden");
v_bShowDroppedWeapons = CreateConVar("u_esp_item_weapons", "0", "Show dropped weapons");
v_bShowAmmoPacks = CreateConVar("u_esp_item_ammo", "0", "Show ammo packs");
v_bShowHealthPacks = CreateConVar("u_esp_item_health", "1", "Show health packs");
v_bShowPowerups = CreateConVar("u_esp_item_powerups", "1", "Show powerups");
}
#define ESP_HEIGHT 14
@ -107,7 +111,7 @@ void HEsp::ProcessEntityPT(CachedEntity* ent) {
Color color;
switch (ent->m_iClassID) {
case ClassID::CTFPlayer: {
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team) {
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !IsFriend(ent->m_pEntity)) {
if (ent->Var<int>(eoffsets.iCond) & cond::cloaked) return;
if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
return;
@ -146,6 +150,7 @@ void HEsp::ProcessEntity(CachedEntity* ent) {
switch (ent->m_iClassID) {
case ClassID::CTFDroppedWeapon: {
if (!this->v_bItemESP->GetBool()) break;
if (!this->v_bShowDroppedWeapons->GetBool()) break;
ent->AddESPString(draw::white, "WEAPON");
if (this->v_bShowDistance) {
ent->AddESPString(color, "%im", (int)(ent->m_flDistance / 64 * 1.22f));
@ -154,6 +159,7 @@ void HEsp::ProcessEntity(CachedEntity* ent) {
}
case ClassID::CTFAmmoPack: {
if (!this->v_bItemESP->GetBool()) break;
if (!this->v_bShowAmmoPacks->GetBool()) break;
ent->AddESPString(draw::white, "++ AMMO");
if (this->v_bShowDistance) {
ent->AddESPString(color, "%im", (int)(ent->m_flDistance / 64 * 1.22f));
@ -164,11 +170,14 @@ void HEsp::ProcessEntity(CachedEntity* ent) {
if (!this->v_bItemESP->GetBool()) break;
item_type type = GetItemType(ent->m_pEntity);
if (type == item_type::item_null) break;
if (type >= item_medkit_small && type <= item_medkit_large) {
bool shown = false;
if (type >= item_medkit_small && type <= item_medkit_large && this->v_bShowHealthPacks->GetBool()) {
ent->AddESPString(draw::white, "%s HEALTH", packs[type - item_medkit_small]);
} else if (type >= item_ammo_small && type <= item_ammo_large) {
shown = true;
} else if (type >= item_ammo_small && type <= item_ammo_large && this->v_bShowAmmoPacks->GetBool()) {
ent->AddESPString(draw::white, "%s AMMO", packs[type - item_ammo_small]);
} else if (type >= item_mp_strength && type <= item_mp_crit) {
shown = true;
} else if (type >= item_mp_strength && type <= item_mp_crit && this->v_bShowPowerups->GetBool()) {
int skin = ent->m_pEntity->GetSkin();
if (skin == 1) {
color = draw::red;
@ -178,8 +187,9 @@ void HEsp::ProcessEntity(CachedEntity* ent) {
color = draw::yellow;
}
ent->AddESPString(color, "%s PICKUP", powerups[type - item_mp_strength]);
shown = true;
}
if (this->v_bShowDistance) {
if (this->v_bShowDistance && shown) {
ent->AddESPString(color, "%im", (int)(ent->m_flDistance / 64 * 1.22f));
}
break;
@ -199,7 +209,7 @@ void HEsp::ProcessEntity(CachedEntity* ent) {
if (v_bShowFriends->GetBool() && IsFriend(ent->m_pEntity)) {
color = colors::yellow;
}
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team) {
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !IsFriend(ent->m_pEntity) && !IsRage(ent->m_pEntity)) {
if (pcond & cond::cloaked) return;
if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
return;

View File

@ -28,6 +28,10 @@ public:
ConVar* v_bEntityESP;
ConVar* v_bTeammates;
ConVar* v_bItemESP;
ConVar* v_bShowDroppedWeapons;
ConVar* v_bShowAmmoPacks;
ConVar* v_bShowHealthPacks;
ConVar* v_bShowPowerups;
ConVar* v_bTeammatePowerup;
ConVar* v_bShowHead;
ConVar* v_bShowEntityID;

View File

@ -110,9 +110,7 @@ bool HTrigger::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) {
}
// If we need charge...
if (!bodyshot && this->v_bBodyshot->GetBool()) {
int rifleHandle = GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.hActiveWeapon);
IClientEntity* rifle = interfaces::entityList->GetClientEntity(rifleHandle & 0xFFF);
float bdmg = GetEntityValue<float>(rifle, eoffsets.flChargedDamage);
float bdmg = GetEntityValue<float>(g_pLocalPlayer->weapon, eoffsets.flChargedDamage);
if (bdmg >= 15.0f && (bdmg) >= health) {
bodyshot = true;
}

View File

@ -453,15 +453,18 @@ bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float
return IsVectorVisible(origin, res1);
}
bool IsFriend(IClientEntity* ent) {
if (!ent) return false;
if (ent->IsDormant()) return false;
relation GetRelation(IClientEntity* ent) {
if (!ent) return relation::NEUTRAL;
if (ent->IsDormant()) return relation::NEUTRAL;
player_info_t info;
if (!interfaces::engineClient->GetPlayerInfo(ent->entindex(), &info)) return false;
if (!interfaces::engineClient->GetPlayerInfo(ent->entindex(), &info)) return relation::NEUTRAL;
for (int i = 0; i < 1; i++) {
if (friends[i] == info.friendsID) return true;
if (friends[i] == info.friendsID) return relation::FRIEND;
}
return false;
for (int i = 0; i < 1; i++) {
if (rage[i] == info.friendsID) return relation::RAGE;
}
return relation::NEUTRAL;
}
bool CheckCE(CachedEntity* entity) {
@ -488,6 +491,10 @@ uint32 friends[] = {
39133950
};
uint32 rage[] = {
36315583
};
const char* packs[] = {
"+",
"++",

View File

@ -47,11 +47,14 @@ bool GetProjectileData(IClientEntity* weapon, float& speed, bool& arc);
bool IsVectorVisible(Vector a, Vector b);
bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float speed, bool arc, Vector& result);
bool IsFriend(IClientEntity* ent);
bool IsRage(IClientEntity* ent);
relation GetRelation(IClientEntity* ent);
int ClassMaxHealth(int clazz);
bool CheckCE(CachedEntity* entity);
extern const char* powerups[POWERUP_COUNT];
extern const char* packs[PACK_COUNT];
extern uint32 friends[1];
extern uint32 rage[1];
#endif /* HELPERS_H_ */

View File

@ -24,6 +24,7 @@ void LocalPlayer::Update() {
v_Origin = entity->GetAbsOrigin();
v_Eye = v_Origin + v_ViewOffset;
cond_0 = GetEntityValue<int>(entity, eoffsets.iCond);
clazz = GetEntityValue<int>(entity, eoffsets.iClass);
int hWeapon = GetEntityValue<int>(entity, eoffsets.hActiveWeapon);
if (hWeapon)
weapon = interfaces::entityList->GetClientEntity(hWeapon & 0xFFF);