Advertisement
Guest User

for gr8

a guest
Apr 26th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.41 KB | None | 0 0
  1. Radar.h //szóval csinálj egy új .h file-t és írd bele ezt :
  2.  
  3. include "menu.hpp"
  4. #include "hooks.hpp"
  5. #include "options.hpp"
  6.  
  7. static Vector RotatePoint(Vector EntityPos, Vector LocalPlayerPos, int posX, int posY, int sizeX, int sizeY, float angle, float zoom, bool* viewCheck)
  8. {
  9.     float r_1, r_2;
  10.     float x_1, y_1;
  11.  
  12.     r_1 = -(EntityPos.y - LocalPlayerPos.y);
  13.     r_2 = EntityPos.x - LocalPlayerPos.x;
  14.     float Yaw = angle - 90.0f;
  15.  
  16.     float yawToRadian = Yaw * (float)(M_PI / 180.0F);
  17.     x_1 = (float)(r_2 * (float)cos((double)(yawToRadian)) - r_1 * sin((double)(yawToRadian))) / 20;
  18.     y_1 = (float)(r_2 * (float)sin((double)(yawToRadian)) + r_1 * cos((double)(yawToRadian))) / 20;
  19.  
  20.     *viewCheck = y_1 < 0;
  21.  
  22.     x_1 *= zoom;
  23.     y_1 *= zoom;
  24.  
  25.     int sizX = sizeX / 2;
  26.     int sizY = sizeY / 2;
  27.  
  28.     x_1 += sizX;
  29.     y_1 += sizY;
  30.  
  31.     if (x_1 < 5)
  32.         x_1 = 5;
  33.  
  34.     if (x_1 > sizeX - 5)
  35.         x_1 = sizeX - 5;
  36.  
  37.     if (y_1 < 5)
  38.         y_1 = 5;
  39.  
  40.     if (y_1 > sizeY - 5)
  41.         y_1 = sizeY - 5;
  42.  
  43.  
  44.     x_1 += posX;
  45.     y_1 += posY;
  46.  
  47.  
  48.     return Vector(x_1, y_1, 0);
  49. }
  50.  
  51.  
  52. void DrawRadar()
  53. {
  54.     ImGuiStyle& style = ImGui::GetStyle();
  55.     ImVec2 oldPadding = style.WindowPadding;
  56.     float oldAlpha = style.Colors[ImGuiCol_WindowBg].w;
  57.     style.WindowPadding = ImVec2(0, 0);
  58.     style.Colors[ImGuiCol_WindowBg].w = 0.7f;
  59.     style.Colors[ImGuiCol_TitleBg] = ImColor(21, 21, 21, 255);
  60.     style.Colors[ImGuiCol_TitleBgCollapsed] = ImColor(21, 21, 21, 255);
  61.     style.Colors[ImGuiCol_TitleBgActive] = ImColor(21, 21, 21, 255);
  62.     style.Colors[ImGuiCol_CloseButton] = ImColor(0, 0, 0, 0);
  63.     style.Colors[ImGuiCol_CloseButtonHovered] = ImColor(0, 0, 0, 0);
  64.     style.Colors[ImGuiCol_CloseButtonActive] = ImColor(0, 0, 0, 0);
  65.     style.Alpha = 1.f;
  66.     ImGui::SetNextWindowSize(ImVec2(300, 300));
  67.  
  68.     if (ImGui::Begin(("Radar"), &g_Options.Radar_window, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoResize))
  69.     {
  70.         ImVec2 siz = ImGui::GetWindowSize();
  71.         ImVec2 pos = ImGui::GetWindowPos();
  72.  
  73.         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);
  74.         ImDrawList* windowDrawList = ImGui::GetWindowDrawList();
  75.         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);
  76.         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);
  77.  
  78.         IClientEntity *pLocal = g_EntityList->GetClientEntity(g_EngineClient->GetLocalPlayer());
  79.  
  80.  
  81.         if (g_EngineClient->IsInGame() && g_EngineClient->IsConnected())
  82.         {
  83.  
  84.             Vector LocalPos = g_LocalPlayer->GetEyePos();
  85.             QAngle ang;
  86.             g_EngineClient->GetViewAngles(ang);
  87.  
  88.             for (int i = 0; i < g_EngineClient->GetMaxClients(); i++) {
  89.                 C_BasePlayer *pBaseEntity = (C_BasePlayer*)g_EntityList->GetClientEntity(i);
  90.  
  91.                 bool enemy_only;
  92.  
  93.                 if (!pBaseEntity)
  94.                     continue;
  95.                 //if (pBaseEntity->IsDormant())
  96.                     //continue;
  97.                 if (!pBaseEntity->m_iHealth() > 0)
  98.                     continue;
  99.            
  100.                 if (g_LocalPlayer->m_iTeamNum() == pBaseEntity->m_iTeamNum())
  101.                     continue;
  102.  
  103.  
  104.                 bool viewCheck = false;
  105.                 Vector EntityPos = RotatePoint(pBaseEntity->GetRenderOrigin(), LocalPos, pos.x, pos.y, siz.x, siz.y, ang.yaw, 1.5f, &viewCheck);
  106.  
  107.  
  108.                 ImU32 clr = ImGui::GetColorU32(ImVec4(255, 0, 0, 255));
  109.  
  110.                 int s = 3;
  111.  
  112.                 windowDrawList->AddCircleFilled(ImVec2(EntityPos.x, EntityPos.y), s, clr);
  113.  
  114.             }
  115.  
  116.         }
  117.     }
  118.     ImGui::End();
  119.     style.WindowPadding = oldPadding;
  120.     style.Colors[ImGuiCol_WindowBg].w = oldAlpha;
  121.  
  122. }
  123. // fasza ez megvan includold menu.cpp-be és írd bele ezt :
  124.  
  125.     if (g_Options.Radar_window)
  126.     {
  127.         DrawRadar();
  128.     }
  129.  
  130. // ok most jöhet a spectator list ezt meg csak kúrd bele a menübe
  131.  
  132.     if (g_Options.spectator_list)
  133.     {
  134.         int cnt = 0;
  135.  
  136.         for (int i = 1; i <= g_EntityList->GetHighestEntityIndex(); i++)
  137.         {
  138.             C_BasePlayer *player = C_BasePlayer::GetPlayerByIndex(i);
  139.  
  140.             if (!player || player == nullptr)
  141.                 continue;
  142.  
  143.             player_info_t player_info;
  144.             if (player != g_LocalPlayer)
  145.             {
  146.                 if (g_EngineClient->GetPlayerInfo(i, &player_info) && !player->IsAlive() && !player->IsDormant())
  147.                 {
  148.                     auto observer_target = player->m_hObserverTarget();
  149.                     if (!observer_target)
  150.                         continue;
  151.  
  152.                     auto target = observer_target.Get();
  153.                     if (!target)
  154.                         continue;
  155.  
  156.                     player_info_t player_info2;
  157.                     if (g_EngineClient->GetPlayerInfo(target->EntIndex(), &player_info2))
  158.                     {
  159.                         char player_name[255] = { 0 };
  160.                         sprintf_s(player_name, "%s -> %s", player_info.szName, player_info2.szName);
  161.                        
  162.                         ImGui::SetNextWindowSize(ImVec2(300, 160));
  163.                         ImGui::Begin("Spectator List", &g_Options.spectator_list, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
  164.                         {
  165.                             ImVec2 siz = ImGui::CalcTextSize(player_name);
  166.                            
  167.  
  168.                             if (target->EntIndex() == g_LocalPlayer->EntIndex())
  169.                             {
  170.                                 ImGui::TextColored(ImVec4(1.00f, 0.00f, 0.23f, 1.f), player_name);
  171.                             }
  172.                             else
  173.                             {
  174.                                 ImGui::Text(player_name);
  175.                             }
  176.  
  177.                         }ImGui::End();
  178.  
  179.                     }
  180.                         int w, h;
  181.                         ++cnt;
  182.                     }
  183.                 }
  184.             else
  185.             {
  186.                 ImGui::SetNextWindowSize(ImVec2(300, 160));
  187.                 ImGui::Begin("Spectator List", &g_Options.spectator_list, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
  188.                 {
  189.  
  190.  
  191.                 }ImGui::End();
  192.  
  193.             }
  194.  
  195.             }
  196.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement