- Yasaklandı
-
- #1
[font=arial, tahoma]EKRAN GÖRÜNTÜSÜ:[/FONT]
[font=arial, tahoma]
cMenu_h[/FONT]
[font=arial, tahoma]PHP Kod:[/FONT]
[font=arial, tahoma]Kod:[/FONT]
[font=arial, tahoma] [/FONT]
[font=arial, tahoma]IMENUELEMENT_H[/FONT]
[font=arial, tahoma]PHP Kod:[/FONT]
[font=arial, tahoma]Kod:[/FONT]
[font=arial, tahoma] [/FONT]
[font=arial, tahoma]You should call the menu in EndScene:[/FONT]
[font=arial, tahoma]PHP Kod:[/FONT]
[font=arial, tahoma]Kod:[/FONT]
[font=arial, tahoma] [/FONT]
[font=arial, tahoma]Example cheat class implementing the interface:[/FONT]
[font=arial, tahoma]PHP Kod:[/FONT]
[font=arial, tahoma]Kod:[/FONT]
cMenu_h[/FONT]
[font=arial, tahoma]PHP Kod:[/FONT]
[font=arial, tahoma]Kod:[/FONT]
Kod:
#pragma once
#include <vector>
#include <initializer_list>
#include "CRender.h"
#include "IMenuElement.h"
class CMenu
{
private:
struct MenuEntity
{
std::string Header;
std::vector<std::string> CheatOptions;
//-1 = nothing is highlighted, 0 = the header is highlighted, then first cheatOption is 1
int IsHighlighted = -1;
bool IsCollapsed = true;
};
std::vector<IMenuElement*> CheatClasses;
std::vector<MenuEntity> MenuEntities;
CRender* m_pRender;
bool Enabled = false;
bool bIsCreated = false;
DWORD ColHeader;
DWORD ColBackground;
DWORD ColHightlighted;
DWORD BorderColor;
DWORD TextColor;
DWORD ValueColor;
DWORD waterMarkColor;
/*
You can change these values according to your needs
*/
const int rectWidth = 150;
const int rectHeight = 22;
const int rectBottomMargin = 0;
const int TextLeftMargin = 10;
const int TextTopMargin = 4;
const int TextRightMargin = 30;
public:
void Create(CRender* pRender, std::initializer_list<IMenuElement*> cheats)
{
bIsCreated = true;
m_pRender = pRender;
CheatClasses.clear();
CheatClasses.assign(cheats.begin(), cheats.end());
for (auto cheatClass : CheatClasses)
{
MenuEntity ent;
ent.Header = cheatClass->Header();
ent.CheatOptions = cheatClass->Cheats();
MenuEntities.push_back(ent);
}
if (MenuEntities.size() > 0)
MenuEntities[0].IsHighlighted = 0;
/*
Change colors to your needs
*/
ColHeader = D3DCOLOR_RGBA(61, 76, 83, 255);
ColBackground = D3DCOLOR_RGBA(77, 179, 179, 255);
ColHightlighted = D3DCOLOR_RGBA(242, 194, 73, 255);
BorderColor = D3DCOLOR_RGBA(61, 76, 83, 255);
TextColor = m_pRender->GetColor(Colors::WHITE);
ValueColor = D3DCOLOR_RGBA(230, 119, 46, 255);
waterMarkColor = m_pRender->GetColor(Colors::GREEN);
}
bool IsCreated()
{
return bIsCreated;
}
void Watermark(char* cheatName)
{
m_pRender->DrawOutlinedFontText(5, 0, waterMarkColor, cheatName);
}
void Render(int X, int Y)
{
if (!Enabled)
return;
int y = Y;
for (int curEnt = 0; curEnt < MenuEntities.size(); curEnt++)
{
if (MenuEntities[curEnt].IsCollapsed)
{
if (MenuEntities[curEnt].IsHighlighted != -1)
m_pRender->DrawRect(X, y, rectWidth, rectHeight, ColHightlighted);
else
m_pRender->DrawRect(X, y, rectWidth, rectHeight, ColHeader);
m_pRender->DrawOutlinedRect(X, y, rectWidth, rectHeight, BorderColor);
m_pRender->DrawOutlinedFontText(X + TextLeftMargin, y + TextTopMargin, TextColor, (char*)MenuEntities[curEnt].Header.c_str());
y += rectHeight + rectBottomMargin;
}
else
{
if (MenuEntities[curEnt].IsHighlighted == 0)
m_pRender->DrawRect(X, y, rectWidth, rectHeight, ColHightlighted);
else
m_pRender->DrawRect(X, y, rectWidth, rectHeight, ColHeader);
m_pRender->DrawOutlinedRect(X, y, rectWidth, rectHeight, BorderColor);
m_pRender->DrawOutlinedFontText(X + TextLeftMargin, y + TextTopMargin, TextColor, (char*)(MenuEntities[curEnt].Header+" »").c_str());
y += rectHeight + rectBottomMargin;
for (int i = 0; i < MenuEntities[curEnt].CheatOptions.size(); i++)
{
if (i+1 == MenuEntities[curEnt].IsHighlighted)
m_pRender->DrawRect(X, y, rectWidth, rectHeight, ColHightlighted);
else
m_pRender->DrawRect(X, y, rectWidth, rectHeight, ColBackground);
m_pRender->DrawOutlinedRect(X, y, rectWidth, rectHeight, BorderColor);
m_pRender->DrawOutlinedFontText(X + TextLeftMargin, y + TextTopMargin, TextColor, (char*)MenuEntities[curEnt].CheatOptions[i].c_str());
m_pRender->DrawOutlinedFontText(X + rectWidth - TextRightMargin, y + TextTopMargin, ValueColor, CheatClasses[curEnt]->Value(i));
y += rectHeight + rectBottomMargin;
}
}
}
}
void PollInput()
{
if (GetAsyncKeyState(VK_INSERT) & 1)
Enabled = !Enabled;
if (!Enabled)
return;
int Header = 0;
int CheatOption = 0;
int newHeader = 0;
int newCheatOption = 0;
for (int i = 0; i < MenuEntities.size(); i++)
{
if (MenuEntities[i].IsHighlighted != -1)
{
Header = i;
CheatOption = MenuEntities[i].IsHighlighted;
}
}
if (GetAsyncKeyState(VK_LEFT) & 1)
{
if (CheatOption > 0)
CheatClasses[Header]->OnLeftKey(CheatOption - 1);
return;
}
//only right key collapses headers
if (GetAsyncKeyState(VK_RIGHT) & 1)
{
//collapse header
if (CheatOption == 0)
MenuEntities[Header].IsCollapsed = !MenuEntities[Header].IsCollapsed;
else
CheatClasses[Header]->OnRightKey(CheatOption - 1);
return;
}
if (GetAsyncKeyState(VK_UP) & 1)
{
if (Header == 0 && CheatOption == 0)
{
newHeader = Header;
newCheatOption = CheatOption;
}
else
{
if (CheatOption > 0)
{
newHeader = Header;
newCheatOption = CheatOption - 1;
}
else //Cheat Option is 0
{
if (MenuEntities[Header - 1].IsCollapsed)
{
newHeader = Header - 1;
newCheatOption = 0;
}
else
{
newHeader = Header - 1;
newCheatOption = MenuEntities[Header - 1].CheatOptions.size();
}
}
}
MenuEntities[Header].IsHighlighted = -1;
MenuEntities[newHeader].IsHighlighted = newCheatOption;
return;
}
if (GetAsyncKeyState(VK_DOWN) & 1)
{
if (Header == MenuEntities.size() - 1 &&
( (CheatOption == MenuEntities[Header].CheatOptions.size() && !MenuEntities[Header].IsCollapsed) ||
CheatOption == 0 && MenuEntities[Header].IsCollapsed) )
{
newHeader = Header;
newCheatOption = CheatOption;
}
else
{
if (MenuEntities[Header].IsCollapsed)
{
//Cheat options must be 0
newHeader = Header + 1;
newCheatOption = 0;
}
else
{
if (CheatOption == MenuEntities[Header].CheatOptions.size())
{
newHeader = Header + 1;
newCheatOption = 0;
}
else
{
newHeader = Header;
newCheatOption = CheatOption + 1;
}
}
}
MenuEntities[Header].IsHighlighted = -1;
MenuEntities[newHeader].IsHighlighted = newCheatOption;
return;
}
}
};
[font=arial, tahoma] [/FONT]
[font=arial, tahoma]IMENUELEMENT_H[/FONT]
[font=arial, tahoma]PHP Kod:[/FONT]
[font=arial, tahoma]Kod:[/FONT]
Kod:
#pragma once
#include <vector>
class IMenuElement
{
public:
//exposes the Header
virtual std::string Header() = 0;
//exposes all the cheat options like BonESP, SkeletonESP, HealthESP
virtual std::vector<std::string> Cheats() = 0;
virtual char* Value(int index) = 0;
virtual void OnRightKey(int index) = 0;
virtual void OnLeftKey(int index) = 0;
};
[font=arial, tahoma] [/FONT]
[font=arial, tahoma]You should call the menu in EndScene:[/FONT]
[font=arial, tahoma]PHP Kod:[/FONT]
[font=arial, tahoma]Kod:[/FONT]
Kod:
HRESULT __stdcall hk_EndScene(LPDIRECT3DDEVICE9 pDevice)
{
if (!g_pRender->IsCreated())
g_pRender->Create(pDevice);
if (!g_pMenu->IsCreated())
g_pMenu->Create(g_pRender, { g_pAimbot, g_pTriggerbot, g_pMISC, g_pESP });
g_pRender->Begin();
g_pMenu->Render(400, 300);
g_pMenu->Watermark("jajajejcocojumbo");
g_pMenu->PollInput();
g_pRender->End();
return oEndScene(pDevice);
}
[font=arial, tahoma] [/FONT]
[font=arial, tahoma]Example cheat class implementing the interface:[/FONT]
[font=arial, tahoma]PHP Kod:[/FONT]
[font=arial, tahoma]Kod:[/FONT]
Kod:
class MISC : public IMenuElement
{
private:
enum Cheats
{
ercs,
esmoothx,
esmoothy,
erecoilxhair,
elambert,
echams,
ecrosshair,
eradar
};
bool radar = false;
bool xhair = false;
bool chams = false;
bool lambert = true;
bool rcs = true;
float smoothX = 1.0;
float smoothY = 1.0;
bool recoilXhair = true;
public:
....
/*
Menu Stuff
*/
std::string Header()
{
return "MISC";
}
std::vector<std::string> Cheats()
{
return std::vector<std::string>{ "RCS", "Smooth X", "Smooth Y", "Recoil Xhair", "Lambert", "Chams", "Crosshair", "Radar" };
}
char* Value(int index)
{
static std::string str;
switch (index)
{
case ercs:
return rcs ? "1" : "0";
case esmoothx:
str = Utils::to_string_with_precision(smoothX);
return (char*)str.c_str();
case esmoothy:
str = Utils::to_string_with_precision(smoothY);
return (char*)str.c_str();
case ecrosshair:
return !xhair ? "0" : "1";
case echams:
return chams ? "1" : "0";
case elambert:
return lambert ? "1" : "0";
case erecoilxhair:
return recoilXhair ? "1" : "0";
case eradar:
return radar ? "1" : "0";
default:
return "N/A";
}
}
void OnRightKey(int index)
{
switch (index)
{
case ercs:
rcs = !rcs;
break;
case esmoothx:
smoothX += 0.1;
break;
case esmoothy:
smoothY += 0.1;
break;
case ecrosshair:
xhair = !xhair;
break;
case echams:
chams = !chams;
break;
case elambert:
lambert = !lambert;
break;
case erecoilxhair:
recoilXhair = !recoilXhair;
break;
case eradar:
radar = !radar;
break;
default:
break;
}
}
void OnLeftKey(int index)
{
switch (index)
{
case ercs:
rcs = !rcs;
break;
case esmoothx:
smoothX -= 0.1;
if (smoothX < 10e-5)
smoothX = 0.0;
break;
case esmoothy:
smoothY -= 0.1;
if (smoothY < 10e-5)
smoothY = 0.0;
break;
case ecrosshair:
xhair = !xhair;
break;
case echams:
chams = !chams;
break;
case elambert:
lambert = !lambert;
break;
case erecoilxhair:
recoilXhair = !recoilXhair;
break;
case eradar:
radar = !radar;
break;
default:
break;
}
}
};