Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Radar.h //szóval csinálj egy új .h file-t és írd bele ezt :
- include "menu.hpp"
- #include "hooks.hpp"
- #include "options.hpp"
- static Vector RotatePoint(Vector EntityPos, Vector LocalPlayerPos, int posX, int posY, int sizeX, int sizeY, float angle, float zoom, bool* viewCheck)
- {
- float r_1, r_2;
- float x_1, y_1;
- r_1 = -(EntityPos.y - LocalPlayerPos.y);
- r_2 = EntityPos.x - LocalPlayerPos.x;
- float Yaw = angle - 90.0f;
- float yawToRadian = Yaw * (float)(M_PI / 180.0F);
- x_1 = (float)(r_2 * (float)cos((double)(yawToRadian)) - r_1 * sin((double)(yawToRadian))) / 20;
- y_1 = (float)(r_2 * (float)sin((double)(yawToRadian)) + r_1 * cos((double)(yawToRadian))) / 20;
- *viewCheck = y_1 < 0;
- x_1 *= zoom;
- y_1 *= zoom;
- int sizX = sizeX / 2;
- int sizY = sizeY / 2;
- x_1 += sizX;
- y_1 += sizY;
- if (x_1 < 5)
- x_1 = 5;
- if (x_1 > sizeX - 5)
- x_1 = sizeX - 5;
- if (y_1 < 5)
- y_1 = 5;
- if (y_1 > sizeY - 5)
- y_1 = sizeY - 5;
- x_1 += posX;
- y_1 += posY;
- return Vector(x_1, y_1, 0);
- }
- void DrawRadar()
- {
- ImGuiStyle& style = ImGui::GetStyle();
- ImVec2 oldPadding = style.WindowPadding;
- float oldAlpha = style.Colors[ImGuiCol_WindowBg].w;
- style.WindowPadding = ImVec2(0, 0);
- style.Colors[ImGuiCol_WindowBg].w = 0.7f;
- style.Colors[ImGuiCol_TitleBg] = ImColor(21, 21, 21, 255);
- style.Colors[ImGuiCol_TitleBgCollapsed] = ImColor(21, 21, 21, 255);
- style.Colors[ImGuiCol_TitleBgActive] = ImColor(21, 21, 21, 255);
- style.Colors[ImGuiCol_CloseButton] = ImColor(0, 0, 0, 0);
- style.Colors[ImGuiCol_CloseButtonHovered] = ImColor(0, 0, 0, 0);
- style.Colors[ImGuiCol_CloseButtonActive] = ImColor(0, 0, 0, 0);
- style.Alpha = 1.f;
- ImGui::SetNextWindowSize(ImVec2(300, 300));
- if (ImGui::Begin(("Radar"), &g_Options.Radar_window, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoResize))
- {
- ImVec2 siz = ImGui::GetWindowSize();
- ImVec2 pos = ImGui::GetWindowPos();
- ImGui::GetWindowDrawList()->AddRect(ImVec2(pos.x - 6, pos.y - 6), ImVec2(pos.x + siz.x + 6, pos.y + siz.y + 6), ImGui::GetColorU32(ImVec4(0, 0, 0, 255)), 0.0F, -1, 1.5f);
- ImDrawList* windowDrawList = ImGui::GetWindowDrawList();
- windowDrawList->AddLine(ImVec2(pos.x + (siz.x / 2), pos.y + 0), ImVec2(pos.x + (siz.x / 2), pos.y + siz.y), ImGui::GetColorU32(ImVec4(50, 50, 150, 100)), 1.f);
- windowDrawList->AddLine(ImVec2(pos.x + 0, pos.y + (siz.y / 2)), ImVec2(pos.x + siz.x, pos.y + (siz.y / 2)), ImGui::GetColorU32(ImVec4(50, 50, 150, 100)), 1.f);
- IClientEntity *pLocal = g_EntityList->GetClientEntity(g_EngineClient->GetLocalPlayer());
- if (g_EngineClient->IsInGame() && g_EngineClient->IsConnected())
- {
- Vector LocalPos = g_LocalPlayer->GetEyePos();
- QAngle ang;
- g_EngineClient->GetViewAngles(ang);
- for (int i = 0; i < g_EngineClient->GetMaxClients(); i++) {
- C_BasePlayer *pBaseEntity = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
- bool enemy_only;
- if (!pBaseEntity)
- continue;
- //if (pBaseEntity->IsDormant())
- //continue;
- if (!pBaseEntity->m_iHealth() > 0)
- continue;
- if (g_LocalPlayer->m_iTeamNum() == pBaseEntity->m_iTeamNum())
- continue;
- bool viewCheck = false;
- Vector EntityPos = RotatePoint(pBaseEntity->GetRenderOrigin(), LocalPos, pos.x, pos.y, siz.x, siz.y, ang.yaw, 1.5f, &viewCheck);
- ImU32 clr = ImGui::GetColorU32(ImVec4(255, 0, 0, 255));
- int s = 3;
- windowDrawList->AddCircleFilled(ImVec2(EntityPos.x, EntityPos.y), s, clr);
- }
- }
- }
- ImGui::End();
- style.WindowPadding = oldPadding;
- style.Colors[ImGuiCol_WindowBg].w = oldAlpha;
- }
- // fasza ez megvan includold menu.cpp-be és írd bele ezt :
- if (g_Options.Radar_window)
- {
- DrawRadar();
- }
- // ok most jöhet a spectator list ezt meg csak kúrd bele a menübe
- if (g_Options.spectator_list)
- {
- int cnt = 0;
- for (int i = 1; i <= g_EntityList->GetHighestEntityIndex(); i++)
- {
- C_BasePlayer *player = C_BasePlayer::GetPlayerByIndex(i);
- if (!player || player == nullptr)
- continue;
- player_info_t player_info;
- if (player != g_LocalPlayer)
- {
- if (g_EngineClient->GetPlayerInfo(i, &player_info) && !player->IsAlive() && !player->IsDormant())
- {
- auto observer_target = player->m_hObserverTarget();
- if (!observer_target)
- continue;
- auto target = observer_target.Get();
- if (!target)
- continue;
- player_info_t player_info2;
- if (g_EngineClient->GetPlayerInfo(target->EntIndex(), &player_info2))
- {
- char player_name[255] = { 0 };
- sprintf_s(player_name, "%s -> %s", player_info.szName, player_info2.szName);
- ImGui::SetNextWindowSize(ImVec2(300, 160));
- ImGui::Begin("Spectator List", &g_Options.spectator_list, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
- {
- ImVec2 siz = ImGui::CalcTextSize(player_name);
- if (target->EntIndex() == g_LocalPlayer->EntIndex())
- {
- ImGui::TextColored(ImVec4(1.00f, 0.00f, 0.23f, 1.f), player_name);
- }
- else
- {
- ImGui::Text(player_name);
- }
- }ImGui::End();
- }
- int w, h;
- ++cnt;
- }
- }
- else
- {
- ImGui::SetNextWindowSize(ImVec2(300, 160));
- ImGui::Begin("Spectator List", &g_Options.spectator_list, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
- {
- }ImGui::End();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement