Untitled

 avatar
unknown
c_cpp
7 months ago
1.8 kB
4
Indexable
struct NameEntry
{
	uint32_t index;
	char name[36];
	uint8_t pad[92];
	int32_t health;
	uint8_t pad2[70];
};

class player_t {
public:
	player_t(uintptr_t address) {
		this->address = address;
	}

	uintptr_t address{};

	int id{};

	bool is_valid();

	bool dead();


	int team_id();

	vec3_t get_pos();
	uint32_t getIndex();
	NameEntry GetNameEntry(uint32_t index);
	uintptr_t get_bone_ptr(uint64_t bone_base, uint64_t bone_index) const;
};

NameEntry player_t::GetNameEntry(uint32_t index) {
    return driver::read<NameEntry>(sdk::GetNameList() + (index * offsets::name_size));
}

sdk::player_t player(sdk::client_info_base + (i * offsets::player::size));
sdk::NameEntry nameEntry = player.GetNameEntry(i);
auto dist = sdk::units_to_m(local_pos.distance_to(pos));

if (dist > 1.0f && dist < vars::maxespdist) {
	char buf[64];
	sprintf(buf, xorstr_("[%i]%s [%.1f]m"), player.team_id(), nameEntry.name, dist);

	vec3_t headPos = pos;
	headPos.z += 66.f;
	vec2_t head;
	if (sdk::w2s(headPos, head)) {
		if (vars::healthbars) {
			float Percentage = (nameEntry.health / 127.0f) * 100.0f;
			float CornerHeight = abs(head.y - screen.y);
			float CornerWidth = CornerHeight * 0.65f;
			float width = max(min(CornerWidth / 10.0f, 3.0f), 2.0f);
			float height = screen.y - head.y;
			HealthBar(head.x - (CornerWidth / 2) - 10, head.y, width, height, Percentage, ESPColor);
		}

		if (vars::drawlines) {
			ImVec2 lineStart = (vars::linetype == 1) ? ImVec2(sdk::ref_def.width / 2, sdk::ref_def.height) : ImVec2(sdk::ref_def.width / 2, sdk::ref_def.height / 2);
			draw->AddLine(lineStart, ImVec2(screen.x, screen.y), ESPColor, 2.0f);
		}

		if (vars::esptext) {
			DrawOutlinedText(Custom_Font, ImVec2(screen.x, screen.y + 10), 13.0f, ESPColor, true, buf);
		}
	}
}

Editor is loading...
Leave a Comment